Skip to content

Commit

Permalink
Add option to use system cram for tests
Browse files Browse the repository at this point in the history
If you already have cram installed, and you prefer to use the
system-installed copy instead of the copy we've embedded, you can now do
so by setting the `CRAM_EXECUTABLE` variable.  Its value should be the
full path to the system-installed cram executable, which is typically
/usr/bin/cram.
  • Loading branch information
dcreager committed May 11, 2018
1 parent 8876066 commit b426f4f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
5 changes: 5 additions & 0 deletions tests/CMakeLists.txt
Expand Up @@ -98,6 +98,10 @@ make_u128_suite(sub)
#-----------------------------------------------------------------------
# Command-line tests

if (NOT CRAM_EXECUTABLE)
set(CRAM_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}/cram.py")
endif (NOT CRAM_EXECUTABLE)

if (PYTHON_EXECUTABLE)
configure_file(ccram ${CMAKE_BINARY_DIR}/ccram COPYONLY)
file(GLOB_RECURSE TESTS "${CMAKE_CURRENT_SOURCE_DIR}/*.t")
Expand All @@ -109,6 +113,7 @@ if (PYTHON_EXECUTABLE)
${CMAKE_BINARY_DIR}/ccram
--python ${PYTHON_EXECUTABLE}
--root ${CMAKE_SOURCE_DIR}
--cram ${CRAM_EXECUTABLE}
--tests ${TEST}
)
endforeach(TEST)
Expand Down
13 changes: 11 additions & 2 deletions tests/ccram
@@ -1,5 +1,7 @@
#!/bin/sh

set -e

if [ "$1" = "--python" ]; then
shift
PYTHON="$1"
Expand All @@ -16,6 +18,14 @@ else
ROOT=$(dirname $PWD)
fi

if [ "$1" = "--cram" ]; then
shift
CRAM="$1"
shift
else
CRAM="$ROOT/tests/cram.py"
fi

if [ "$1" = "--tests" ]; then
shift
TESTS="$1"
Expand All @@ -27,5 +37,4 @@ fi
export ROOT

LD_LIBRARY_PATH="$PWD/src:$LD_LIBRARY_PATH" \
PATH="$PWD/src:$PATH" \
"$PYTHON" "$ROOT/tests/cram.py" "$@" "$TESTS"
PATH="$PWD/src:$PATH" exec "$PYTHON" "$CRAM" "$@" "$TESTS"

0 comments on commit b426f4f

Please sign in to comment.