-
Notifications
You must be signed in to change notification settings - Fork 483
Improve travis build #311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve travis build #311
Changes from all commits
89990f0
229135c
a3cc3ad
9d5a471
e1a5d5a
fe4278b
abea022
7de9aaa
58b731b
fa9be2d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| #!/bin/bash | ||
| # | ||
| # This builds different stuff depending on the compiler: | ||
| # gcc - valgrind, coverage | ||
| # clang - asan, ubsan, scan-build | ||
| # both - the two testbuild's NOTEST and NOFILE | ||
|
|
||
| set -e | ||
|
|
||
| if [ "$#" = "5" -a "$(echo $3 | grep -v 'makefile[.]')" = "" ]; then | ||
| echo "only run $0 for the regular makefile, early exit success" | ||
| exit 0 | ||
| fi | ||
|
|
||
| function run_gcc() { | ||
| bash check_source.sh "CHECK_SOURCES" "$2" "$3" "$4" "$5" | ||
|
|
||
| make clean &>/dev/null | ||
|
|
||
| bash coverage.sh "COVERAGE" "$2" "$3" "$4" "$5" | ||
|
|
||
| make clean &>/dev/null | ||
|
|
||
| make CFLAGS="$2 $CFLAGS $4" EXTRALIBS="$5" test LTC_DEBUG=1 1>gcc_1.txt 2>gcc_2.txt | ||
|
|
||
| valgrind --error-exitcode=666 --leak-check=full --show-leak-kinds=all --errors-for-leak-kinds=all ./test 1>test_std.txt 2> test_err.txt | ||
|
|
||
| make clean &>/dev/null | ||
|
|
||
| make CFLAGS="-fsanitize=address -fno-omit-frame-pointer -static-libasan $2 $CFLAGS $4" EXTRALIBS="-lasan $5" test LTC_DEBUG=1 1>gcc_1.txt 2>gcc_2.txt | ||
| ASAN_OPTIONS=verbosity=1 ./test t ltm 1>test_std.txt 2> test_err.txt | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't ASAN go into
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought so too ... then I wasn't able to get the ASAN build done with clang which can be installed in xenial ... but it worked with gcc, so I thought let's give it a try... |
||
| ASAN_OPTIONS=verbosity=1 ./test t gmp 1>test_std.txt 2> test_err.txt | ||
| } | ||
|
|
||
| function run_clang() { | ||
| bash scan_build.sh "SCAN_BUILD" "$2" "$3" "$4" "$5" | ||
|
|
||
| make clean &>/dev/null | ||
|
|
||
| make LDFLAGS="-fsanitize=undefined" CFLAGS="$2 $CFLAGS $4" EXTRALIBS="$5" all LTC_DEBUG=1 1>gcc_1.txt 2>gcc_2.txt | ||
| UBSAN_OPTIONS=verbosity=1 ./test t ltm 1>test_std.txt 2> test_err.txt | ||
| UBSAN_OPTIONS=verbosity=1 ./test t gmp 1>test_std.txt 2> test_err.txt | ||
| } | ||
|
|
||
|
|
||
| make clean &>/dev/null | ||
|
|
||
| EXTRALIBS="$5 -lgmp" | ||
|
|
||
| if [ -z "$(echo $CC | grep "clang")" ]; then | ||
| run_gcc "$1" "$2" "$3" "$4" "$EXTRALIBS" | ||
| else | ||
| run_clang "$1" "$2" "$3" "$4" "$EXTRALIBS" | ||
| fi | ||
|
|
||
| make clean &>/dev/null | ||
|
|
||
| bash testbuild.sh "NOTEST" "-DLTC_NO_TEST" "$3" "$4" "$5" | ||
|
|
||
| make clean &>/dev/null | ||
|
|
||
| bash testbuild.sh "NOFILE" "-DLTC_NO_FILE" "$3" "$4" "$5" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,11 @@ | ||
| #!/bin/bash | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it worth a separate script (
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nope, I just re-used it as it mostly worked OOTB - I'm going to incorporate it. |
||
| [ "$TRAVIS_CI" != "" ] && { [ -z "$(which scan-build)" ] && { echo "installing clang"; sudo apt-get install clang -y -qq; }; } || true | ||
|
|
||
| set -e | ||
|
|
||
| if [ "$TRAVIS_CI" != "" ] && [ -z "$(echo $CC | grep "clang")" ]; then | ||
| echo "no clang detected, early exit success" | ||
| exit 0 | ||
| fi | ||
|
|
||
| if [ "$#" = "5" -a "$(echo $3 | grep -v 'makefile[.]')" = "" ]; then | ||
| echo "only run $0 for the regular makefile, early exit success" | ||
|
|
@@ -14,6 +20,4 @@ make clean > /dev/null | |
| scan_build=$(which scan-build) | ||
| [ -z "$scan_build" ] && scan_build=$(find /usr/bin/ -name 'scan-build-*' | sort -nr | head -n1) || true | ||
| [ -z "$scan_build" ] && { echo "couldn't find clang scan-build"; exit 1; } || echo "run $scan_build" | ||
| export CFLAGS="-DUSE_LTM -DLTM_DESC -I/usr/include" | ||
| export EXTRALIBS="-ltommath" | ||
| $scan_build --status-bugs make -f makefile.unix all CFLAGS="$CFLAGS" EXTRALIBS="$EXTRALIBS" | ||
| $scan_build --status-bugs make all CFLAGS="$2 $CFLAGS $4" EXTRALIBS="$5" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -277,6 +277,15 @@ typedef unsigned long ltc_mp_digit; | |
| #define LTC_HAVE_BSWAP_BUILTIN | ||
| #endif | ||
|
|
||
| #ifdef __GNUC__ | ||
| #define LTC_DEPRECATED __attribute__((deprecated)) | ||
| #elif defined(_MSC_VER) | ||
| #define LTC_DEPRECATED __declspec(deprecated) | ||
| #endif | ||
|
|
||
| #ifndef LTC_DEPRECATED | ||
| #error "You need to define LTC_DEPRECATED for this compiler" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not like this. It is very unfriendly to non-gcc/non-msvc compilers.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I hoped you're going to build this on "the other compilers" and then either fill it in or define it to nothing if the "deprecation" feature doesn't exist for "the other compilers"
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider: #ifdef __GNUC__
#define LTC_DEPRECATED __attribute__((deprecated))
#elif defined(_MSC_VER)
#define LTC_DEPRECATED __declspec(deprecated)
#else
#define LTC_DEPRECATED
#endif
It might also cause troubles on older gcc as I do not know since what version this attribute is supported.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems to be supported on gcc 3.1+
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| #endif | ||
|
|
||
| /* ref: $Format:%D$ */ | ||
| /* git commit: $Format:%H$ */ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what was needed in ecc branch (latest ltm + tfm)
https://github.com/libtom/libtomcrypt/blob/pr/ecc-asn1-part/.travis.yml#L22
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I'd like to stay on standard-built packages as long as possible as the packages that are installed in the ecc branch are built by me ;)