-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mkm: Add test script for
cn test
, modify other files to make it work
- Loading branch information
Showing
6 changed files
with
105 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
#pragma once | ||
|
||
#ifndef CN_ENV | ||
#include <stdint.h> | ||
#endif | ||
|
||
#define KEY_ID_SIZE 1 | ||
#define NONCE_SIZE 16 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
# Check arguments | ||
if [[ $# -lt 1 ]]; then | ||
echo "Usage: $0 <input-file> [<testgen-dir>]" | ||
exit 1 | ||
fi | ||
|
||
INPUT_FILE="$1" | ||
OUTBASE="${INPUT_FILE%.c}" | ||
OUTPUT_FILE="${OUTBASE}-out.c" | ||
|
||
./process-cn-test.sh "${INPUT_FILE}" "${OUTPUT_FILE}" | ||
|
||
# Create a temporary directory and ensure it's cleaned up on exit | ||
TMP_DIR="$(mktemp -d)" | ||
trap 'rm -rf "$TMP_DIR"' EXIT | ||
TESTGEN_DIR="${2:-$TMP_DIR}" | ||
|
||
ROOT_DIR="$(pwd)" | ||
|
||
eval "$(opam env)" | ||
|
||
# CN flags, stored in an array for robustness | ||
CN_FLAGS=( | ||
"--output=${TESTGEN_DIR}" | ||
"--include=${ROOT_DIR}/../include/wars.h" | ||
# "-I${ROOT_DIR}/../include" # Already preprocessed away | ||
"-I${OPAM_SWITCH_PREFIX}/lib/cerberus/runtime/libc/include/posix" | ||
"--magic-comment-char-dollar" | ||
) | ||
|
||
# Sanity check - the resulting file should be verifiable if the original is | ||
# cn verify "${CN_FLAGS[@]}" "${OUTPUT_FILE}" | ||
|
||
# Run CN-test on the resulting file | ||
cn test "${CN_FLAGS[@]}" "${OUTPUT_FILE}" |