diff options
author | chrysn <chrysn@fsfe.org> | 2013-06-28 08:50:48 (GMT) |
---|---|---|
committer | chrysn <chrysn@fsfe.org> | 2013-06-28 08:50:48 (GMT) |
commit | 28e420d8712a73e66db328cdb80a8b09f6f9a0b4 (patch) | |
tree | 0945dd904b915407f46be6b53d99ec6561566af2 /tests | |
parent | ad1a11a28edd85354c3ef5386961d5cee6a19185 (diff) |
replace echotest and dumptest with python scripts
this solves problems of sed compatibility on different platoforms.
also, the openscad binary to use is now passed in from the ctest script.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CMakeLists.txt | 4 | ||||
-rwxr-xr-x | tests/dumptest | 13 | ||||
-rwxr-xr-x | tests/echotest | 10 |
3 files changed, 18 insertions, 9 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0282622..5a44b8a 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -876,8 +876,8 @@ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake ${TMP}) # Add tests -add_cmdline_test(echotest SUFFIX txt FILES ${ECHO_FILES}) -add_cmdline_test(dumptest SUFFIX csg FILES ${DUMPTEST_FILES}) +add_cmdline_test(echotest SUFFIX txt ARGS ${GUI_BINPATH} FILES ${ECHO_FILES}) +add_cmdline_test(dumptest SUFFIX csg ARGS ${GUI_BINPATH} FILES ${DUMPTEST_FILES}) add_cmdline_test(moduledumptest EXE ${GUI_BINPATH} ARGS -o SUFFIX ast FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/allmodules.scad ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/allfunctions.scad diff --git a/tests/dumptest b/tests/dumptest index 0c60099..f9247c7 100755 --- a/tests/dumptest +++ b/tests/dumptest @@ -1,7 +1,12 @@ -#!/bin/sh +#!/usr/bin/env python -openscad $1 -o $2 +import re, sys, subprocess -sed 's/, timestamp = [0-9]*//' -i $2 +subprocess.check_call([sys.argv[2], sys.argv[1], '-o', sys.argv[3]]) -sed 's/-\?[0-9].[0-9]*e-[0-9]\{2,\}/0/g' -i $2 +result = open(sys.argv[3]).read() + +result = re.sub(r', timestamp = [0-9]*', '', result) +result = re.sub(r'-?[0-9].[0-9]*e-[0-9]{2,}', '0', result) + +open(sys.argv[3], 'w').write(result) diff --git a/tests/echotest b/tests/echotest index 9e29878..bad382c 100755 --- a/tests/echotest +++ b/tests/echotest @@ -1,5 +1,9 @@ -#!/bin/sh +#!/usr/bin/env python -openscad $1 -o null 2> $2 +import re, sys, subprocess -sed 's/-\?[0-9].[0-9]*e-[0-9]\{2,\}/0/g' -i $2 +result = subprocess.check_output([sys.argv[2], sys.argv[1], '-o', 'null'], stderr=subprocess.STDOUT) + +result = re.sub(r'-?[0-9].[0-9]*e-[0-9]{2,}', '0', result) + +open(sys.argv[3], 'w').write(result) |