3 # Test runner that calls ../bin/fribidi --test --charset CHARSET *.input,
4 # captures the output and compares it to the data in the reference file given
10 raise Exception('Expected 4 command-line arguments: test_exe charset test.input test.reference')
13 test_exe = sys.argv[1]
15 input_file = sys.argv[3]
16 reference_file = sys.argv[4]
19 libpath = os.path.join(os.path.dirname(os.path.realpath(test_exe)),
22 os.environ['PATH'] = libpath + ';' + os.environ['PATH']
25 output = subprocess.check_output([test_exe, '--test', '--charset', charset, input_file])
26 ref_data = open(reference_file, "rb").read()
28 output = output.replace(b'\r\n', b'\n')
29 ref_data = ref_data.replace(b'\r\n', b'\n')
30 if output != ref_data:
31 print('Output:\n', output)
32 print('Reference file:\n', ref_data)
33 raise Exception('fribidi --test output for charset ' + charset + ' and input file ' + input_file + ' does not match data from reference file ' + reference_file)
35 raise Exception('fribidi --test failed for charset ' + charset + ' and input file ' + input_file)