Skip to content

Commit

Permalink
Update OpenBSD CI w/ more memory, run static tests
Browse files Browse the repository at this point in the history
  • Loading branch information
skmcgrail committed Apr 23, 2024
1 parent 83efd65 commit a7d2feb
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 10 deletions.
31 changes: 29 additions & 2 deletions .github/workflows/actions-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,31 +136,58 @@ jobs:
echo ${env:SDEROOT}
.\tests\ci\run_windows_tests.bat "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64 true
OpenBSD-64-bit:
OpenBSD-x86-64:
needs: [sanity-test-run]
runs-on: macos-12-large
strategy:
matrix:
runner: ["tests/ci/run_posix_tests.sh", "tests/ci/run_fips_tests.sh"]
version: ["7.4", "7.5"]
steps:
- uses: actions/checkout@v3
- name: OpenBSD
uses: cross-platform-actions/action@v0.22.0
uses: cross-platform-actions/action@v0.24.0
env:
AWS_LC_SSL_TEST_RUNNER_PEEK_ROUNDS: 5
with:
environment_variables: AWS_LC_SSL_TEST_RUNNER_PEEK_ROUNDS
operating_system: openbsd
cpu_count: 12
memory: 13G
architecture: x86-64
version: '7.4'
shell: bash
run: |
set -x
sudo pkg_add cmake ninja go gmake
sudo pfctl -d
mkdir "${HOME}/bin"
ln -s /usr/local/bin/gmake "${HOME}/bin/make"
cat << EOF | sudo tee /etc/login.conf.d/unlimited
unlimited:\
:datasize-cur=infinity:\
:datasize-max=infinity:\
:stacksize-cur=infinity:\
:stacksize-max=infinity:\
:memoryuse-cur=infinity:\
:memoryuse-max=infinity:\
:maxproc-cur=infinity:\
:maxproc-max=infinity:\
:openfiles-cur=infinity:\
:openfiles-max=infinity:\
:cpuuse-cur=infinity:\
:cpuuse-max=infinity:\
:priority=0:\
:ignoretime:
EOF
sudo usermod -L unlimited runner
export _PWD=$(pwd)
sudo su -c unlimited -s /usr/local/bin/bash -l runner <<EOF
set -x
cd ${_PWD}
export PATH="${HOME}/bin:${PATH}"
${{ matrix.runner }}
EOF
# TODO: Investigate sudden hanging tests and failures in GHA runners (P114059413)
# MSVC-SDE-32-bit:
Expand Down
18 changes: 16 additions & 2 deletions tests/ci/run_fips_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,28 @@ set -ex

source tests/ci/common_posix_setup.sh

function static_linux_supported() {
if [[ ("$(uname -s)" == 'Linux'*) && (("$(uname -p)" == 'x86_64'*) || ("$(uname -p)" == 'aarch64'*)) ]]; then
return 0
fi
return 1
}

function static_openbsd_supported() {
if [[ "$(uname -s)" == 'OpenBSD' && "$(uname -p)" == 'x86_64'* ]]; then
return 0
fi
return 1
}

echo "Testing AWS-LC shared library in FIPS Release mode."
fips_build_and_test -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=1

echo "Testing AWS-LC shared library in FIPS Release mode with FIPS entropy source method CPU Jitter."
fips_build_and_test -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=1 -DENABLE_FIPS_ENTROPY_CPU_JITTER=ON

# Static FIPS build works only on Linux platforms.
if [[ ("$(uname -s)" == 'Linux'*) && (("$(uname -p)" == 'x86_64'*) || ("$(uname -p)" == 'aarch64'*)) ]]; then
# Static FIPS build works only on Linux and OpenBSD platforms.
if static_linux_supported || static_openbsd_supported; then
echo "Testing AWS-LC static library in FIPS Release mode."
fips_build_and_test -DCMAKE_BUILD_TYPE=Release

Expand Down
18 changes: 14 additions & 4 deletions util/all_tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,23 @@ var (
sslTests = flag.Bool("ssl-tests", true, "If true, run BoringSSL tests against libssl")
sdePath = flag.String("sde-path", "sde", "The path to find the sde binary.")
buildDir = flag.String("build-dir", "build", "The build directory to run the tests from.")
numWorkers = flag.Int("num-workers", runtime.NumCPU(), "Runs the given number of workers when testing.")
numWorkers *int
jsonOutput = flag.String("json-output", "", "The file to output JSON results to.")
mallocTest = flag.Int64("malloc-test", -1, "If non-negative, run each test with each malloc in turn failing from the given number onwards.")
mallocTestDebug = flag.Bool("malloc-test-debug", false, "If true, ask each test to abort rather than fail a malloc. This can be used with a specific value for --malloc-test to identity the malloc failing that is causing problems.")
)

func init() {
var workers int
v, _ := os.LookupEnv("AWS_LC_ALL_TESTS_MAX_NUM_WORKERS")
if v, err := strconv.Atoi(v); err == nil && v > 0 {
workers = v
} else {
workers = runtime.NumCPU()
}
numWorkers = flag.Int("num-workers", workers, "Runs the given number of workers when testing.")
}

type test struct {
testconfig.Test

Expand Down Expand Up @@ -100,8 +111,8 @@ var sdeCPUs = []string{

func targetArchMatchesRuntime(target string) bool {
if (target == "") ||
(target == "x86" && runtime.GOARCH == "amd64") ||
(target == "arm" && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64")) {
(target == "x86" && runtime.GOARCH == "amd64") ||
(target == "arm" && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64")) {
return true
}
return false
Expand Down Expand Up @@ -235,7 +246,6 @@ func runTestOnce(test test, mallocNumToFail int64) (passed bool, err error) {
return false, err
}


return testPass(outBuf), nil
}

Expand Down
17 changes: 15 additions & 2 deletions util/fipstools/acvp/acvptool/test/check_expected.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"os"
"os/exec"
"runtime"
"strconv"
"strings"
"sync"
"sync/atomic"
Expand All @@ -37,8 +38,20 @@ var (
moduleWrappers *string = flag.String("module-wrappers", "", "Comma-separated list of name:path pairs for known module wrappers")
testsPath *string = flag.String("tests", "", "Path to JSON file listing tests")
update *bool = flag.Bool("update", false, "If true then write updated outputs")
numWorkers *int
)

func init() {
var workers int
v, _ := os.LookupEnv("AWS_LC_ACVP_MAX_NUM_WORKERS")
if v, err := strconv.Atoi(v); err == nil && v > 0 {
workers = v
} else {
workers = runtime.NumCPU()
}
numWorkers = flag.Int("num-workers", workers, "Runs the given number of workers when testing.")
}

type invocation struct {
toolPath string
wrapperPath string
Expand Down Expand Up @@ -87,11 +100,11 @@ func main() {
log.Fatal(err)
}

work := make(chan invocation, runtime.NumCPU())
work := make(chan invocation, *numWorkers)
var numFailed uint32

var wg sync.WaitGroup
for i := 0; i < runtime.NumCPU(); i++ {
for i := 0; i < *numWorkers; i++ {
wg.Add(1)
go worker(&wg, work, &numFailed)
}
Expand Down

0 comments on commit a7d2feb

Please sign in to comment.