From 6fec25a51f2e94c64c02a8598dac4d6c3436b105 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Tue, 17 May 2022 14:55:39 +0930 Subject: [PATCH] python script to view tests results testtables.js no longer works in modern browsers as local file access has been disabled. This script runs a python http server that serves the contents of the current directory then opens the test results in the webbrowser --- test/meson.build | 5 +++++ test/view-test-results.py | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100755 test/view-test-results.py diff --git a/test/meson.build b/test/meson.build index 21a0588e7..be05d30ec 100644 --- a/test/meson.build +++ b/test/meson.build @@ -629,6 +629,11 @@ exe = executable('cairo-test-suite', [cairo_test_suite_sources, test_sources, ca libpdiff_dep], ) +html_files = ['index.html', 'testtable.js', 'view-test-results.py'] +foreach file : html_files + configure_file(input: file, output : file, copy: true) +endforeach + env = environment() env.set('srcdir', meson.current_source_dir()) diff --git a/test/view-test-results.py b/test/view-test-results.py new file mode 100755 index 000000000..16241fec0 --- /dev/null +++ b/test/view-test-results.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 + +import http.server +import os +import threading +import webbrowser + +port = 8000 + +server = http.server.ThreadingHTTPServer(("localhost", port), http.server.SimpleHTTPRequestHandler) +thread = threading.Thread(target = server.serve_forever) +thread.daemon = True +thread.start() + +webbrowser.open_new("http://localhost:" + str(port) + "/index.html") +input("\nPress Enter to exit\n\n")