build; account for newlines in win32 tests
This commit is contained in:
parent
75a3572fdd
commit
9a929353d6
@ -588,8 +588,8 @@ if (TESTS)
|
||||
set_tests_properties(util_${name} PROPERTIES FAIL_REGULAR_EXPRESSION "not ok -")
|
||||
endforeach(t)
|
||||
|
||||
configure_file (test/cpp.sh.in util_test_cpp.sh @ONLY)
|
||||
add_test (NAME util_test_cpp COMMAND util_test_cpp.sh)
|
||||
configure_file (test/cpp.py.in util_test_cpp.py @ONLY)
|
||||
add_test (NAME util_test_cpp COMMAND ${PYTHON_EXECUTABLE} util_test_cpp.py)
|
||||
set_property (TEST util_test_cpp APPEND PROPERTY DEPENDS util_macro)
|
||||
set_tests_properties(util_test_cpp PROPERTIES FAIL_REGULAR_EXPRESSION "not ok -")
|
||||
endif ()
|
||||
|
33
test/cpp.py.in
Executable file
33
test/cpp.py.in
Executable file
@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from glob import glob
|
||||
import subprocess
|
||||
import os.path
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
CPP="@CMAKE_CURRENT_BINARY_DIR@/macro"
|
||||
|
||||
count=0
|
||||
ret=0
|
||||
|
||||
for src in glob(os.path.join ("@CMAKE_CURRENT_SOURCE_DIR@", "test/cpp/good/*.inc")):
|
||||
basename, extension = os.path.splitext(src)
|
||||
res = basename + ".res"
|
||||
|
||||
cpp_out = subprocess.check_output([CPP, src])
|
||||
cpp_out = cpp_out.decode()
|
||||
cpp_out = cpp_out.replace("\r", "")
|
||||
with open(res, "r") as f: res_out = f.read()
|
||||
|
||||
head = "ok"
|
||||
if cpp_out != res_out:
|
||||
head = "not ok"
|
||||
ret = 1
|
||||
|
||||
|
||||
print(f"{head} - {src}")
|
||||
count = count + 1
|
||||
|
||||
print(f"1..{count}")
|
||||
sys.exit(ret)
|
@ -1,23 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CPP="@CMAKE_CURRENT_BINARY_DIR@/macro"
|
||||
|
||||
count=0
|
||||
ret=0
|
||||
|
||||
for src in "@CMAKE_CURRENT_SOURCE_DIR@/test/cpp/good"/*.inc; do
|
||||
res="${src%.inc}.res"
|
||||
|
||||
if cmp --quiet <($CPP ${src}) <(cat ${res}); then
|
||||
head="ok"
|
||||
else
|
||||
head="not ok"
|
||||
ret=1
|
||||
fi
|
||||
|
||||
echo "${head} - ${src}"
|
||||
count=$((count+1))
|
||||
done
|
||||
|
||||
echo "1..${count}"
|
||||
exit $ret
|
Loading…
Reference in New Issue
Block a user