diff --git a/tests/test-420matroska_attachment_no_fileuid.rb b/tests/test-420matroska_attachment_no_fileuid.rb index 5f78ab5f9..8573f142c 100755 --- a/tests/test-420matroska_attachment_no_fileuid.rb +++ b/tests/test-420matroska_attachment_no_fileuid.rb @@ -13,7 +13,7 @@ test "extraction" do end test "propedit" do - sys "cp #{file} #{tmp}" + cp file, tmp propedit tmp, "--replace-attachment '=0:data/text/chap1.txt'" hash_tmp end diff --git a/tests/test-465propedit_gaps_of_130_bytes.rb b/tests/test-465propedit_gaps_of_130_bytes.rb index f7f8307a7..9d5a654e3 100755 --- a/tests/test-465propedit_gaps_of_130_bytes.rb +++ b/tests/test-465propedit_gaps_of_130_bytes.rb @@ -3,7 +3,7 @@ describe "mkvpropedit / create voids for 130 bytes long gaps" test "propedit" do - sys "cp data/mkv/propedit-gaps-130-bytes.mkv #{tmp}" + cp "data/mkv/propedit-gaps-130-bytes.mkv", tmp propedit tmp, "--edit track:s1 --set flag-default=0" hash_tmp end diff --git a/tests/test-499propedit_tags_and_track_properties.rb b/tests/test-499propedit_tags_and_track_properties.rb index 8b5c96157..ebbb8f815 100755 --- a/tests/test-499propedit_tags_and_track_properties.rb +++ b/tests/test-499propedit_tags_and_track_properties.rb @@ -4,7 +4,7 @@ describe "mkvpropedit / changing track properties and tags for the same track simultaneously" test "tags and props" do - merge "data/avi/v.avi", :keep_tmp => true + merge "data/avi/v.avi", :keep_tmp => true, :no_result => true propedit tmp, "--tags track:v1:data/text/tags-nested-simple.xml -e track:v1 --set display-width=1234" hash_tmp end diff --git a/tests/test-609propedit_video_colour_attributes.rb b/tests/test-609propedit_video_colour_attributes.rb index 7acc938a7..9cc347d79 100755 --- a/tests/test-609propedit_video_colour_attributes.rb +++ b/tests/test-609propedit_video_colour_attributes.rb @@ -8,7 +8,7 @@ def args *arrays end test "set all attributes" do - merge "--no-audio data/avi/v.avi" + merge "--no-audio data/avi/v.avi", :no_result => true src = tmp colour_attributes = [ @@ -43,19 +43,19 @@ test "set all attributes" do hashes = [] work = "#{src}-1" - sys "cp #{src} #{work}" + cp src, work propedit work, "--edit track:v1 --set pixel-width=1024" hashes << hash_file(work) - sys "cp #{src} #{work}" + cp src, work propedit work, "--edit track:v1 --set pixel-width=1024 #{args(colour_attributes)}" hashes << hash_file(work) - sys "cp #{src} #{work}" + cp src, work propedit work, "--edit track:v1 --set pixel-width=1024 #{args(colour_mastering_meta_attributes)}" hashes << hash_file(work) - sys "cp #{src} #{work}" + cp src, work propedit work, "--edit track:v1 --set pixel-width=1024 #{args(colour_attributes, colour_mastering_meta_attributes)}" hashes << hash_file(work) @@ -63,28 +63,28 @@ test "set all attributes" do end test "delete attributes" do - merge "--no-audio --max-frame-light 0:41 --min-luminance 0:42 data/avi/v.avi" + merge "--no-audio --max-frame-light 0:41 --min-luminance 0:42 data/avi/v.avi", :no_result => true hashes = [] src = tmp work = "#{src}-1" - sys "cp #{src} #{work}" + cp src, work propedit work, "--edit track:v1 --delete language" hashes << hash_file(work) # sys "mkvinfo #{work} >&2" - sys "cp #{src} #{work}" + cp src, work propedit work, "--edit track:v1 --delete language --delete min-luminance" hashes << hash_file(work) # sys "mkvinfo #{work} >&2" - sys "cp #{src} #{work}" + cp src, work propedit work, "--edit track:v1 --delete language --delete max-frame-light" hashes << hash_file(work) # sys "mkvinfo #{work} >&2" - sys "cp #{src} #{work}" + cp src, work propedit work, "--edit track:v1 --delete language --delete max-frame-light --delete min-luminance" hashes << hash_file(work) # sys "mkvinfo #{work} >&2" diff --git a/tests/test.d/controller.rb b/tests/test.d/controller.rb index ba6f8c34b..87f87d913 100644 --- a/tests/test.d/controller.rb +++ b/tests/test.d/controller.rb @@ -126,9 +126,13 @@ class Controller expected_results = @results.hash?(class_name).split(/-/) actual_results = result.split(/-/) + idx = 0 - current_test.commands.each_with_index do |command, idx| - msg += " " + ((expected_results[idx] != actual_results[idx]) ? "(*)" : " ") + " #{command}\n" + current_test.commands.each do |command| + command = { :command => command } unless command.is_a?(Hash) + prefix = !command[:no_result] && (expected_results[idx] != actual_results[idx]) ? "(*)" : " " + msg += " #{prefix} #{command[:command]}\n" + idx += 1 unless command[:no_result] end if (update_failed) diff --git a/tests/test.d/simple_test.rb b/tests/test.d/simple_test.rb index eba3fcb25..c4c12c2d1 100644 --- a/tests/test.d/simple_test.rb +++ b/tests/test.d/simple_test.rb @@ -235,7 +235,7 @@ class SimpleTest output = options[:output] || self.tmp command = "../src/mkvmerge --engage no_variable_data -o #{output} #{args.first}" - self.sys command, :exit_code => options[:exit_code] + self.sys command, :exit_code => options[:exit_code], :no_result => options[:no_result] end def identify *args @@ -247,7 +247,7 @@ class SimpleTest command = "../src/mkvmerge --identify --identification-format #{format} --engage no_variable_data #{args.first}" - self.sys command, :exit_code => options[:exit_code] + self.sys command, :exit_code => options[:exit_code], :no_result => options[:no_result] end def identify_json *args @@ -256,7 +256,7 @@ class SimpleTest command = "../src/mkvmerge --identify --identification-format json --engage no_variable_data #{args.first}" - output, _ = self.sys(command, :exit_code => options[:exit_code]) + output, _ = self.sys(command, :exit_code => options[:exit_code], :no_result => options[:no_result]) return JSON.load(output.join('')) end @@ -269,7 +269,7 @@ class SimpleTest output = "> #{output}" unless %r{^[>\|]}.match(output) output = '' if options[:output] == :return command = "../src/mkvinfo --engage no_variable_data --ui-language en_US #{args.first} #{output}" - self.sys command, :exit_code => options[:exit_code] + self.sys command, :exit_code => options[:exit_code], :no_result => options[:no_result] end def extract *args @@ -279,7 +279,7 @@ class SimpleTest mode = options[:mode] || :tracks command = "../src/mkvextract --engage no_variable_data #{mode} #{args.first} " + options.keys.select { |key| key.is_a?(Numeric) }.sort.collect { |key| "#{key}:#{options[key]}" }.join(' ') - self.sys command, :exit_code => options[:exit_code] + self.sys command, :exit_code => options[:exit_code], :no_result => options[:no_result] end def propedit file_name, *args @@ -287,7 +287,7 @@ class SimpleTest fail ArgumentError if args.empty? command = "../src/mkvpropedit --engage no_variable_data #{file_name} #{args.first}" - *result = self.sys command, :exit_code => options[:exit_code] + *result = self.sys command, :exit_code => options[:exit_code], :no_result => options[:no_result] self.sys "../src/tools/ebml_validator -M #{file_name}", dont_record_command: true if FileTest.exists?("../src/tools/ebml_validator") @@ -300,7 +300,7 @@ class SimpleTest fail ArgumentError if args.empty? command = args.shift - @commands << command unless options[:dont_record_command] + @commands << { :command => command, :no_result => options[:no_result] } unless options[:dont_record_command] if !%r{>}.match command temp_file = Tempfile.new('mkvtoolnix-test-output') @@ -320,6 +320,13 @@ class SimpleTest return exit_code end + def cp source, target, *args + options = args.extract_options! + options[:no_result] = true unless options.key?(:no_result) + + sys "cp '#{source}' '#{target}'", options + end + def error reason show_message " Failed. Reason: #{reason}" raise "test failed" diff --git a/tests/test.d/test.rb b/tests/test.d/test.rb index 60ae82f3f..f2d738dab 100644 --- a/tests/test.d/test.rb +++ b/tests/test.d/test.rb @@ -61,8 +61,8 @@ class Test def sys(command, *arg) options = arg.extract_options! - @commands << command unless options[:dont_record_command] - @debug_commands << command unless options[:dont_record_command] + @commands << { :command => command, :no_result => options[:no_result] } unless options[:dont_record_command] + @debug_commands << command unless options[:dont_record_command] command << " >/dev/null 2>/dev/null " unless (/>/.match(command)) puts "COMMAND #{command}" if ENV['DEBUG']