Skip to content

Commit

Permalink
Run openssl tests (#15)
Browse files Browse the repository at this point in the history
* workflows/test-harness: run openssl tests

Signed-off-by: Andrew Pan <a@tny.town>

* harness/gocryptox509: never exit with nonzero

Signed-off-by: Andrew Pan <a@tny.town>

* harness/openssl: older make accomodations

Also only use libcrypto.

Signed-off-by: William Woodruff <william@trailofbits.com>

* Makefile: debug tweak, document building

Signed-off-by: William Woodruff <william@trailofbits.com>

* test-harness: drop explicit CXX

Signed-off-by: William Woodruff <william@trailofbits.com>

* Revert "test-harness: drop explicit CXX"

This reverts commit df725fe.

---------

Signed-off-by: Andrew Pan <a@tny.town>
Signed-off-by: William Woodruff <william@trailofbits.com>
Co-authored-by: William Woodruff <william@trailofbits.com>
  • Loading branch information
tnytown and woodruffw committed Jul 6, 2023
1 parent 996f42c commit 85d9d91
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 10 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/test-harness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:

jobs:
test-gocryptox509:
gocryptox509:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -18,3 +18,10 @@ jobs:

- name: run tests
run: make test-go
openssl:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: run tests
run: make CXX=clang++ test-openssl
4 changes: 0 additions & 4 deletions harness/gocryptox509/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"flag"
"fmt"
"io/ioutil"
"os"
"time"

"github.com/davecgh/go-spew/spew"
Expand Down Expand Up @@ -40,9 +39,6 @@ func main() {
}

fmt.Printf("done! succeeded/failed/total %d/%d/%d.\n", success, fail, len(testcases.Testcases))
if fail > 0 {
os.Exit(1)
}
}

func loadTestcases(path string) (testcases LimboSchemaJson, err error) {
Expand Down
8 changes: 3 additions & 5 deletions harness/openssl/Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
CXX = /opt/homebrew/opt/llvm/bin/clang++
CXXFLAGS = -std=c++17
CPPFLAGS = -I /opt/homebrew/opt/openssl@3.1/include
LDFLAGS = -L /opt/homebrew/opt/openssl@3.1/lib
LDLIBS = -l crypto
CPPFLAGS = $(shell pkg-config --cflags libcrypto)
LDFLAGS = $(shell pkg-config --libs libcrypto)

.PHONY: all
all: main

.PHONY: debug
debug: CXXFLAGS += -fsanitize=address,leak,undefined
debug: CXXFLAGS += -g -fsanitize=address,undefined
debug: main

.PHONY: run
Expand Down
28 changes: 28 additions & 0 deletions harness/openssl/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# OpenSSL test harness for x509-limbo

This directory contains a basic test harness for running the x509-testsuite
against OpenSSL.

OpenSSL 1.1, 3.0, and 3.1 should all work.

## Building

On Linux with OpenSSL installed, building should be as simple as:

```bash
# build normally
make

# build with sanitizers, etc.
make debug
```

On macOS, you'll need to tell the build where to find the version of OpenSSL
to use. The easiest way to do that is to use `brew` and `PKG_CONFIG_PATH`, e.g.:

```bash
# install the version of OpenSSL you'd like to test
brew install openssl@3.1

PKG_CONFIG_PATH="$(brew --prefix)/opt/openssl@3.1/lib/pkgconfig" make
```

0 comments on commit 85d9d91

Please sign in to comment.