64 lines
1.8 KiB
Ruby
Executable file
64 lines
1.8 KiB
Ruby
Executable file
#! /usr/bin/ruby
|
|
|
|
=begin
|
|
--------------------------------------------------------------------------------
|
|
|
|
Select the name of the test that we will be running, based on the directories
|
|
in testinfo/tests directory.
|
|
|
|
Record that selection, along with the desired number of iterations and threads.
|
|
|
|
--------------------------------------------------------------------------------
|
|
--------------------------------------------------------------------------------
|
|
=end
|
|
|
|
begin
|
|
require File.expand_path('subscripts/common', File.dirname(__FILE__))
|
|
rescue LoadError => e
|
|
puts e
|
|
end
|
|
|
|
@test_parms_file = "#{@home}/scripts/subscripts/_current_test.rb"
|
|
|
|
# Find out what tests we have available
|
|
def build_test_list()
|
|
@test_names = []
|
|
Dir.foreach(test_file('tests')) do |filename|
|
|
@test_names.push(filename) unless filename[0,1] == "."
|
|
end
|
|
@test_names.sort!
|
|
raise "Found no test directories." if @test_names.length == 0
|
|
end
|
|
|
|
# Write the current version to the file
|
|
def write_current_test(name, threads, iterations)
|
|
File.open(@test_parms_file, "w") do |file|
|
|
file.puts "# what is the current test, and how many times will it run?"
|
|
file.puts "@test_name = '#{name}'"
|
|
file.puts "@test_threads = '#{threads}'"
|
|
file.puts "@test_iterations = '#{iterations}'"
|
|
end
|
|
puts "test set to #{name}, #{threads} threads, #{iterations} iterations."
|
|
end
|
|
|
|
#
|
|
# ---------------------------------------------------------
|
|
# MAIN ROUTINE
|
|
# ---------------------------------------------------------
|
|
#
|
|
|
|
build_test_list()
|
|
|
|
puts "Enter test number: "
|
|
@test_names.each_index do |index|
|
|
puts " #{index+1} = #{@test_names[index]}"
|
|
end
|
|
number = STDIN.gets.chomp.to_i
|
|
|
|
if number <= 0 || number > @test_names.length
|
|
puts "UNRECOGNIZED TEST."
|
|
exit
|
|
end
|
|
|
|
write_current_test(@test_names[number - 1], 1, 1)
|
|
|