diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 76ba0abc5cce61359f1fa0b828cdc3804dc5bf6a..d0f4175a51ff8632f4f153846d996fe3d75bf038 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -47,7 +47,7 @@ build-gcc: build-clang: <<: *build -build-cmake: +build-cmake-clang: variables: EXTRA_PKGS: cmake python3 py3-click script: @@ -58,6 +58,19 @@ build-cmake: - cd release - cmake -DCMAKE_BUILD_TYPE=Release .. - make + - mkdir bin + - cd bin + - find .. -type f \( -perm -u=x -o -perm -g=x -o -perm -o=x \) -exec test -x {} \; -print | grep -v 'CMakeFiles' | while read line; do ln -s $line $(basename $line); done + - cp ../../translateAddresses . + - cp ../../xmlFormat . + artifacts: + paths: + - release/bin + - "release/*/a*2" #select binaries + - release/tniceprint/tniceprint #explicit binary + - "release/*/lib*.so" #select libraries + - "release/*/test-alib2*" #select libraries test + expire_in: 1 day stage: build build-doc: @@ -100,3 +113,13 @@ test-clang: <<: *test dependencies: - build-clang + +test-cmake-clang: + variables: + # coreutils are needed because of timeout command used in tests. + EXTRA_PKGS: bc coreutils python3 + script: + - for test in $(ls tests.*.sh); do ./${test} release/bin ${JOBS}; touch release/bin/log_tests.txt; cat release/bin/log_tests.txt; done + stage: test + dependencies: + - build-cmake-clang diff --git a/CMake/CMakeLists_library.txt b/CMake/CMakeLists_library.txt index 702d7469d7c8419ea1352177ed04da26a44df858..f9991016f1b74b5175042f850b165f1064ea2aae 100644 --- a/CMake/CMakeLists_library.txt +++ b/CMake/CMakeLists_library.txt @@ -26,7 +26,7 @@ set_target_properties(${{PROJECT_NAME}} PROPERTIES ) # Install -install(TARGETS ${{PROJECT_NAME}} LIBRARY DESTINATION bin) +install(TARGETS ${{PROJECT_NAME}} LIBRARY DESTINATION lib) ######################################################################################################################## # cppunit tests diff --git a/CMake/CMakeLists_root.txt b/CMake/CMakeLists_root.txt index 14990f191ef49edbee55c0b2e08c6db4e643ba42..2a35d6d294d8ab1081c825b4eae4b27863890129 100644 --- a/CMake/CMakeLists_root.txt +++ b/CMake/CMakeLists_root.txt @@ -43,7 +43,7 @@ endif () # Flags according to Debug/Release decision # - CMake uses -g on Debug implicitly # - fPIC for libraries will be enabled explicitly -set(ALIB_BUILD_FLAGS_COMMON -Wall -pedantic -pipe -Wextra -Werror) +set(ALIB_BUILD_FLAGS_COMMON -Wall -pedantic -pipe -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls) set(ALIB_BUILD_FLAGS_DEBUG ${{ALIB_BUILD_FLAGS_COMMON}} -Og) set(ALIB_BUILD_FLAGS_RELEASE ${{ALIB_BUILD_FLAGS_COMMON}} -O3) diff --git a/all-cmake-debug.sh b/all-cmake-debug.sh new file mode 100755 index 0000000000000000000000000000000000000000..bc4671cc547e24371a75e2a5d4b81c81ff3db179 --- /dev/null +++ b/all-cmake-debug.sh @@ -0,0 +1,38 @@ +THREADS=${1:-5} +DIRECTORY=$(pwd) + +cd CMake +./alib_cmake.py -w -m +cd .. + +if [ ! -d debug ]; then + mkdir debug +fi + +if [ -L debug ]; then + cd $(readlink debug) + cmake ${DIRECTORY} + cd ${DIRECTORY}/debug +else + cd debug + cmake .. +fi + +CXX=clang++ make -j${THREADS} || exit 1 + +if [ ! -d bin ]; then + mkdir bin +fi + +rm bin/* +cd bin +find .. -executable -type f | grep -v 'CMakeFiles' | while read line; do ln -s $line $(basename $line); done + +cp ${DIRECTORY}/translateAddresses . +cp ${DIRECTORY}/xmlFormat . + +cd ${DIRECTORY} + +for test in $(ls tests.*.sh); do \ + ./${test} debug/bin ${THREADS}; \ +done diff --git a/all-cmake-release.sh b/all-cmake-release.sh new file mode 100755 index 0000000000000000000000000000000000000000..3ad0b454899fef858256459d5d8ab88ebd314895 --- /dev/null +++ b/all-cmake-release.sh @@ -0,0 +1,38 @@ +THREADS=${1:-5} +DIRECTORY=$(pwd) + +cd CMake +./alib_cmake.py -w -m +cd .. + +if [ ! -d release ]; then + mkdir release +fi + +if [ -L release ]; then + cd $(readlink release) + cmake -DCMAKE_BUILD_TYPE=Release ${DIRECTORY} + cd ${DIRECTORY}/release +else + cd release + cmake -DCMAKE_BUILD_TYPE=Release .. +fi + +CXX=clang++ make -j${THREADS} || exit 1 + +if [ ! -d bin ]; then + mkdir bin +fi + +rm bin/* +cd bin +find .. -executable -type f | grep -v 'CMakeFiles' | while read line; do ln -s $line $(basename $line); done + +cp ${DIRECTORY}/translateAddresses . +cp ${DIRECTORY}/xmlFormat . + +cd ${DIRECTORY} + +for test in $(ls tests.*.sh); do \ + ./${test} release/bin ${THREADS}; \ +done diff --git a/cmake-debug.sh b/cmake-debug.sh deleted file mode 100755 index 56cd0b8365114b4b15066ac8c8e5c61054f00ae8..0000000000000000000000000000000000000000 --- a/cmake-debug.sh +++ /dev/null @@ -1,21 +0,0 @@ -THREADS=${1:-5} -cd CMake -./alib_cmake.py -w -m -cd .. - -if [ ! -d debug ]; then - mkdir debug -fi - -if [ -L debug ]; then - DIRECTORY=$(pwd) - cd $(readlink debug) - cmake ${DIRECTORY} - cd ${DIRECTORY} - cd debug -else - cd debug - cmake .. -fi - -CXX=clang++ make -j${THREADS} diff --git a/makefile b/makefile index fad496193f8ab6e5b786a52f2f4751ab95543cff..10b4f0add14c3275724ebdd36935e48d6a5b51b4 100644 --- a/makefile +++ b/makefile @@ -139,12 +139,12 @@ build-code-debug build-code-release: test-debug: for test in $(wildcard tests.*.sh); do \ - ./$$test debug $(JOBS); \ + ./$$test bin-debug $(JOBS); \ done test-release: for test in $(wildcard tests.*.sh); do \ - ./$$test release $(JOBS); \ + ./$$test bin-release $(JOBS); \ done install-debug: diff --git a/tests.aarbology.sh b/tests.aarbology.sh index e1e4f30d83151f414407912d412a2878a926e258..1a6387563c74d3dd245f725740d8762c02a7be68 100755 --- a/tests.aarbology.sh +++ b/tests.aarbology.sh @@ -29,13 +29,13 @@ MATCHES= # ---------------------------- for FILE in $EXECUTABLES; do - if [ ! -f bin-$1/$FILE ]; then - echo "Executable $FILE is required for testing. Make sure it is in bin-$1 folder." + if [ ! -f $1/$FILE ]; then + echo "Executable $FILE is required for testing. Make sure it is in $1 folder." exit 1 fi done -cd bin-$1/ +cd $1/ rm -f $LOGFILE JOBS=$2 diff --git a/tests.aconversion.sh b/tests.aconversion.sh index 33c70b1c96200cb936281a2bfec0a309af2f8aa1..29a722962f90d96ba206a066199e998caaf822ff 100755 --- a/tests.aconversion.sh +++ b/tests.aconversion.sh @@ -26,13 +26,13 @@ RES_UNKN= # ---------------------------- for FILE in $EXECUTABLES; do - if [ ! -f bin-$1/$FILE ]; then - echo "Executable $FILE is required for testing. Make sure it is in bin-$1 folder." + if [ ! -f $1/$FILE ]; then + echo "Executable $FILE is required for testing. Make sure it is in $1 folder." exit 1 fi done -cd bin-$1/ +cd $1/ rm -f $LOGFILE JOBS=$2 diff --git a/tests.aconvert.sh b/tests.aconvert.sh index 073d824dcd5b39d49b1aafbabafa4e8b464ab3ce..704b4ae99a6593a1ce0ae0b0b275dc0d29c5de78 100755 --- a/tests.aconvert.sh +++ b/tests.aconvert.sh @@ -19,13 +19,13 @@ RES_UNKN= # ---------------------------- for FILE in $EXECUTABLES; do - if [ ! -f bin-$1/$FILE ]; then - echo "Executable $FILE is required for testing. Make sure it is in bin-$1 folder." + if [ ! -f $1/$FILE ]; then + echo "Executable $FILE is required for testing. Make sure it is in $1 folder." exit 1 fi done -cd bin-$1/ +cd $1/ rm -f $LOGFILE # ---------------------------- diff --git a/tests.aderivation.aintegral.sh b/tests.aderivation.aintegral.sh index 527d11f22116cfc0b25c016cf9bf05f3ba518aa9..190e4b8c55c8f476a185168a4c855c130a92c4d9 100755 --- a/tests.aderivation.aintegral.sh +++ b/tests.aderivation.aintegral.sh @@ -10,13 +10,13 @@ TESTS_DIR="`pwd`/examples2/regexp" # ---------------------------- for FILE in $EXECUTABLES; do - if [ ! -f bin-$1/$FILE ]; then - echo "Executable $FILE is required for testing. Make sure it is in bin-$1 folder." + if [ ! -f $1/$FILE ]; then + echo "Executable $FILE is required for testing. Make sure it is in $1 folder." exit 1 fi done -cd bin-$1/ +cd $1/ # ---------------------------- diff --git a/tests.adeterminize.sh b/tests.adeterminize.sh index 99e448f6aa70da3394f89f205b5975d9c0bb37ca..24542df3aa8eb23a047b67b4b7bdbdc4d3487578 100755 --- a/tests.adeterminize.sh +++ b/tests.adeterminize.sh @@ -19,13 +19,13 @@ RES_UNKN= # ---------------------------- for FILE in $EXECUTABLES; do - if [ ! -f bin-$1/$FILE ]; then - echo "Executable $FILE is required for testing. Make sure it is in bin-$1 folder." + if [ ! -f $1/$FILE ]; then + echo "Executable $FILE is required for testing. Make sure it is in $1 folder." exit 1 fi done -cd bin-$1/ +cd $1/ rm -f $LOGFILE # ---------------------------- diff --git a/tests.anormalize.sh b/tests.anormalize.sh index 3025346028fadf303cc8af991108ec3471abbfeb..2a5a50ae731999b035add3b20d413ad707f67df5 100755 --- a/tests.anormalize.sh +++ b/tests.anormalize.sh @@ -27,13 +27,13 @@ RES_UNKN= # ---------------------------- for FILE in $EXECUTABLES; do - if [ ! -f bin-$1/$FILE ]; then - echo "Executable $FILE is required for testing. Make sure it is in bin-$1 folder." + if [ ! -f $1/$FILE ]; then + echo "Executable $FILE is required for testing. Make sure it is in $1 folder." exit 1 fi done -cd bin-$1/ +cd $1/ rm -f $LOGFILE JOBS=$2 diff --git a/tests.astringology.sh b/tests.astringology.sh index 07339f02d72cee817cdee6155f107bbef4089a50..741826059a558704de67223eb02e475a2383d802 100755 --- a/tests.astringology.sh +++ b/tests.astringology.sh @@ -27,13 +27,13 @@ MATCHES= # ---------------------------- for FILE in $EXECUTABLES; do - if [ ! -f bin-$1/$FILE ]; then - echo "Executable $FILE is required for testing. Make sure it is in bin-$1 folder." + if [ ! -f $1/$FILE ]; then + echo "Executable $FILE is required for testing. Make sure it is in $1 folder." exit 1 fi done -cd bin-$1/ +cd $1/ rm -f $LOGFILE JOBS=$2 diff --git a/tests.examples.sh b/tests.examples.sh index d8942b1aa120f66f2a1413010148b0bbf08489bd..f2cd6629008be3aa3556f9b6f8a7759da5008f4a 100755 --- a/tests.examples.sh +++ b/tests.examples.sh @@ -19,13 +19,13 @@ RES_UNKN= # ---------------------------- for FILE in $EXECUTABLES; do - if [ ! -f bin-$1/$FILE ]; then - echo "Executable $FILE is required for testing. Make sure it is in bin-$1 folder." + if [ ! -f $1/$FILE ]; then + echo "Executable $FILE is required for testing. Make sure it is in $1 folder." exit 1 fi done -cd bin-$1/ +cd $1/ rm -f $LOGFILE # ---------------------------- diff --git a/tests.glushkovrte.sh b/tests.glushkovrte.sh index 33bfcc347338a3d35fe0733f1251fec5ffd032ac..4f96da7eb7d5d4cbf0322f8e68bd42b0f691065b 100755 --- a/tests.glushkovrte.sh +++ b/tests.glushkovrte.sh @@ -20,13 +20,13 @@ RES_UNKN= # ---------------------------- for FILE in $EXECUTABLES; do - if [ ! -f bin-$1/$FILE ]; then - echo "Executable $FILE is required for testing. Make sure it is in bin-$1 folder." + if [ ! -f $1/$FILE ]; then + echo "Executable $FILE is required for testing. Make sure it is in $1 folder." exit 1 fi done -cd bin-$1/ +cd $1/ rm -f $LOGFILE JOBS=$2 diff --git a/tests.glushkovrte_naive.sh b/tests.glushkovrte_naive.sh index 3689c7fe0b0b73a3fc68184c942e47141d2e2919..0ac39209767a2e0d21668cae817c0eff446bf88a 100755 --- a/tests.glushkovrte_naive.sh +++ b/tests.glushkovrte_naive.sh @@ -20,13 +20,13 @@ RES_UNKN= # ---------------------------- for FILE in $EXECUTABLES; do - if [ ! -f bin-$1/$FILE ]; then - echo "Executable $FILE is required for testing. Make sure it is in bin-$1 folder." + if [ ! -f $1/$FILE ]; then + echo "Executable $FILE is required for testing. Make sure it is in $1 folder." exit 1 fi done -cd bin-$1/ +cd $1/ rm -f $LOGFILE JOBS=$2 diff --git a/tests.repeats.sh b/tests.repeats.sh index 7dc0ac391b902ea29fee05f5c1b5964141bbd6e4..2702a42a56dd2ed52ebe64f6c0f7c2617354bffb 100755 --- a/tests.repeats.sh +++ b/tests.repeats.sh @@ -15,7 +15,7 @@ NODES=100 HEIGHT=15 ALPHABET_SIZE=10 -EXECUTABLES="aarbology2 acast2 atniceprint arand2 " +EXECUTABLES="aarbology2 acast2 tniceprint arand2 " TESTS_DIR="`pwd`/examples2/tree" RES_GOOD= @@ -28,13 +28,13 @@ RES_UNKN= # ---------------------------- for FILE in $EXECUTABLES; do - if [ ! -f bin-$1/$FILE ]; then - echo "Executable $FILE is required for testing. Make sure it is in bin-$1 folder." + if [ ! -f $1/$FILE ]; then + echo "Executable $FILE is required for testing. Make sure it is in $1 folder." exit 1 fi done -cd bin-$1/ +cd $1/ rm -f $LOGFILE JOBS=$2 @@ -60,8 +60,8 @@ function log { TWO=$(mktemp) echo "Naive : " >> $ONE echo "Yours : " >> $TWO - cat $5 | ./atniceprint >> $ONE - cat $6 | ./atniceprint >> $TWO + cat $5 | ./tniceprint >> $ONE + cat $6 | ./tniceprint >> $TWO paste $ONE $TWO | pr -t -e$(awk 'n<length {n=length} END {print n+1}' $ONE) >> $LOGFILE rm $ONE $TWO } @@ -92,8 +92,8 @@ function runPostfix2RankedAlgorithmTest { RANKED2POSTFIX2RANKED=$(mktemp) RANKED=$(mktemp) - ./acast2 -t RankedTree -i $1 | ./atniceprint > $RANKED - ./acast2 -t RankedTree -i $1 | ./acast2 -t PostfixRankedTree | ./acast2 -t RankedTree | ./atniceprint > $RANKED2POSTFIX2RANKED + ./acast2 -t RankedTree -i $1 | ./tniceprint > $RANKED + ./acast2 -t RankedTree -i $1 | ./acast2 -t PostfixRankedTree | ./acast2 -t RankedTree | ./tniceprint > $RANKED2POSTFIX2RANKED OUT=`timeout $TESTCASE_TIMEOUT bash -c "diff $RANKED $RANKED2POSTFIX2RANKED"` RET=$? diff --git a/tniceprint/makefile.conf b/tniceprint/makefile.conf index 2ccf83f65316b0c86875a1c35f7bb9cc057f29d2..f3454f9d0805cad6d7085e9c702b2edb85922f95 100644 --- a/tniceprint/makefile.conf +++ b/tniceprint/makefile.conf @@ -1,4 +1,4 @@ -EXECUTABLE:=atniceprint +EXECUTABLE:=tniceprint LINK_LIBRARIES=alib2cli alib2elgo alib2algo alib2str alib2data alib2xml alib2common alib2abstraction alib2measure alib2std SYSTEM_LIBRARIES=xml2 SYSTEM_INCLUDE_PATHS=/usr/include/libxml2