From b135af43c136dc2ec79da61be9b234ce00c96775 Mon Sep 17 00:00:00 2001 From: valmat Date: Tue, 1 Apr 2014 01:04:52 +0600 Subject: Fix: run tests without compile --- Makefile | 4 ++-- tests/cpp/Makefile | 2 +- tests/cpp/zts/.gitignore | 1 - tests/include/.gitignore | 2 ++ tests/include/zts/.gitignore | 1 + tests/test.sh | 23 +++++++++++++++++++++-- 6 files changed, 27 insertions(+), 6 deletions(-) delete mode 100644 tests/cpp/zts/.gitignore create mode 100644 tests/include/.gitignore create mode 100644 tests/include/zts/.gitignore diff --git a/Makefile b/Makefile index 497beb8..ce4c59e 100644 --- a/Makefile +++ b/Makefile @@ -171,7 +171,7 @@ install: ${CONFIG_UTILITY} > ${INSTALL_HEADERS}/phpcpp/config.h test: - mkdir -p ./tests/cpp/zts/phpcpp - ${CONFIG_UTILITY} > ./tests/cpp/zts/phpcpp/config.h + mkdir -p ./tests/include/zts/phpcpp + ${CONFIG_UTILITY} > ./tests/include/zts/phpcpp/config.h cd tests && ./test.sh -p "${PHP_BIN}" diff --git a/tests/cpp/Makefile b/tests/cpp/Makefile index 6239170..90b3946 100644 --- a/tests/cpp/Makefile +++ b/tests/cpp/Makefile @@ -88,7 +88,7 @@ LINKER = g++ # LIB_DIR=$(shell cd ../.. && pwd) -COMPILER_FLAGS = -Wall -c -O2 -std=c++11 -fpic -I"${LIB_DIR}/include" -I"./zts" -o +COMPILER_FLAGS = -Wall -c -O2 -std=c++11 -fpic -I"${LIB_DIR}/tests/include/lib" -I"${LIB_DIR}/tests/include/zts" -o LINKER_FLAGS = -shared -L"${LIB_DIR}" LINKER_DEPENDENCIES = -lphpcpp diff --git a/tests/cpp/zts/.gitignore b/tests/cpp/zts/.gitignore deleted file mode 100644 index 8d82a92..0000000 --- a/tests/cpp/zts/.gitignore +++ /dev/null @@ -1 +0,0 @@ -phpcpp/config.h diff --git a/tests/include/.gitignore b/tests/include/.gitignore new file mode 100644 index 0000000..492755a --- /dev/null +++ b/tests/include/.gitignore @@ -0,0 +1,2 @@ +*.h +/lib/* diff --git a/tests/include/zts/.gitignore b/tests/include/zts/.gitignore new file mode 100644 index 0000000..8d82a92 --- /dev/null +++ b/tests/include/zts/.gitignore @@ -0,0 +1 @@ +phpcpp/config.h diff --git a/tests/test.sh b/tests/test.sh index 8f5baa5..9c264a9 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -145,16 +145,35 @@ SCR_OPT="$SCR_OPT -d extension_dir=$PWD/ext_dir -d extension=$EXT_NAME" # Create a local copy of the directory with the extension for run without installation ./prepare.sh $EXT_NAME +# Absolute path to library +LIBRARY_PATH="$(cd $PWD/.. && echo $PWD)" if [ 1 = $COMPILE_EXT ]; then + + # Create a local copy of header files + PHPCPP_H="$LIBRARY_PATH/tests/include/lib/phpcpp.h" + PHPCPP_INC="$LIBRARY_PATH/tests/include/lib/phpcpp" + mkdir -p "$LIBRARY_PATH/tests/include/lib" + # local copy of /usr/include/phpcpp.h: + if [ ! -L $PHPCPP_H ]; + then + ln -s "$LIBRARY_PATH/phpcpp.h" $PHPCPP_H + fi + # local copy of /usr/include/phpcpp: + #if [ -L $PHPCPP_INC ] || [ -d $PHPCPP_INC ]; + if [ -a $PHPCPP_INC ]; + then + rm -rf $PHPCPP_INC + fi + ln -s "$LIBRARY_PATH/include" $PHPCPP_INC + echo "Compile the test extension" cd cpp make clean && make cd .. fi - -LD_LIBRARY_PATH="$(cd $PWD/.. && echo $PWD):${LD_LIBRARY_PATH}" +LD_LIBRARY_PATH="${LIBRARY_PATH}:${LD_LIBRARY_PATH}" export LD_LIBRARY_PATH echo $LD_LIBRARY_PATH -- cgit v1.2.3 From de42543170dd911d878387db5efd2c9c4b399047 Mon Sep 17 00:00:00 2001 From: valmat Date: Tue, 1 Apr 2014 01:25:01 +0600 Subject: Changed the way to use the option -t in ./test.sh Now you can specify several options -t, listing the files one by one: ./test.sh -t "file1.phpt" -t "file2.phpt" The old way (./test.sh -t "file1.phpt file2.phpt") is still working --- tests/test.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/test.sh b/tests/test.sh index 9c264a9..df0e949 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -102,7 +102,7 @@ do exit; ;; t) - TEST_FILES="$OPTARG" + TEST_FILES="${TEST_FILES}${OPTARG} " ;; x) SCR_OPT="$SCR_OPT -x" @@ -160,7 +160,6 @@ if [ 1 = $COMPILE_EXT ]; then ln -s "$LIBRARY_PATH/phpcpp.h" $PHPCPP_H fi # local copy of /usr/include/phpcpp: - #if [ -L $PHPCPP_INC ] || [ -d $PHPCPP_INC ]; if [ -a $PHPCPP_INC ]; then rm -rf $PHPCPP_INC -- cgit v1.2.3