Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: kTLS specific nix devShell #4886

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions codebuild/spec/buildspec_ktls.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,35 @@
---
version: 0.2
env:
shell: bash
phases:
install:
commands:
- apt update
- apt upgrade -y
- apt install -y qemu qemu-system-x86 wget cloud-image-utils
pre_build:
commands:
- mkdir ~/.ssh; echo -e "Host localhost\nUser codebuild\nPort 2222" > ~/.ssh/config
- aws s3 --quiet sync s3://s2n-ktls-testing ./qemu
- cd qemu; bash ./run.sh; cd ..
- rsync -avz --exclude=qemu --exclude=tests/fuzz -e 'ssh -p 2222' . codebuild@localhost:/home/codebuild/s2n-tls
build:
commands:
- codebuild-breakpoint
- |
ssh -p 2222 codebuild@localhost " \
ssh localhost " \
cd s2n-tls; sudo modprobe tls; \
export S2N_CMAKE_OPTIONS=${S2N_CMAKE_OPTIONS}; \
export S2N_KTLS_TESTING_EXPECTED=1; \
nix develop .#openssl111 --command bash -c \
'source ./nix/shell.sh && clean && configure && unit' \
nix develop .#minimal --command bash -c \
'source ./nix/shell.sh && clean && configure' \
"
post_build:
commands:
lrstewart marked this conversation as resolved.
Show resolved Hide resolved
- |
ssh localhost " \
cd s2n-tls; \
export S2N_CMAKE_OPTIONS=${S2N_CMAKE_OPTIONS}; \
export S2N_KTLS_TESTING_EXPECTED=1; \
export S2N_EXCLUDE_TESTS=aead; \
nix develop .#minimal --command bash -c \
'source ./nix/shell.sh && unit' \
"
12 changes: 11 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,17 @@
source ${writeScript ./nix/shell.sh}
'';
});

devShells.minimal = pkgs.mkShell {
# Minimal unit test environment with aws-lc.
# This is not an over-ride like the other shells.
buildInputs = [ pkgs.cmake aws-lc ];
S2N_LIBCRYPTO = "awslc";
shellHook = ''
echo Setting up $S2N_LIBCRYPTO environment from flake.nix...
export PS1="[nix $S2N_LIBCRYPTO] $PS1"
source ${writeScript ./nix/shell.sh}
'';
};
# Used to backup the devShell to s3 for caching.
packages.devShell = devShells.default.inputDerivation;
packages.default = packages.s2n-tls;
Expand Down
2 changes: 1 addition & 1 deletion nix/shell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function build {(set -e
function unit {(set -e
if [[ -z "$1" ]]; then
cmake --build build -j $(nproc)
ctest --test-dir build -L unit -j $(nproc) --verbose
ctest --test-dir build -L unit -E "$S2N_EXCLUDE_TESTS" -j $(nproc) --verbose
else
tests=$(ctest --test-dir build -N -L unit | grep -E "Test +#" | grep -Eo "[^ ]+_test$" | grep "$1")
echo "Tests:"
Expand Down
Loading