--- a/main.lua Tue Sep 11 23:25:51 2018 +0100 +++ b/main.lua Tue Sep 11 23:27:23 2018 +0100 @@ -12,10 +12,11 @@ local test_metadata = {}; local server_log_wait_time = 0.2; local skip_server_startup_log = false; -local action_timeout = 5; +local action_timeout = 10; local verse_log_levels = { "warn", "error" }; local quiet = false; local force_summary = false; +local serve_mode = false; local property_rules = {}; @@ -97,6 +98,10 @@ end elseif opt == "--summary" then force_summary = true; + elseif opt == "--serve" then + serve_mode = 8007; + elseif opt == "--serve-port" then + serve_mode = assert(tonumber(get_value()), "expected port number"); else error("Unhandled command-line option: "..opt); end @@ -294,6 +299,22 @@ return { name = script.title or script_name, status = status, reason = reason }; end + +if serve_mode then + local have_serve, serve = pcall(require, "scansion.serve"); + + if not have_serve then + error("This version of scansion was not built with --with-server"); + end + + initialize_verse(function (e) + -- This function handles scansion errors, + -- but they shouldn't reach here anyway + end); + serve.run({ port = serve_mode }, run_test_script); + os.exit(0); +end + log_data("start", { metadata = test_metadata }); local result_tally = { all = {} }; @@ -311,6 +332,7 @@ log_data("end", { time = time(), summary = result_tally }); + local exit_code = 0; if result_tally.error then exit_code = 2; @@ -319,3 +341,5 @@ end os.exit(exit_code); + +