# # # patch "testlib.lua" # from [a1e48a128c3e3c787204885ac188217be9d3f82a] # to [0b2490ce83794ce3a3404c57af4fd51aa9b766a3] # # patch "testsuite.lua" # from [858afba9d790d7ff83092c18d5442bcdc59547fc] # to [08c414f640e805ce96691236e9c920f0aa0306c2] # ============================================================ --- testlib.lua a1e48a128c3e3c787204885ac188217be9d3f82a +++ testlib.lua 0b2490ce83794ce3a3404c57af4fd51aa9b766a3 @@ -41,12 +41,14 @@ function prepare_to_run_tests() -- hook to be overridden by the main testsuite file, if necessary; -- called after determining the set of tests to run function prepare_to_run_tests() + return 0 end -- hook to be overridden by the main testsuite file, if necessary; -- called after opening the master logfile, but _before_ parsing -- arguments or determining the set of tests to run. function prepare_to_enumerate_tests() + return 0 end function P(...) @@ -801,7 +803,13 @@ function run_tests(args) -- tester.cc has set 'logfile' to an appropriate file name logfile = io.open(logfile, "w") - prepare_to_enumerate_tests() + do + local s = prepare_to_enumerate_tests() + if s ~= 0 then + P("Enumeration of tests failed.\n") + return s + end + end -- any directory in testdir with a __driver__.lua inside is a test case local tests = {} @@ -855,9 +863,13 @@ function run_tests(args) if not list_only then logfile:write("Running on ", get_ostype(), "\n\n") + local s = prepare_to_run_tests() + if s ~= 0 then + P("Test suite preparation failed.\n") + return s + end P("Running tests...\n") end - prepare_to_run_tests() local counts = {} counts.success = 0 ============================================================ --- testsuite.lua 858afba9d790d7ff83092c18d5442bcdc59547fc +++ testsuite.lua 08c414f640e805ce96691236e9c920f0aa0306c2 @@ -338,9 +338,23 @@ function prepare_to_run_tests () writefile_q("in", nil) prepare_redirect("in", "out", "err") - execute(monotone_path, "--full-version") - logfile:write(readfile_q("out")) + + local status = execute(monotone_path, "version", "--full") + local out = readfile_q("out") + local err = readfile_q("err") + + if status == 0 and err == "" and out ~= "" then + logfile:write(out) + else + P(string.format("mtn version --full: exit %d\nstdout:\n", status)) + P(out) + P("stderr:\n") + P(err) + return 1 + end + unlogged_remove("in") unlogged_remove("out") unlogged_remove("err") + return 0 end