SPB Git

Repository Public Apache-2.0

test-c-abi.sh 2.4 KB 62 lines shellscript

1#!/usr/bin/env bash2# =============================================================================3#                  SP BOUCHER | SOFTWARE & RESEARCH4#             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project          : SPB Quantum Crypto8# File             : scripts/test-c-abi.sh9# Module           : Scripts10# Repository       : https://git.spboucher.ai/spb-quantum-crypto11# Project Website  : https://pqce.spboucher.ai12# Created          : 2026-12-0313# Last Modified    : 2026-12-0314#15# Author           : Simon-Pierre Boucher16# Position         : Professor of Finance17# Institution      : Université du Québec en Outaouais (UQO)18# Organization     : SP Boucher19# Website          : https://spboucher.ai20# Git              : https://git.spboucher.ai21#22# Preferred Contact: contact@spboucher.ai23# Development      : dev@spboucher.ai24# Support          : support@spboucher.ai25# Security/Admin   : admin@spboucher.ai26#27# Copyright (c) 202628# Simon-Pierre Boucher29# All rights reserved where applicable. This file is governed by the30# applicable project license, copyright notices and relevant law.31# Existing third-party rights and notices remain unaffected.32#33# License          : Apache-2.034#35# Do not embed credentials, private keys, access tokens,36# certificates or confidential personal information.37#38# =============================================================================39# END OF SP BOUCHER SOURCE HEADER40# =============================================================================4142# Builds the static library in release mode, checks that include/spb_pqc.h is43# the generated one, compiles tests/interop/c/abi_test.c against both with44# warnings as errors, and runs it (also under AddressSanitizer + UBSan).45set -euo pipefail46cd "$(dirname "$0")/.."47./scripts/gen-header.sh --check48cargo build --release -p spb-pqc-ffi49out="target/c-abi"50mkdir -p "$out"51case "$(uname -s)" in52  Darwin) libs="-framework Security" ;;53  *) libs="-lpthread -ldl -lm" ;;54esac55cc -std=c11 -Wall -Wextra -Werror -pedantic -Iinclude tests/interop/c/abi_test.c \56   target/release/libspb_pqc.a $libs -o "$out/abi_test"57"$out/abi_test"58cc -std=c11 -Wall -Wextra -Werror -g -fsanitize=address,undefined -fno-omit-frame-pointer -Iinclude \59   tests/interop/c/abi_test.c target/release/libspb_pqc.a $libs -o "$out/abi_test_asan"60"$out/abi_test_asan" | tail -161echo "C ABI (ASan + UBSan on the C side): PASS"62
Files main
Menu

Theme