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
This commit is contained in:
Adrian Johnson 2022-05-17 14:55:39 +09:30
parent e32b2c34f1
commit 6fec25a51f
2 changed files with 21 additions and 0 deletions

View file

@ -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())

16
test/view-test-results.py Executable file
View file

@ -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")