mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-13 19:06:19 +00:00
Automatically run all test cases.
In the past test/run-test.sh run only one test case per call. This patch let it automatically run all test cases.
This commit is contained in:
parent
1c009349bc
commit
6983eebf47
@ -77,8 +77,7 @@ EXTRA_DIST = \
|
|||||||
run-test.sh
|
run-test.sh
|
||||||
|
|
||||||
$(TESTS): run-test.sh
|
$(TESTS): run-test.sh
|
||||||
sed "s|TEST|$@|g" ${srcdir}/run-test.sh > $@
|
chmod +x ${srcdir}/run-test.sh
|
||||||
chmod +x $@
|
|
||||||
|
|
||||||
CLEANFILES = \
|
CLEANFILES = \
|
||||||
*.out \
|
*.out \
|
||||||
|
@ -1,13 +1,83 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
DIR="$( cd -P "$( dirname "$0" )" && pwd )"
|
#TODO: add new test cases in environment variables ${TEST_GEN4_XXX}
|
||||||
|
|
||||||
${DIR}/../src/intel-gen4asm -o TEST.out ${DIR}/TEST.g4a
|
DIR="$( cd -P "$( dirname "$0" )" && pwd )"
|
||||||
if cmp TEST.out ${DIR}/TEST.expected 2> /dev/null;
|
ASSEMBLER="${DIR}/../src/intel-gen4asm"
|
||||||
|
|
||||||
|
# Tests that are expected to success because they contain correct code.
|
||||||
|
# $1 is the gen level, e.g., 4 or 7
|
||||||
|
# $2 is the test case name
|
||||||
|
function check_if_work()
|
||||||
|
{
|
||||||
|
GEN_LEVEL="$1"
|
||||||
|
TEST_CASE_NAME="$2"
|
||||||
|
SOURCE="${TEST_CASE_NAME}.g${1}a"
|
||||||
|
EXPECTED="${TEST_CASE_NAME}.expected"
|
||||||
|
TEMP_OUT="temp.out"
|
||||||
|
${ASSEMBLER} -g ${GEN_LEVEL} ${DIR}/${SOURCE} -o ${TEMP_OUT}
|
||||||
|
if cmp ${TEMP_OUT} ${DIR}/${EXPECTED} 2> /dev/null;
|
||||||
then
|
then
|
||||||
echo "Good";
|
echo "[ OK ] ${TEST_CASE_NAME}";
|
||||||
else
|
else
|
||||||
echo "Output comparison for TEST"
|
echo "[FAIL] ${TEST_CASE_NAME}";
|
||||||
diff -u ${DIR}/TEST.expected TEST.out
|
diff -u ${DIR}/${EXPECTED} ${TEMP_OUT};
|
||||||
exit 1;
|
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Tests that are expected to fail because they contain wrong code.
|
||||||
|
function check_if_fail()
|
||||||
|
{
|
||||||
|
GEN_LEVEL="$1"
|
||||||
|
TEST_CASE_NAME="$2"
|
||||||
|
SOURCE="${TEST_CASE_NAME}.g${1}a"
|
||||||
|
TEMP_OUT="temp.out"
|
||||||
|
${ASSEMBLER} -g ${GEN_LEVEL} ${DIR}/${SOURCE} -o ${TEMP_OUT} 2>/dev/null
|
||||||
|
if [ $? -eq 0 ];
|
||||||
|
then
|
||||||
|
echo "[FAIL] ${TEST_CASE_NAME}";
|
||||||
|
else
|
||||||
|
echo "[ OK ] ${TEST_CASE_NAME}";
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Tests that are expected to success because they contain correct code.
|
||||||
|
TEST_GEN4_SHOULD_WORK="\
|
||||||
|
mov \
|
||||||
|
frc \
|
||||||
|
rndd \
|
||||||
|
rndu \
|
||||||
|
rnde \
|
||||||
|
rnde-intsrc \
|
||||||
|
rndz \
|
||||||
|
lzd \
|
||||||
|
not \
|
||||||
|
jmpi \
|
||||||
|
if \
|
||||||
|
iff \
|
||||||
|
while \
|
||||||
|
else \
|
||||||
|
break \
|
||||||
|
cont \
|
||||||
|
halt \
|
||||||
|
wait \
|
||||||
|
endif \
|
||||||
|
declare \
|
||||||
|
immediate \
|
||||||
|
"
|
||||||
|
|
||||||
|
# Tests that are expected to fail because they contain wrong code.
|
||||||
|
TEST_GEN4_SHOULD_FAIL="\
|
||||||
|
rnde-intsrc \
|
||||||
|
"
|
||||||
|
|
||||||
|
for T in ${TEST_GEN4_SHOULD_WORK}
|
||||||
|
do
|
||||||
|
check_if_work 4 ${T}
|
||||||
|
done
|
||||||
|
|
||||||
|
for T in ${TEST_GEN4_SHOULD_FAIL}
|
||||||
|
do
|
||||||
|
check_if_fail 4 ${T}
|
||||||
|
done
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user