diff --git a/development/batchtests/CMakeLists.txt b/development/batchtests/CMakeLists.txt index 94bb1cfa1d..69b3181d17 100644 --- a/development/batchtests/CMakeLists.txt +++ b/development/batchtests/CMakeLists.txt @@ -1,7 +1,10 @@ # Checking whether moving beamer slides through the document doesn't break its structure. # see also https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg203281.html add_test(NAME "outline-beamer" COMMAND ${PERL_EXECUTABLE} ${CMAKE_BINARY_DIR}/lyx_batch.pl beamer_test) -setmarkedtestlabel(outline-beamer "export") +setmarkedtestlabel(outline-beamer "export" "batch") # Checking that info inset correctly fills up VCS information # see also bug #10835 add_test(NAME "vcs-info" COMMAND ${PERL_EXECUTABLE} ${CMAKE_BINARY_DIR}/lyx_batch.pl vcs_info_export) +setmarkedtestlabel(vcs-info "batch") +add_test(NAME "AMS-import" COMMAND ${PERL_EXECUTABLE} ${CMAKE_BINARY_DIR}/lyx_batch.pl ams-import) +setmarkedtestlabel(AMS-import "tex2lyx" "batch") diff --git a/lib/scripts/lyx_batch.pl.in b/lib/scripts/lyx_batch.pl.in old mode 100755 new mode 100644 index b0b1472971..f5e9562a41 --- a/lib/scripts/lyx_batch.pl.in +++ b/lib/scripts/lyx_batch.pl.in @@ -12,7 +12,7 @@ sub check_precondition(); sub system1(@); my $builddir = "@CMAKE_BINARY_DIR@"; -my $userdir = "$builddir/Testing/.lyx"; +my $userdir = "$builddir/Testing/.lyxbatch"; my $workdir = "$builddir/autotests/out-home"; my $vsuffix = "@PROGRAM_SUFFIX@"; @@ -24,7 +24,8 @@ my $data = "$lyxsource/development/batchtests"; my %Tests = ( beamer_test => { - create => "beamer_test.tex", + orig_ext => "lyx", + create => ["beamer_test.tex"], commands => ["file-open beamer_test.lyx", "buffer-begin", "repeat 150 outline-down", @@ -38,24 +39,48 @@ my %Tests = ( command => [$git_exe, "ls-files", "--error-unmatch", "vcs_info_export.lyx"], workdir => "$data", }, - create => "vcs_info_export.tex", + orig_ext => "lyx", + create => ["vcs_info_export.tex"], command_line => ["-E", "pdflatex", "vcs_info_export.tex", "$data/vcs_info_export.lyx"], - } - ); + }, + "ams-import" => { + docompare => 0, + orig_ext => "tex", + create => ["ams-import.pdf", "ams-import.lyx"], + commands => ["buffer-new", + "buffer-import latex ams-import.tex", + "buffer-write", + "buffer-export pdf2", + "lyx-quit"], + }, + ); die("Expected argument missing") if (! defined($ARGV[0])); my $test = $ARGV[0]; die("Invalid argument") if (! defined($Tests{$test})); -my $orig_lyx = "$data/$test.lyx"; -my $work_lyx = "$workdir/$test.lyx"; +if (! -e $userdir) { + mkdir($userdir); +} +my $orig_file = "$data/$test.$Tests{$test}->{orig_ext}"; +my $work_file = "$workdir/$test.$Tests{$test}->{orig_ext}"; my $expected = "$data/$test.tex.orig"; -my $created = "$workdir/$Tests{$test}->{create}"; - -die("File \"$expected\" does not exist") if (! -e $expected); +my @created = (); +if (defined($Tests{$test}->{create})) { + for my $created (@{$Tests{$test}->{create}}) { + push(@created, "$workdir/$created"); + } +} +my $created = $created[0]; +my $docompare = 1; +if (defined($Tests{$test}->{docompare})) { + $docompare = $Tests{$test}->{docompare}; +} +die("File \"$expected\" does not exist") if ($docompare && ! -e $expected); # Create lyx-file to work with -copy($orig_lyx, $work_lyx) or die("Copy failed: $!"); -unlink($created); +copy($orig_file, $work_file) or die("Copy failed: $!"); +print "Unlinking " . join(' ', @created) . "\n"; +unlink(@created); $ENV{LANG} = "en"; $ENV{LC_ALL} = "C"; $ENV{LANGUAGE} = "en_US"; @@ -71,7 +96,7 @@ if (defined($Tests{$test}->{commands})) { } system1(@command); -die("Expected ($expected) and created ($created) files differ") if (compare($expected, $created) != 0); +die("Expected ($expected) and created ($created) files differ") if ($docompare && compare($expected, $created) != 0); exit(0); diff --git a/src/tex2lyx/test/CMakeLists.txt b/src/tex2lyx/test/CMakeLists.txt index a6f6789f85..375d1e2aec 100644 --- a/src/tex2lyx/test/CMakeLists.txt +++ b/src/tex2lyx/test/CMakeLists.txt @@ -44,7 +44,7 @@ foreach(_fl ${_tex_tests}) -DWORKDIR=${CMAKE_CURRENT_BINARY_DIR} -DTESTFILE=${fl} -P ${TOP_SRC_DIR}/src/tex2lyx/test/runtests.cmake) - set_tests_properties(tex2lyx/roundtrip/${_fl} PROPERTIES RESOURCE_LOCK "runtests.lock" LABELS "roundtrip") + set_tests_properties(tex2lyx/roundtrip/${_fl} PROPERTIES RESOURCE_LOCK "runtests.lock" LABELS "roundtrip:tex2lyx") add_test(NAME tex2lyx/cmplyx/${_fl} WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" COMMAND ${CMAKE_COMMAND} @@ -58,7 +58,7 @@ foreach(_fl ${_tex_tests}) -DWORKDIR=${CMAKE_CURRENT_BINARY_DIR} -DTESTFILE=${fl} -P ${TOP_SRC_DIR}/src/tex2lyx/test/runtests.cmake) - set_tests_properties(tex2lyx/cmplyx/${_fl} PROPERTIES RESOURCE_LOCK "runtests.lock" LABELS "cmplyx") + set_tests_properties(tex2lyx/cmplyx/${_fl} PROPERTIES RESOURCE_LOCK "runtests.lock" LABELS "cmplyx:tex2lyx") endforeach() add_dependencies(lyx_run_tests ${_tex2lyx} ${_lyx})