Files
mikrotik-backup/vendor/libssh2-sys/tests/run-security-regressions.sh
T
2026-10-28 09:16:54 +01:00

16 lines
583 B
Bash
Executable File

#!/bin/sh
# Run against the exact bundled libssh2 archive produced by the Cargo build.
set -eu
if [ "$#" -ne 1 ] || [ ! -f "$1" ]; then
echo "Usage: $0 /absolute/path/to/target/.../out/build/libssh2.a" >&2
exit 2
fi
test_root=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
test_temp=$(mktemp -d)
trap 'rm -rf "$test_temp"' EXIT HUP INT TERM
"${CC:-cc}" -std=c99 -O2 -DNDEBUG -Wall -Wextra -Werror \
-I"$test_root/../libssh2/include" \
"$test_root/security-regression.c" "$1" -lssl -lcrypto -lz \
-o "$test_temp/security-regression"
"$test_temp/security-regression"