Skip to content
Merged
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
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,20 @@ jobs:

- name: Build and run tests
run: make test

sanitize:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5

- name: Install toolchain
run: sudo apt-get update && sudo apt-get install -y clang make

# AddressSanitizer + UndefinedBehaviorSanitizer, with LeakSanitizer
# (bundled into ASan on Linux, on by default) gating memory leaks.
# -fno-sanitize-recover=all makes UBSan findings fail the build.
- name: Build and run tests (ASan + UBSan + LSan)
run: make test CFLAGS="-Wall -Wextra -g -O1 -fno-omit-frame-pointer -fsanitize=address,undefined -fno-sanitize-recover=all"
env:
ASAN_OPTIONS: detect_leaks=1:abort_on_error=1
UBSAN_OPTIONS: print_stacktrace=1
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ a.out
*.dSYM/

# Test binaries
/test_arena
/test_hashtable
/test_string
/test_counter
Expand Down
31 changes: 13 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,9 @@ fmt: $(CLANG_FORMAT)
fmt-check: $(CLANG_FORMAT)
$(CLANG_FORMAT) --dry-run --Werror $(SRC)

.PHONY: test-arena
test-arena: arena.c string.c host_posix.c test_arena.c test_util.h
$(CC) $(CFLAGS) -o test_arena arena.c string.c host_posix.c test_arena.c
./test_arena

.PHONY: test-hashtable
test-hashtable: arena.c string.c host_posix.c hashtable.c test_hashtable.c test_util.h
$(CC) $(CFLAGS) -o test_hashtable arena.c string.c host_posix.c hashtable.c test_hashtable.c
test-hashtable: string.c host_posix.c hashtable.c test_hashtable.c test_util.h
$(CC) $(CFLAGS) -o test_hashtable string.c host_posix.c hashtable.c test_hashtable.c
./test_hashtable

.PHONY: test-string
Expand All @@ -37,28 +32,28 @@ test-string: string.c test_string.c test_util.h
./test_string

.PHONY: test-counter
test-counter: arena.c string.c hashtable.c clientid.c elementid.c uuid.c sha1.c host_posix.c counter.c test_counter.c test_util.h
$(CC) $(CFLAGS) -o test_counter arena.c string.c hashtable.c clientid.c elementid.c uuid.c sha1.c host_posix.c counter.c test_counter.c
test-counter: string.c hashtable.c clientid.c elementid.c uuid.c sha1.c host_posix.c counter.c test_counter.c test_util.h
$(CC) $(CFLAGS) -o test_counter string.c hashtable.c clientid.c elementid.c uuid.c sha1.c host_posix.c counter.c test_counter.c
./test_counter

.PHONY: test-scalar
test-scalar: arena.c string.c host_posix.c scalar.c test_scalar.c test_util.h
$(CC) $(CFLAGS) -o test_scalar arena.c string.c host_posix.c scalar.c test_scalar.c
test-scalar: string.c host_posix.c scalar.c test_scalar.c test_util.h
$(CC) $(CFLAGS) -o test_scalar string.c host_posix.c scalar.c test_scalar.c
./test_scalar

.PHONY: test-register
test-register: arena.c string.c clientid.c elementid.c uuid.c sha1.c host_posix.c stamp.c scalar.c register.c test_register.c test_util.h
$(CC) $(CFLAGS) -o test_register arena.c string.c clientid.c elementid.c uuid.c sha1.c host_posix.c stamp.c scalar.c register.c test_register.c
test-register: string.c clientid.c elementid.c uuid.c sha1.c host_posix.c stamp.c scalar.c register.c test_register.c test_util.h
$(CC) $(CFLAGS) -o test_register string.c clientid.c elementid.c uuid.c sha1.c host_posix.c stamp.c scalar.c register.c test_register.c
./test_register

.PHONY: test-map
test-map: arena.c string.c hashtable.c clientid.c elementid.c uuid.c sha1.c host_posix.c stamp.c scalar.c register.c counter.c element.c map.c test_map.c test_util.h
$(CC) $(CFLAGS) -o test_map arena.c string.c hashtable.c clientid.c elementid.c uuid.c sha1.c host_posix.c stamp.c scalar.c register.c counter.c element.c map.c test_map.c
test-map: string.c hashtable.c clientid.c elementid.c uuid.c sha1.c host_posix.c stamp.c scalar.c register.c counter.c element.c map.c test_map.c test_util.h
$(CC) $(CFLAGS) -o test_map string.c hashtable.c clientid.c elementid.c uuid.c sha1.c host_posix.c stamp.c scalar.c register.c counter.c element.c map.c test_map.c
./test_map

.PHONY: test-element
test-element: arena.c string.c hashtable.c clientid.c elementid.c uuid.c sha1.c host_posix.c stamp.c scalar.c register.c counter.c map.c element.c test_element.c test_util.h
$(CC) $(CFLAGS) -o test_element arena.c string.c hashtable.c clientid.c elementid.c uuid.c sha1.c host_posix.c stamp.c scalar.c register.c counter.c map.c element.c test_element.c
test-element: string.c hashtable.c clientid.c elementid.c uuid.c sha1.c host_posix.c stamp.c scalar.c register.c counter.c map.c element.c test_element.c test_util.h
$(CC) $(CFLAGS) -o test_element string.c hashtable.c clientid.c elementid.c uuid.c sha1.c host_posix.c stamp.c scalar.c register.c counter.c map.c element.c test_element.c
./test_element

.PHONY: test-elementid
Expand Down Expand Up @@ -96,4 +91,4 @@ test-stamp: string.c clientid.c host_posix.c stamp.c test_stamp.c test_util.h
./test_stamp

.PHONY: test
test: test-arena test-hashtable test-string test-counter test-scalar test-register test-clientid test-stamp test-map test-sha1 test-sha1-runtime-endian test-uuid test-elementid test-element
test: test-hashtable test-string test-counter test-scalar test-register test-clientid test-stamp test-map test-sha1 test-sha1-runtime-endian test-uuid test-elementid test-element
159 changes: 0 additions & 159 deletions arena.c

This file was deleted.

38 changes: 0 additions & 38 deletions arena.h

This file was deleted.

Loading