script.sh 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. #!/bin/bash
  2. #***************************************************************************
  3. # _ _ ____ _
  4. # Project ___| | | | _ \| |
  5. # / __| | | | |_) | |
  6. # | (__| |_| | _ <| |___
  7. # \___|\___/|_| \_\_____|
  8. #
  9. # Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
  10. #
  11. # This software is licensed as described in the file COPYING, which
  12. # you should have received as part of this distribution. The terms
  13. # are also available at https://curl.haxx.se/docs/copyright.html.
  14. #
  15. # You may opt to use, copy, modify, merge, publish, distribute and/or sell
  16. # copies of the Software, and permit persons to whom the Software is
  17. # furnished to do so, under the terms of the COPYING file.
  18. #
  19. # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  20. # KIND, either express or implied.
  21. #
  22. ###########################################################################
  23. set -eo pipefail
  24. ./buildconf
  25. if [ "$T" = "coverage" ]; then
  26. ./configure --enable-debug --disable-shared --disable-threaded-resolver --enable-code-coverage --enable-werror --enable-alt-svc --with-libssh2
  27. make
  28. make TFLAGS=-n test-nonflaky
  29. make "TFLAGS=-n -e" test-nonflaky
  30. tests="1 200 300 500 700 800 900 1000 1100 1200 1302 1400 1502 3000"
  31. make "TFLAGS=-n -t $tests" test-nonflaky
  32. coveralls --gcov /usr/bin/gcov-8 --gcov-options '\-lp' -i src -e lib -e tests -e docs -b $PWD/src
  33. coveralls --gcov /usr/bin/gcov-8 --gcov-options '\-lp' -e src -i lib -e tests -e docs -b $PWD/lib
  34. fi
  35. if [ "$T" = "torture" ]; then
  36. ./configure --enable-debug --disable-shared --disable-threaded-resolver --enable-code-coverage --enable-werror --enable-alt-svc --with-libssh2
  37. make
  38. make TFLAGS=-n test-nonflaky
  39. make "TFLAGS=-n -e" test-nonflaky
  40. tests="1 200 300 500 700 800 900 1000 1100 1200 1302 1400 1502 3000"
  41. make "TFLAGS=-n --shallow=40 -t $tests" test-nonflaky
  42. fi
  43. if [ "$T" = "debug" ]; then
  44. ./configure --enable-debug --enable-werror $C
  45. make
  46. make examples
  47. if [ -z $NOTESTS ]; then
  48. make TFLAGS=-n test-nonflaky
  49. fi
  50. fi
  51. if [ "$T" = "debug-wolfssl" ]; then
  52. ./configure --enable-debug --enable-werror $C
  53. make
  54. make "TFLAGS=-n !313" test-nonflaky
  55. fi
  56. if [ "$T" = "debug-mesalink" ]; then
  57. ./configure --enable-debug --enable-werror $C
  58. make
  59. make "TFLAGS=-n !313 !3001" test-nonflaky
  60. fi
  61. if [ "$T" = "novalgrind" ]; then
  62. ./configure --enable-werror $C
  63. make
  64. make examples
  65. make TFLAGS=-n test-nonflaky
  66. fi
  67. if [ "$T" = "normal" ]; then
  68. if [ $TRAVIS_OS_NAME = linux ]; then
  69. # Remove system curl to make sure we don't rely on it.
  70. # Only done on Linux since we're not permitted to on mac.
  71. sudo rm -f /usr/bin/curl
  72. fi
  73. ./configure --enable-warnings --enable-werror $C
  74. make
  75. make examples
  76. if [ -z $NOTESTS ]; then
  77. make test-nonflaky
  78. fi
  79. if [ -n $CHECKSRC ]; then
  80. echo "enable COPYRIGHTYEAR" > ./docs/examples/.checksrc
  81. echo "enable COPYRIGHTYEAR" > ./include/curl/.checksrc
  82. make checksrc
  83. fi
  84. fi
  85. if [ "$T" = "tidy" ]; then
  86. ./configure --enable-warnings --enable-werror $C
  87. make
  88. make tidy
  89. fi
  90. if [ "$T" = "iconv" ]; then
  91. source scripts/travis/iconv-env.sh
  92. ./configure --enable-debug --enable-werror $C
  93. make
  94. make examples
  95. make test-nonflaky
  96. fi
  97. if [ "$T" = "cmake" ]; then
  98. cmake -H. -Bbuild -DCURL_WERROR=ON $C
  99. cmake --build build
  100. fi
  101. if [ "$T" = "distcheck" ]; then
  102. # find BOM markers and exit if we do
  103. ! git grep `printf '\xef\xbb\xbf'`
  104. ./configure
  105. make
  106. ./maketgz 99.98.97
  107. # verify in-tree build - and install it
  108. tar xf curl-99.98.97.tar.gz
  109. cd curl-99.98.97
  110. ./configure --prefix=$HOME/temp
  111. make
  112. make TFLAGS=1 test
  113. make install
  114. # basic check of the installed files
  115. cd ..
  116. bash scripts/installcheck.sh $HOME/temp
  117. rm -rf curl-99.98.97
  118. # verify out-of-tree build
  119. tar xf curl-99.98.97.tar.gz
  120. touch curl-99.98.97/docs/{cmdline-opts,libcurl}/Makefile.inc
  121. mkdir build
  122. cd build
  123. ../curl-99.98.97/configure
  124. make
  125. make TFLAGS='-p 1 1139' test
  126. # verify cmake build
  127. cd ..
  128. rm -rf curl-99.98.97
  129. tar xf curl-99.98.97.tar.gz
  130. cd curl-99.98.97
  131. mkdir build
  132. cd build
  133. cmake ..
  134. make
  135. cd ../..
  136. fi
  137. if [ "$T" = "fuzzer" ]; then
  138. # Download the fuzzer to a temporary folder
  139. ./tests/fuzz/download_fuzzer.sh /tmp/curl_fuzzer
  140. export CURLSRC=$PWD
  141. # Run the mainline fuzzer test
  142. pushd /tmp/curl_fuzzer
  143. ./mainline.sh ${CURLSRC}
  144. popd
  145. fi
  146. if [ "$T" = "scan-build" ]; then
  147. scan-build ./configure --enable-debug --enable-werror $C
  148. scan-build --status-bugs make
  149. scan-build --status-bugs make examples
  150. fi