Zero-copy FTP/HTTP Daemon compatible with all POSIX systems
| 1 | #!/usr/bin/env bash |
| 2 | set -euo pipefail |
| 3 | |
| 4 | ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" |
| 5 | |
| 6 | TARGET="${TARGET:-macos}" |
| 7 | ENABLE_ZHTTPD="${ENABLE_ZHTTPD:-0}" |
| 8 | |
| 9 | echo "[1/6] Unit tests + ASan/UBSan (debug)" |
| 10 | make -C "$ROOT_DIR" TARGET="$TARGET" BUILD_TYPE=debug ENABLE_ZHTTPD="$ENABLE_ZHTTPD" test |
| 11 | |
| 12 | echo "[2/6] Clang Static Analyzer" |
| 13 | make -C "$ROOT_DIR" TARGET="$TARGET" BUILD_TYPE=release ENABLE_ZHTTPD="$ENABLE_ZHTTPD" analyze |
| 14 | |
| 15 | echo "[3/6] Integration: FTP roundtrip checksums" |
| 16 | "$ROOT_DIR/tools/qa/ftp_roundtrip.sh" "TARGET=$TARGET" "BUILD_TYPE=debug" "FTP_PORT=21234" "PARALLEL=4" "FILE_COUNT=6" "FILE_SIZE_BYTES=$((16*1024*1024))" |
| 17 | |
| 18 | echo "[4/6] Integration: FTP roundtrip (bigger, more parallel)" |
| 19 | "$ROOT_DIR/tools/qa/ftp_roundtrip.sh" "TARGET=$TARGET" "BUILD_TYPE=debug" "FTP_PORT=21235" "PARALLEL=8" "FILE_COUNT=8" "FILE_SIZE_BYTES=$((32*1024*1024))" |
| 20 | |
| 21 | echo "[5/6] Valgrind (if available, Linux only)" |
| 22 | if command -v valgrind >/dev/null 2>&1; then |
| 23 | if [[ "$TARGET" == "linux" ]]; then |
| 24 | make -C "$ROOT_DIR" TARGET=linux BUILD_TYPE=release ENABLE_ZHTTPD="$ENABLE_ZHTTPD" clean |
| 25 | make -C "$ROOT_DIR" TARGET=linux BUILD_TYPE=release ENABLE_ZHTTPD="$ENABLE_ZHTTPD" all |
| 26 | for t in build/linux/release/tests/*; do |
| 27 | if [[ -x "$t" ]]; then |
| 28 | valgrind --leak-check=full --error-exitcode=99 "$t" |
| 29 | fi |
| 30 | done |
| 31 | else |
| 32 | echo "Skipping Valgrind: TARGET=$TARGET (Valgrind is typically run on Linux)." |
| 33 | fi |
| 34 | else |
| 35 | echo "Skipping Valgrind: not installed." |
| 36 | fi |
| 37 | |
| 38 | echo "[6/6] Done" |
| 39 |