From c30d675e38ba7f9d586bbcafa9a25e50b69cf523 Mon Sep 17 00:00:00 2001 From: David Garske Date: Thu, 13 Aug 2020 13:02:59 -0700 Subject: [PATCH] Fix for building on Mac. Added README.md. --- tools/unit-tests/Makefile | 8 +++++++- tools/unit-tests/README.md | 22 ++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 tools/unit-tests/README.md diff --git a/tools/unit-tests/Makefile b/tools/unit-tests/Makefile index 405e53c6..74fcc985 100644 --- a/tools/unit-tests/Makefile +++ b/tools/unit-tests/Makefile @@ -1,4 +1,10 @@ -LDFLAGS=-lcheck -lm -pthread -lrt -lsubunit +LDFLAGS=-lcheck -lm -pthread + +UNAME_S := $(shell uname -s) +ifneq ($(UNAME_S),Darwin) + LDFLAGS+=-lrt -lsubunit +endif + CFLAGS=-I../../src -I../../include all: unit-parser diff --git a/tools/unit-tests/README.md b/tools/unit-tests/README.md new file mode 100644 index 00000000..6578e0b1 --- /dev/null +++ b/tools/unit-tests/README.md @@ -0,0 +1,22 @@ +# Unit Test Tools + +This uses the "check" unit test framework for C. + +You may need to run "apt install check", "yum install check" or "brew install check". + +## Building + +Use `make` to build. + +## Expected output + +```sh +$ ./unit-parser +Running suite(s): wolfBoot +Explicit end of options reached +This field is too large (bigger than the space available in the current header) +This field is too large and would overflow the image header +Illegal address (too high) +Illegal address (too high) +100%: Checks: 2, Failures: 0, Errors: 0 +```