Assert the static memory checks by exit code instead of a pipefail grep that BSD make lacks

pull/598/head
aidan garske 2026-07-22 17:40:40 -07:00
parent 78e628a6cd
commit fd9727cea0
2 changed files with 9 additions and 9 deletions

View File

@ -35,11 +35,13 @@ debug: all
$(CC) -o $@ $< $(CFLAGS) $(LIBS)
clean:
rm -f $(TARGETS)
rm -f $(TARGETS) size.log debug.log
check: SHELL := /bin/bash
check: .SHELLFLAGS := -eo pipefail -c
# Redirect then grep (no pipe) so a nonzero exit fails the recipe on its own and
# it works under BSD make too, where SHELLFLAGS pipefail is unavailable.
check: size-calculation debug-callback-example
./size-calculation | grep -q 'Checking out bucket 4 size of 25...ok'
./debug-callback-example | grep -q 'bucket size used was'
./size-calculation > size.log
grep -q 'Checking out bucket 4 size of 25...ok' size.log
./debug-callback-example > debug.log
grep -q 'bucket size used was' debug.log
@echo "PASS: staticmemory checks"

View File

@ -29,14 +29,12 @@ memory_bucket_optimizer: memory_bucket_optimizer.c
$(CC) $(CFLAGS) -o memory_bucket_optimizer memory_bucket_optimizer.c $(LDFLAGS)
clean:
rm -f memory_bucket_optimizer
rm -f memory_bucket_optimizer mem.log
.PHONY: all clean check
check: SHELL := /bin/bash
check: .SHELLFLAGS := -eo pipefail -c
check: memory_bucket_optimizer
$(MAKE) -C ../.. >/dev/null
../../debug-callback-example > mem.log 2>&1
./memory_bucket_optimizer mem.log | grep -q 'Optimization Summary:'
./memory_bucket_optimizer mem.log
@echo "PASS: staticmemory-bucket-optimizer checks"