diff --git a/tool/lib/test/unit.rb b/tool/lib/test/unit.rb index 42d1d83442..ad053cffdd 100644 --- a/tool/lib/test/unit.rb +++ b/tool/lib/test/unit.rb @@ -64,7 +64,18 @@ module Test args = @init_hook.call(args, options) if @init_hook non_options(args, options) @run_options = orig_args - @help = orig_args.map { |s| s =~ /[\s|&<>$()]/ ? s.inspect : s }.join " " + + if seed = options[:seed] + srand(seed) + else + seed = options[:seed] = srand % 100_000 + srand(seed) + orig_args << "--seed=#{seed}" + end + + @help = "\n" + orig_args.map { |s| + " " + (s =~ /[\s|&<>$()]/ ? s.inspect : s) + }.join("\n") @options = options end @@ -79,7 +90,7 @@ module Test end opts.on '-s', '--seed SEED', Integer, "Sets random seed" do |m| - options[:seed] = m + options[:seed] = m.to_i end opts.on '-v', '--verbose', "Verbose. Show progress processing files." do