| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
name: Functional tests |
| 6 |
description: Run functional tests |
| 7 |
|
| 8 |
inputs: |
| 9 |
nix-shell: |
| 10 |
description: Run in the specified Nix environment if exists |
| 11 |
default: "ci" |
| 12 |
nix-cache: |
| 13 |
description: Determine whether to enable nix cache |
| 14 |
default: 'false' |
| 15 |
nix-verbose: |
| 16 |
description: Determine wether to suppress nix log or not |
| 17 |
default: 'false' |
| 18 |
custom_shell: |
| 19 |
description: The shell to use. Only relevant if no nix-shell specified |
| 20 |
default: "bash" |
| 21 |
gh_token: |
| 22 |
description: Github access token to use |
| 23 |
required: true |
| 24 |
cflags: |
| 25 |
description: CFLAGS to pass to compilation |
| 26 |
default: "" |
| 27 |
ldflags: |
| 28 |
description: LDFLAGS to pass to linking |
| 29 |
default: "" |
| 30 |
cross_prefix: |
| 31 |
description: Binary prefix for cross compilation |
| 32 |
default: "" |
| 33 |
exec_wrapper: |
| 34 |
description: Binary wrapper for execution (e.g. QEMU) |
| 35 |
default: "" |
| 36 |
opt: |
| 37 |
description: Whether to build opt/non-opt binaries or all (all | opt | no_opt) |
| 38 |
default: "all" |
| 39 |
func: |
| 40 |
description: Determine whether to run functional test or not |
| 41 |
default: "true" |
| 42 |
kat: |
| 43 |
description: Determine whether to run kat test or not |
| 44 |
default: "true" |
| 45 |
acvp: |
| 46 |
description: Determine whether to run acvp test or not |
| 47 |
default: "true" |
| 48 |
examples: |
| 49 |
description: Determine whether to run examples or not |
| 50 |
default: "true" |
| 51 |
unit: |
| 52 |
description: Determine whether to run unit tests or not |
| 53 |
default: "true" |
| 54 |
check_namespace: |
| 55 |
description: Determine whether to check namespacing or not |
| 56 |
default: "true" |
| 57 |
stack: |
| 58 |
description: Determine whether to run stack analysis or not |
| 59 |
default: "false" |
| 60 |
alloc: |
| 61 |
description: Determine whether to run alloc tests or not |
| 62 |
default: "true" |
| 63 |
rng_fail: |
| 64 |
description: Determine whether to run rng fail tests or not |
| 65 |
default: "true" |
| 66 |
extra_args: |
| 67 |
description: Additional arguments to pass to the tests script |
| 68 |
default: "" |
| 69 |
extra_env: |
| 70 |
description: Additional environment variables to set when calling the tests script |
| 71 |
default: "" |
| 72 |
runs: |
| 73 |
using: composite |
| 74 |
steps: |
| 75 |
- name: Preprocess |
| 76 |
shell: bash |
| 77 |
run: | |
| 78 |
arch=$(uname -m) |
| 79 |
echo MODE="${{ inputs.cross_prefix == '' && 'native' || 'cross' }}" >> $GITHUB_ENV |
| 80 |
echo FUNC="${{ inputs.func == 'true' && 'func' || 'no-func' }}" >> $GITHUB_ENV |
| 81 |
echo KAT="${{ inputs.kat == 'true' && 'kat' || 'no-kat' }}" >> $GITHUB_ENV |
| 82 |
echo UNIT="${{ inputs.unit == 'true' && 'unit' || 'no-unit' }}" >> $GITHUB_ENV |
| 83 |
echo ACVP="${{ inputs.acvp == 'true' && 'acvp' || 'no-acvp' }}" >> $GITHUB_ENV |
| 84 |
echo EXAMPLES="${{ inputs.examples == 'true' && 'examples' || 'no-examples' }}" >> $GITHUB_ENV |
| 85 |
echo STACK="${{ inputs.stack == 'true' && 'stack' || 'no-stack' }}" >> $GITHUB_ENV |
| 86 |
echo ALLOC="${{ inputs.alloc == 'true' && 'alloc' || 'no-alloc' }}" >> $GITHUB_ENV |
| 87 |
echo RNGFAIL="${{ inputs.rng_fail == 'true' && 'rng-fail' || 'no-rng-fail' }}" >> $GITHUB_ENV |
| 88 |
- name: Setup nix |
| 89 |
uses: ./.github/actions/setup-shell |
| 90 |
with: |
| 91 |
nix-shell: ${{ inputs.nix-shell }} |
| 92 |
nix-cache: ${{ inputs.nix-cache }} |
| 93 |
nix-verbose: ${{ inputs.nix-verbose }} |
| 94 |
gh_token: ${{ inputs.gh_token }} |
| 95 |
custom_shell: ${{ inputs.custom_shell }} |
| 96 |
- name: System info |
| 97 |
shell: ${{ env.SHELL }} |
| 98 |
run: | |
| 99 |
ARCH=$(uname -m) |
| 100 |
echo <<-EOF |
| 101 |
## Setup |
| 102 |
Architecture: $ARCH |
| 103 |
- $(uname -a) |
| 104 |
- $(nix --version || echo 'nix not present') |
| 105 |
- $(bash --version | grep -m1 "") |
| 106 |
- $(python3 --version) |
| 107 |
- $(${{ inputs.cross_prefix }}${CC} --version | grep -m1 "") |
| 108 |
EOF |
| 109 |
cat >> $GITHUB_STEP_SUMMARY <<-EOF |
| 110 |
## Setup |
| 111 |
Architecture: $ARCH |
| 112 |
- $(uname -a) |
| 113 |
- $(nix --version || echo 'nix not present') |
| 114 |
- $(bash --version | grep -m1 "") |
| 115 |
- $(python3 --version) |
| 116 |
- $(${{ inputs.cross_prefix }}${CC} --version | grep -m1 "") |
| 117 |
EOF |
| 118 |
- name: ${{ env.MODE }} ${{ inputs.opt }} tests (${{ env.FUNC }}, ${{ env.KAT }}, ${{ env.EXAMPLES }}, ${{ env.STACK }}, ${{ env.UNIT }}, ${{ env.ALLOC }}, ${{ env.RNGFAIL }}) |
| 119 |
shell: ${{ env.SHELL }} |
| 120 |
run: | |
| 121 |
make clean |
| 122 |
${{ inputs.extra_env }} ./scripts/tests all ${{ inputs.check_namespace == 'true' && '--check-namespace' || ''}} --exec-wrapper="${{ inputs.exec_wrapper }}" --cross-prefix="${{ inputs.cross_prefix }}" --cflags="${{ inputs.cflags }}" --ldflags="${{ inputs.ldflags }}" --opt=${{ inputs.opt }} --${{ env.FUNC }} --${{ env.KAT }} --${{ env.ACVP }} --${{ env.EXAMPLES }} --${{ env.STACK }} --${{ env.UNIT }} --${{ env.ALLOC }} --${{ env.RNGFAIL }} -v ${{ inputs.extra_args }} |
| 123 |
- name: Post ${{ env.MODE }} Tests |
| 124 |
shell: ${{ env.SHELL }} |
| 125 |
if: success() || failure() |
| 126 |
run: | |
| 127 |
make clean |