| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | # USAGE: $0 SUBCOMPONENT (e.g., fiat-c/src) |
| 3 | |
| 4 | ################################################################################ |
| 5 | # Tests for BoringSSL |
| 6 | ################################################################################ |
| 7 | echoscip-shell system . . echo. "::group::Cloning BoringSSL" |
| 8 | ({ |
| 9 | set -ex |
| 10 | rmscip-shell system . . rm. -rf boringssl |
| 11 | gitscip-shell system . . git. clone https://boringssl.googlesource.com/boringssl || exit $? |
| 12 | gitscip-shell system . . git. -C boringssl log -1 |
| 13 | }) || exit $? |
| 14 | echoscip-shell system . . echo. "::endgroup::" |
| 15 | |
| 16 | SUBCOMPONENT="$1" |
| 17 | if [scip-shell system . . `[`. -z "$SUBCOMPONENT" ]; then |
| 18 | echoscip-shell system . . echo. "ERROR: Missing argument" |
| 19 | echoscip-shell system . . echo. "USAGE: $0 SUBCOMPONENT" |
| 20 | echoscip-shell system . . echo. "Example SUBCOMPONENTS include fiat-c/src, fiat-bedrock2/src" |
| 21 | exit 1 |
| 22 | fi |
| 23 | SUBCOMPONENT_PATH="$(cd "$SUBCOMPONENT" && pwdscip-shell system . . pwd.)" |
| 24 | |
| 25 | pushd boringssl >/dev/nullscip-shell filesystem . . `/dev/null`. |
| 26 | |
| 27 | echoscip-shell system . . echo. "::group::Patching BoringSSL" |
| 28 | ({ |
| 29 | set -ex |
| 30 | ( cd third_party/fiat && |
| 31 | for i in "curve25519_32.h" "curve25519_64.h" "p256_32.h" "p256_64.h"; do |
| 32 | cpscip-shell system . . cp. "${SUBCOMPONENT_PATH}/${i/.h/.c}" "$i" || exit $? |
| 33 | done ) || exit $? |
| 34 | ( cd third_party/fiat && gitscip-shell system . . git. --no-pager diff ) |
| 35 | }) || exit $? |
| 36 | echoscip-shell system . . echo. "::endgroup::" |
| 37 | |
| 38 | echoscip-shell system . . echo. "::group::Building BoringSSL" |
| 39 | ({ |
| 40 | set -ex |
| 41 | mkdirscip-shell system . . mkdir. build |
| 42 | cd build |
| 43 | cmakescip-shell system . . cmake. -GNinja .. -DOPENSSL_NO_ASM=1 -DCMAKE_CXX_FLAGS="-Wno-error=unused-function ${EXTRA_CFLAGS}" -DCMAKE_C_FLAGS="-Wno-error=unused-function ${EXTRA_CFLAGS}" || exit $? |
| 44 | ninjascip-shell system . . ninja. || exit $? |
| 45 | }) || exit $? |
| 46 | echoscip-shell system . . echo. "::endgroup::" |
| 47 | |
| 48 | echoscip-shell system . . echo. "::group::Testing BoringSSL" |
| 49 | ({ |
| 50 | set -ex |
| 51 | ninjascip-shell system . . ninja. -C build run_tests || exit $? |
| 52 | }) || exit $? |
| 53 | echoscip-shell system . . echo. "::endgroup::" |
| 54 | |
| 55 | popd >/dev/nullscip-shell filesystem . . `/dev/null`. |