capnproto

FORK: Cap'n Proto serialization/RPC system - core tools and C++ library
git clone https://git.neptards.moe/neptards/capnproto.git
Log | Files | Refs | README | LICENSE

super-test.sh (21981B)


      1 #! /usr/bin/env bash
      2 
      3 set -euo pipefail
      4 
      5 doit() {
      6   echo "@@@@ $@"
      7   "$@"
      8 }
      9 
     10 function test_samples() {
     11   echo "@@@@ ./addressbook (in various configurations)"
     12   ./addressbook write | ./addressbook read
     13   ./addressbook dwrite | ./addressbook dread
     14   rm -f /tmp/capnp-calculator-example-$$
     15   ./calculator-server unix:/tmp/capnp-calculator-example-$$ &
     16   local SERVER_PID=$!
     17   sleep 1
     18   ./calculator-client unix:/tmp/capnp-calculator-example-$$
     19   # `kill %./calculator-server` doesn't seem to work on recent Cygwins, but we can kill by PID.
     20   kill -9 $SERVER_PID
     21   # This `fg` will fail if bash happens to have already noticed the quit and reaped the process
     22   # before `fg` is invoked, so in that case we just proceed.
     23   fg %./calculator-server || true
     24   rm -f /tmp/capnp-calculator-example-$$
     25 }
     26 
     27 QUICK=
     28 CPP_FEATURES=
     29 EXTRA_LIBS=
     30 
     31 PARALLEL=$(nproc 2>/dev/null || echo 1)
     32 
     33 # Have automake dump test failure to stdout. Important for CI.
     34 export VERBOSE=true
     35 
     36 while [ $# -gt 0 ]; do
     37   case "$1" in
     38     -j* )
     39       PARALLEL=${1#-j}
     40       ;;
     41     test )
     42       ;;  # nothing
     43     quick )
     44       QUICK=quick
     45       ;;
     46     cpp-features )
     47       if [ "$#" -lt 2 ] || [ -n "$CPP_FEATURES" ]; then
     48         echo "usage: $0 cpp-features CPP_DEFINES" >&2
     49         echo "e.g. $0 cpp-features '-DSOME_VAR=5 -DSOME_OTHER_VAR=6'" >&2
     50         if [ -n "$CPP_FEATURES" ]; then
     51           echo "cpp-features provided multiple times" >&2
     52         fi
     53         exit 1
     54       fi
     55       CPP_FEATURES="$2"
     56       shift
     57       ;;
     58     extra-libs )
     59       if [ "$#" -lt 2 ] || [ -n "$EXTRA_LIBS" ]; then
     60         echo "usage: $0 extra-libs EXTRA_LIBS" >&2
     61         echo "e.g. $0 extra-libs '-lrt'" >&2
     62         if [ -n "$EXTRA_LIBS" ]; then
     63           echo "extra-libs provided multiple times" >&2
     64         fi
     65         exit 1
     66       fi
     67       EXTRA_LIBS="$2"
     68       shift
     69       ;;
     70     caffeinate )
     71       # Re-run preventing sleep.
     72       shift
     73       exec caffeinate -ims $0 $@
     74       ;;
     75     tmpdir )
     76       # Clone to a temp directory.
     77       if [ "$#" -lt 2 ]; then
     78         echo "usage: $0 tmpdir NAME [COMMAND]" >&2
     79         exit 1
     80       fi
     81       DIR=/tmp/$2
     82       shift 2
     83       if [ -e $DIR ]; then
     84         if [ "${DIR/*..*}" = "" ]; then
     85           echo "NO DO NOT PUT .. IN THERE IT'S GOING TO GO IN /tmp AND I'M GONNA DELETE IT" >&2
     86           exit 1
     87         fi
     88         if [ ! -e "$DIR/super-test.sh" ]; then
     89           echo "$DIR exists and it doesn't look like one of mine." >&2
     90           exit 1
     91         fi
     92         # make distcheck leaves non-writable files when it fails, so we need to chmod to be safe.
     93         chmod -R +w $DIR
     94         rm -rf $DIR
     95       fi
     96       git clone . $DIR
     97       cd $DIR
     98       exec ./super-test.sh "$@"
     99       ;;
    100     remote )
    101       if [ "$#" -lt 2 ]; then
    102         echo "usage: $0 remote HOST [COMMAND]" >&2
    103         exit 1
    104       fi
    105       HOST=$2
    106       shift 2
    107       echo "========================================================================="
    108       echo "Pushing code to $HOST..."
    109       echo "========================================================================="
    110       BRANCH=$(git rev-parse --abbrev-ref HEAD)
    111       ssh $HOST '(chmod -fR +w tmp-test-capnp || true) && rm -rf tmp-test-capnp && mkdir tmp-test-capnp && git init tmp-test-capnp'
    112       git push ssh://$HOST/~/tmp-test-capnp "$BRANCH:test"
    113       ssh $HOST "cd tmp-test-capnp && git checkout test"
    114       exec ssh $HOST "cd tmp-test-capnp && ./super-test.sh $@ && cd .. && rm -rf tmp-test-capnp"
    115       ;;
    116     compiler )
    117       if [ "$#" -lt 2 ]; then
    118         echo "usage: $0 compiler CXX_NAME" >&2
    119         exit 1
    120       fi
    121       export CXX="$2"
    122       shift
    123       ;;
    124     clang* )
    125       # Need to set CC as well for configure to handle -fcoroutines-ts.
    126       export CC=clang${1#clang}
    127       export CXX=clang++${1#clang}
    128       if [ "$1" != "clang-5.0" ]; then
    129         export LIB_FUZZING_ENGINE=-fsanitize=fuzzer
    130       fi
    131       ;;
    132     gcc* )
    133       export CXX=g++${1#gcc}
    134       ;;
    135     g++* )
    136       export CXX=$1
    137       ;;
    138     mingw )
    139       if [ "$#" -ne 2 ]; then
    140         echo "usage: $0 mingw CROSS_HOST" >&2
    141         exit 1
    142       fi
    143       CROSS_HOST=$2
    144 
    145       cd c++
    146       test -e configure || doit autoreconf -i
    147       test ! -e Makefile || (echo "ERROR: Directory unclean!" >&2 && false)
    148 
    149       export WINEPATH='Z:\usr\'"$CROSS_HOST"'\lib;Z:\usr\lib\gcc\'"$CROSS_HOST"'\6.3-win32;Z:'"$PWD"'\.libs'
    150 
    151       doit ./configure --host="$CROSS_HOST" --disable-shared CXXFLAGS="-static-libgcc -static-libstdc++ $CPP_FEATURES" LIBS="$EXTRA_LIBS"
    152 
    153       doit make -j$PARALLEL check
    154       doit make distclean
    155       rm -f *-mingw.exe
    156       exit 0
    157       ;;
    158     android )
    159       # To install Android SDK:
    160       # - Download command-line tools: https://developer.android.com/studio/index.html#command-tools
    161       # - Run $SDK_HOME/tools/bin/sdkmanager platform-tools 'platforms;android-25' 'system-images;android-25;google_apis;armeabi-v7a' emulator 'build-tools;25.0.2' ndk-bundle
    162       # - Run $SDK_HOME/tools/bin/avdmanager create avd -n capnp -k 'system-images;android-25;google_apis;armeabi-v7a' -b google_apis/armeabi-v7a
    163       if [ "$#" -ne 4 ]; then
    164         echo "usage: $0 android SDK_HOME CROSS_HOST COMPILER_PREFIX" >&2
    165         echo
    166         echo "SDK_HOME: Location where android-sdk is installed." >&2
    167         echo "CROSS_HOST: E.g. arm-linux-androideabi" >&2
    168         echo "COMPILER_PREFIX: E.g. armv7a-linux-androideabi24" >&2
    169         exit 1
    170       fi
    171       SDK_HOME=$2
    172       CROSS_HOST=$3
    173       COMPILER_PREFIX=$4
    174 
    175       cd c++
    176       test -e configure || doit autoreconf -i
    177       test ! -e Makefile || (echo "ERROR: Directory unclean!" >&2 && false)
    178       doit ./configure --disable-shared
    179       doit make -j$PARALLEL capnp capnpc-c++
    180 
    181       cp capnp capnp-host
    182       cp capnpc-c++ capnpc-c++-host
    183 
    184       export PATH="$SDK_HOME/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH"
    185       doit make distclean
    186       doit ./configure --host="$CROSS_HOST" CC="$COMPILER_PREFIX-clang" CXX="$COMPILER_PREFIX-clang++" --with-external-capnp --disable-shared CXXFLAGS="-fPIE $CPP_FEATURES" LDFLAGS='-pie' LIBS="-static-libstdc++ -static-libgcc -ldl $EXTRA_LIBS" CAPNP=./capnp-host CAPNPC_CXX=./capnpc-c++-host
    187 
    188       doit make -j$PARALLEL
    189       doit make -j$PARALLEL capnp-test
    190 
    191       echo "Starting emulator..."
    192       trap 'kill $(jobs -p)' EXIT
    193       # TODO(someday): Speed up with KVM? Then maybe we won't have to skip fuzz tests?
    194       $SDK_HOME/emulator/emulator -avd capnp -no-window &
    195       $SDK_HOME/platform-tools/adb 'wait-for-device'
    196       echo "Waiting for localhost to be resolvable..."
    197       doit $SDK_HOME/platform-tools/adb shell 'while ! ping -c 1 localhost > /dev/null 2>&1; do sleep 1; done'
    198       # TODO(cleanup): With 'adb shell' I find I cannot put files anywhere, so I'm using 'su' a
    199       #   lot here. There is probably a better way.
    200       doit $SDK_HOME/platform-tools/adb shell 'su 0 tee /data/capnp-test > /dev/null' < capnp-test
    201       doit $SDK_HOME/platform-tools/adb shell 'su 0 chmod a+rx /data/capnp-test'
    202       doit $SDK_HOME/platform-tools/adb shell 'cd /data && CAPNP_SKIP_FUZZ_TEST=1 su 0 /data/capnp-test && echo ANDROID_""TESTS_PASSED' | tee android-test.log
    203       grep -q ANDROID_TESTS_PASSED android-test.log
    204 
    205       doit make distclean
    206       rm -f capnp-host capnpc-c++-host
    207       exit 0
    208       ;;
    209     cmake )
    210       cd c++
    211       rm -rf cmake-build
    212       mkdir cmake-build
    213       cd cmake-build
    214       doit cmake -G "Unix Makefiles" ..
    215       doit make -j$PARALLEL check
    216       exit 0
    217       ;;
    218     cmake-package )
    219       # Test that a particular configuration of Cap'n Proto can be discovered and configured against
    220       # by a CMake project using the find_package() command. This is currently implemented by
    221       # building the samples against the desired configuration.
    222       #
    223       # Takes one argument, the build configuration, which must be one of:
    224       #
    225       #   autotools-shared
    226       #   autotools-static
    227       #   cmake-shared
    228       #   cmake-static
    229 
    230       if [ "$#" -ne 2 ]; then
    231         echo "usage: $0 cmake-package CONFIGURATION" >&2
    232         echo "  where CONFIGURATION is one of {autotools,cmake}-{static,shared}" >&2
    233         exit 1
    234       fi
    235 
    236       CONFIGURATION=$2
    237       WORKSPACE=$(pwd)/cmake-package/$CONFIGURATION
    238       SOURCE_DIR=$(pwd)/c++
    239 
    240       rm -rf $WORKSPACE
    241       mkdir -p $WORKSPACE/{build,build-samples,inst}
    242 
    243       # Configure
    244       cd $WORKSPACE/build
    245       case "$CONFIGURATION" in
    246         autotools-shared )
    247           autoreconf -i $SOURCE_DIR
    248           doit $SOURCE_DIR/configure --prefix="$WORKSPACE/inst" --disable-static
    249           ;;
    250         autotools-static )
    251           autoreconf -i $SOURCE_DIR
    252           doit $SOURCE_DIR/configure --prefix="$WORKSPACE/inst" --disable-shared
    253           ;;
    254         cmake-shared )
    255           doit cmake $SOURCE_DIR -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$WORKSPACE/inst" \
    256               -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=ON
    257           # The CMake build does not currently set the rpath of the capnp compiler tools.
    258           export LD_LIBRARY_PATH="$WORKSPACE/inst/lib"
    259           ;;
    260         cmake-static )
    261           doit cmake $SOURCE_DIR -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$WORKSPACE/inst" \
    262               -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF
    263           ;;
    264         * )
    265           echo "Unrecognized cmake-package CONFIGURATION argument, must be {autotools,cmake}-{static,shared}" >&2
    266           exit 1
    267           ;;
    268       esac
    269 
    270       # Build and install
    271       doit make -j$PARALLEL install
    272 
    273       # Configure, build, and execute the samples.
    274       cd $WORKSPACE/build-samples
    275       doit cmake $SOURCE_DIR/samples -G "Unix Makefiles" -DCMAKE_PREFIX_PATH="$WORKSPACE/inst" \
    276           -DCAPNPC_FLAGS=--no-standard-import -DCAPNPC_IMPORT_DIRS="$WORKSPACE/inst/include"
    277       doit make -j$PARALLEL
    278 
    279       test_samples
    280 
    281       echo "========================================================================="
    282       echo "Cap'n Proto ($CONFIGURATION) installs a working CMake config package."
    283       echo "========================================================================="
    284 
    285       exit 0
    286       ;;
    287     exotic )
    288       echo "========================================================================="
    289       echo "MinGW 64-bit"
    290       echo "========================================================================="
    291       "$0" mingw x86_64-w64-mingw32
    292       echo "========================================================================="
    293       echo "MinGW 32-bit"
    294       echo "========================================================================="
    295       "$0" mingw i686-w64-mingw32
    296       echo "========================================================================="
    297       echo "Android"
    298       echo "========================================================================="
    299       "$0" android /home/kenton/android-sdk-linux /home/kenton/android-24 arm-linux-androideabi
    300       echo "========================================================================="
    301       echo "CMake"
    302       echo "========================================================================="
    303       "$0" cmake
    304       echo "========================================================================="
    305       echo "CMake config packages"
    306       echo "========================================================================="
    307       "$0" cmake-package autotools-shared
    308       "$0" cmake-package autotools-static
    309       "$0" cmake-package cmake-shared
    310       "$0" cmake-package cmake-static
    311       exit 0
    312       ;;
    313     clean )
    314       rm -rf tmp-staging
    315       cd c++
    316       if [ -e Makefile ]; then
    317         doit make maintainer-clean
    318       fi
    319       rm -f capnproto-*.tar.gz samples/addressbook samples/addressbook.capnp.c++ \
    320             samples/addressbook.capnp.h
    321       exit 0
    322       ;;
    323     help )
    324       echo "usage: $0 [COMMAND]"
    325       echo "commands:"
    326       echo "  test          Runs tests (the default)."
    327       echo "  clang         Runs tests using Clang compiler."
    328       echo "  gcc-4.7       Runs tests using gcc-4.7."
    329       echo "  gcc-4.8       Runs tests using gcc-4.8."
    330       echo "  gcc-4.9       Runs tests using gcc-4.9."
    331       echo "  remote HOST   Runs tests on HOST via SSH."
    332       echo "  mingw         Cross-compiles to MinGW and runs tests using WINE."
    333       echo "  android       Cross-compiles to Android and runs tests using emulator."
    334       echo "  clean         Delete temporary files that may be left after failure."
    335       echo "  help          Prints this help text."
    336       exit 0
    337       ;;
    338     * )
    339       echo "unknown command: $1" >&2
    340       echo "try: $0 help" >&2
    341       exit 1
    342       ;;
    343   esac
    344   shift
    345 done
    346 
    347 # Build optimized builds because they catch more problems, but also enable debugging macros.
    348 # Enable lots of warnings and make sure the build breaks if they fire.  Disable strict-aliasing
    349 # because GCC warns about code that I know is OK.  Disable sign-compare because I've fixed more
    350 # sign-compare warnings than probably all other warnings combined and I've never seen it flag a
    351 # real problem. Disable unused parameters because it's stupidly noisy and never a real problem.
    352 # Enable expensive release-gating tests.
    353 export CXXFLAGS="-O2 -DDEBUG -Wall -Wextra -Werror -Wno-strict-aliasing -Wno-sign-compare -Wno-unused-parameter -DCAPNP_EXPENSIVE_TESTS=1 ${CPP_FEATURES}"
    354 export LIBS="$EXTRA_LIBS"
    355 
    356 if [ "${CXX:-}" != "g++-5" ]; then
    357   # This warning flag is missing on g++-5 but available on all other GCC/Clang versions we target
    358   # in CI.
    359   export CXXFLAGS="$CXXFLAGS -Wimplicit-fallthrough"
    360 fi
    361 
    362 STAGING=$PWD/tmp-staging
    363 
    364 rm -rf "$STAGING"
    365 mkdir "$STAGING"
    366 mkdir "$STAGING/bin"
    367 mkdir "$STAGING/lib"
    368 export PATH=$STAGING/bin:$PATH
    369 export LD_LIBRARY_PATH=$STAGING/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
    370 export PKG_CONFIG_PATH=$STAGING/lib/pkgconfig
    371 
    372 if [ "$QUICK" = quick ]; then
    373   echo "************************** QUICK TEST ***********************************"
    374 fi
    375 
    376 echo "========================================================================="
    377 echo "Building c++"
    378 echo "========================================================================="
    379 
    380 # Apple now aliases gcc to clang, so probe to find out what compiler we're really using.
    381 #
    382 # NOTE: You might be tempted to use `grep -q` here instead of sending output to /dev/null. However,
    383 #   we cannot, because `grep -q` exits immediately upon seeing a match. If it exits too soon, the
    384 #   first stage of the pipeline gets killed, and the whole expression is considered to have failed
    385 #   since we are running bash with the `pipefail` option enabled.
    386 # FUN STORY: We used to use grep -q. One day, we found that Clang 9 when running under GitHub
    387 #   Actions was detected as *not* Clang. But if we ran it twice, it would succeed on the second
    388 #   try. It turns out that under previous versions of Clang, the `__clang__` define was pretty
    389 #   close to the end of the list, so it always managed to write the whole list before `grep -q`
    390 #   exited. But under Clang 9, there's a bunch more defines after this one, giving more time for
    391 #   `grep -q` to exit and break everything. But if the compiler had executed once recently then
    392 #   the second run would go faster due to caching (I guess) and manage to get all the data out
    393 #   to the buffer in time.
    394 if (${CXX:-g++} -dM -E -x c++ /dev/null 2>&1 | grep '__clang__' > /dev/null); then
    395   IS_CLANG=yes
    396   DISABLE_OPTIMIZATION_IF_GCC=
    397 else
    398   IS_CLANG=no
    399   DISABLE_OPTIMIZATION_IF_GCC=-O0
    400 fi
    401 
    402 if [ $IS_CLANG = yes ]; then
    403   # Don't fail out on this ridiculous "argument unused during compilation" warning.
    404   export CXXFLAGS="$CXXFLAGS -Wno-error=unused-command-line-argument"
    405 
    406   # At the moment, only our clang-10 CI run seems to like -fcoroutines-ts. Earlier versions seem to
    407   # have a library misconfiguration causing ./configure to result in the following error:
    408   #   conftest.cpp:12:12: fatal error: 'initializer_list' file not found
    409   #   #include <initializer_list>
    410   # Let's use any clang version >= 10 so that if we move to a newer version, we'll get additional
    411   # coverage by default.
    412   if [ "${CXX#*-}" -ge 10 ] 2>/dev/null; then
    413     export CXXFLAGS="$CXXFLAGS -std=gnu++17 -stdlib=libc++ -fcoroutines-ts"
    414     export LDFLAGS="-fcoroutines-ts -stdlib=libc++"
    415   fi
    416 else
    417   # GCC emits uninitialized warnings all over and they seem bogus. We use valgrind to test for
    418   # uninitialized memory usage later on. GCC 4 also emits strange bogus warnings with
    419   # -Wstrict-overflow, so we disable it.
    420   CXXFLAGS="$CXXFLAGS -Wno-maybe-uninitialized -Wno-strict-overflow"
    421 fi
    422 
    423 cd c++
    424 doit autoreconf -i
    425 doit ./configure --prefix="$STAGING" || (cat config.log && exit 1)
    426 doit make -j$PARALLEL check
    427 
    428 if [ $IS_CLANG = no ]; then
    429   # Verify that generated code compiles with pedantic warnings.  Make sure to treat capnp headers
    430   # as system headers so warnings in them are ignored.
    431   doit ${CXX:-g++} -isystem src -std=c++14 -fno-permissive -pedantic -Wall -Wextra -Werror \
    432       -c src/capnp/test.capnp.c++ -o /dev/null
    433 fi
    434 
    435 echo "========================================================================="
    436 echo "Testing c++ install"
    437 echo "========================================================================="
    438 
    439 doit make install
    440 
    441 test "x$(which capnp)" = "x$STAGING/bin/capnp"
    442 test "x$(which capnpc-c++)" = "x$STAGING/bin/capnpc-c++"
    443 
    444 cd samples
    445 
    446 doit capnp compile -oc++ addressbook.capnp -I"$STAGING"/include --no-standard-import
    447 doit ${CXX:-g++} -std=c++14 addressbook.c++ addressbook.capnp.c++ -o addressbook \
    448     $CXXFLAGS $(pkg-config --cflags --libs capnp)
    449 
    450 doit capnp compile -oc++ calculator.capnp -I"$STAGING"/include --no-standard-import
    451 doit ${CXX:-g++} -std=c++14 calculator-client.c++ calculator.capnp.c++ -o calculator-client \
    452     $CXXFLAGS $(pkg-config --cflags --libs capnp-rpc)
    453 doit ${CXX:-g++} -std=c++14 calculator-server.c++ calculator.capnp.c++ -o calculator-server \
    454     $CXXFLAGS $(pkg-config --cflags --libs capnp-rpc)
    455 
    456 test_samples
    457 rm addressbook addressbook.capnp.c++ addressbook.capnp.h
    458 rm calculator-client calculator-server calculator.capnp.c++ calculator.capnp.h
    459 
    460 rm -rf cmake-build
    461 mkdir cmake-build
    462 cd cmake-build
    463 
    464 doit cmake .. -G "Unix Makefiles" -DCMAKE_PREFIX_PATH="$STAGING" \
    465     -DCAPNPC_FLAGS=--no-standard-import -DCAPNPC_IMPORT_DIRS="$STAGING/include"
    466 doit make -j$PARALLEL
    467 
    468 test_samples
    469 cd ../..
    470 rm -rf samples/cmake-build
    471 
    472 if [ "$QUICK" = quick ]; then
    473   doit make maintainer-clean
    474   rm -rf "$STAGING"
    475   exit 0
    476 fi
    477 
    478 echo "========================================================================="
    479 echo "Testing --with-external-capnp and --disable-reflection"
    480 echo "========================================================================="
    481 
    482 doit make distclean
    483 doit ./configure --prefix="$STAGING" --disable-shared --disable-reflection \
    484     --with-external-capnp CAPNP=$STAGING/bin/capnp
    485 doit make -j$PARALLEL check
    486 doit make distclean
    487 
    488 # Test 32-bit build now while we have $STAGING available for cross-compiling.
    489 #
    490 # Cygwin64 can cross-compile to Cygwin32 but can't actually run the cross-compiled binaries. Let's
    491 # just skip this test on Cygwin since it's so slow and honestly no one cares.
    492 #
    493 # MacOS apparently no longer distributes 32-bit standard libraries. OK fine let's restrict this to
    494 # Linux.
    495 if [ "x`uname -m`" = "xx86_64" ] && [ "x`uname`" = xLinux ]; then
    496   echo "========================================================================="
    497   echo "Testing 32-bit build"
    498   echo "========================================================================="
    499 
    500   doit ./configure CXX="${CXX:-g++} -m32" CXXFLAGS="$CXXFLAGS ${ADDL_M32_FLAGS:-}" --disable-shared
    501   doit make -j$PARALLEL check
    502   doit make distclean
    503 fi
    504 
    505 echo "========================================================================="
    506 echo "Testing c++ uninstall"
    507 echo "========================================================================="
    508 
    509 doit ./configure --prefix="$STAGING"
    510 doit make uninstall
    511 
    512 echo "========================================================================="
    513 echo "Testing c++ dist"
    514 echo "========================================================================="
    515 
    516 doit make -j$PARALLEL distcheck
    517 doit make distclean
    518 rm capnproto-*.tar.gz
    519 
    520 if [ "x`uname`" = xLinux ]; then
    521   echo "========================================================================="
    522   echo "Testing generic Unix (no Linux-specific features)"
    523   echo "========================================================================="
    524 
    525   doit ./configure --disable-shared CXXFLAGS="$CXXFLAGS -DKJ_USE_FUTEX=0 -DKJ_USE_EPOLL=0"
    526   doit make -j$PARALLEL check
    527   doit make distclean
    528 fi
    529 
    530 echo "========================================================================="
    531 echo "Testing with -fno-rtti and -fno-exceptions"
    532 echo "========================================================================="
    533 
    534 # GCC miscompiles capnpc-c++ when -fno-exceptions and -O2 are specified together. The
    535 # miscompilation happens in one specific inlined call site of Array::dispose(), but this method
    536 # is inlined in hundreds of other places without issue, so I have no idea how to narrow down the
    537 # bug. Clang works fine. So, for now, we disable optimizations on GCC for -fno-exceptions tests.
    538 
    539 doit ./configure --disable-shared CXXFLAGS="$CXXFLAGS -fno-rtti -fno-exceptions $DISABLE_OPTIMIZATION_IF_GCC"
    540 doit make -j$PARALLEL check
    541 
    542 if [ "x`uname`" = xLinux ]; then
    543   doit make distclean
    544 
    545   echo "========================================================================="
    546   echo "Testing with valgrind"
    547   echo "========================================================================="
    548 
    549   doit ./configure --disable-shared CXXFLAGS="-g $CPP_FEATURES"
    550   doit make -j$PARALLEL
    551   doit make -j$PARALLEL capnp-test
    552   # Running the fuzz tests under Valgrind is a great thing to do -- but it takes
    553   # some 40 minutes. So, it needs to be done as a separate step of the release
    554   # process, perhaps along with the AFL tests.
    555   CAPNP_SKIP_FUZZ_TEST=1 doit valgrind --leak-check=full --track-fds=yes --error-exitcode=1 --child-silent-after-fork=yes --sim-hints=lax-ioctls --suppressions=valgrind.supp ./capnp-test
    556 fi
    557 
    558 doit make maintainer-clean
    559 
    560 rm -rf "$STAGING"