)
asm_testcases = [
- ['brw', 'tests/gen4'],
- ['g4x', 'tests/gen4.5'],
- ['ilk', 'tests/gen5'],
- ['snb', 'tests/gen6'],
- ['ivb', 'tests/gen7'],
- ['hsw', 'tests/gen7.5'],
- ['bdw', 'tests/gen8'],
- ['skl', 'tests/gen9'],
- ['icl', 'tests/gen11'],
+ ['brw', 'gen4'],
+ ['g4x', 'gen4.5'],
+ ['ilk', 'gen5'],
+ ['snb', 'gen6'],
+ ['ivb', 'gen7'],
+ ['hsw', 'gen7.5'],
+ ['bdw', 'gen8'],
+ ['skl', 'gen9'],
+ ['icl', 'gen11'],
]
-test_runner = find_program('tests/run-test.sh')
+test_runner = find_program('tests/run-test.py')
foreach testcase : asm_testcases
+ _gen_name = testcase[0]
+ _gen_num = testcase[1]
+ _gen_folder = join_paths(meson.current_source_dir(), 'tests', _gen_num)
test(
- 'i965_asm : ' + testcase[1], test_runner,
- args : [i965_asm, testcase[1], testcase[0]],
- env : ['srcdir=' + meson.current_source_dir()]
+ 'i965_asm : ' + _gen_num, test_runner,
+ args : [
+ '--i965_asm', i965_asm,
+ '--gen_name', _gen_name,
+ '--gen_folder', _gen_folder,
+ ],
+ suite : 'intel',
)
endforeach
--- /dev/null
+#!/usr/bin/env python3
+
+import argparse
+import difflib
+import pathlib
+import subprocess
+import tempfile
+
+parser = argparse.ArgumentParser()
+parser.add_argument('--i965_asm',
+ help='path to i965_asm binary')
+parser.add_argument('--gen_name',
+ help='name of the hardware generation (as understood by i965_asm)')
+parser.add_argument('--gen_folder',
+ type=pathlib.Path,
+ help='name of the folder for the generation')
+args = parser.parse_args()
+
+success = True
+
+for asm_file in args.gen_folder.glob('*.asm'):
+ expected_file = asm_file.stem + '.expected'
+ expected_path = args.gen_folder / expected_file
+ out_path = tempfile.NamedTemporaryFile()
+
+ subprocess.run([args.i965_asm,
+ '--type', 'hex',
+ '--gen', args.gen_name,
+ '--output', out_path.name,
+ asm_file],
+ stdout=subprocess.DEVNULL,
+ stderr=subprocess.STDOUT)
+
+ with expected_path.open() as f:
+ lines_before = f.readlines()
+ lines_after = [line.decode('ascii') for line in out_path]
+
+ diff = ''.join(difflib.unified_diff(lines_before, lines_after,
+ expected_file, asm_file.stem + '.out'))
+
+ if diff:
+ print('Output comparison for {}:'.format(asm_file.name))
+ print(diff)
+ success = False
+ else:
+ print('{} : PASS'.format(asm_file.name))
+
+if not success:
+ exit(1)
+++ /dev/null
-#!/bin/sh
-
-SRCDIR="${srcdir}"
-I965_ASM="$1"
-
-test="TEST"
-
-if [ -n "$2" ] ; then
- test="$2"
-fi
-
-if [ -n "$3" ] ; then
- gen="$3"
-fi
-
-for file in ${SRCDIR}/${test}/*.asm; do
- if [ -f "$file" ]; then
- filename="${file%.*}"
- "${I965_ASM}" -t hex -g ${gen} -o "${file}.out" "${file}"
- if cmp "${file}.out" "${filename}.expected" 2> /dev/null; then
- echo "${file} : PASS"
- else
- echo "Output comparison for ${file}"
- diff -u "${filename}.expected" "${file}.out"
- fi
- fi
-done