Skip to content

Commit fd9727c

Browse files
committed
Assert the static memory checks by exit code instead of a pipefail grep that BSD make lacks
1 parent 78e628a commit fd9727c

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

staticmemory/Makefile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@ debug: all
3535
$(CC) -o $@ $< $(CFLAGS) $(LIBS)
3636

3737
clean:
38-
rm -f $(TARGETS)
38+
rm -f $(TARGETS) size.log debug.log
3939

40-
check: SHELL := /bin/bash
41-
check: .SHELLFLAGS := -eo pipefail -c
40+
# Redirect then grep (no pipe) so a nonzero exit fails the recipe on its own and
41+
# it works under BSD make too, where SHELLFLAGS pipefail is unavailable.
4242
check: size-calculation debug-callback-example
43-
./size-calculation | grep -q 'Checking out bucket 4 size of 25...ok'
44-
./debug-callback-example | grep -q 'bucket size used was'
43+
./size-calculation > size.log
44+
grep -q 'Checking out bucket 4 size of 25...ok' size.log
45+
./debug-callback-example > debug.log
46+
grep -q 'bucket size used was' debug.log
4547
@echo "PASS: staticmemory checks"

staticmemory/memory-bucket-optimizer/optimizer/Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,12 @@ memory_bucket_optimizer: memory_bucket_optimizer.c
2929
$(CC) $(CFLAGS) -o memory_bucket_optimizer memory_bucket_optimizer.c $(LDFLAGS)
3030

3131
clean:
32-
rm -f memory_bucket_optimizer
32+
rm -f memory_bucket_optimizer mem.log
3333

3434
.PHONY: all clean check
3535

36-
check: SHELL := /bin/bash
37-
check: .SHELLFLAGS := -eo pipefail -c
3836
check: memory_bucket_optimizer
3937
$(MAKE) -C ../.. >/dev/null
4038
../../debug-callback-example > mem.log 2>&1
41-
./memory_bucket_optimizer mem.log | grep -q 'Optimization Summary:'
39+
./memory_bucket_optimizer mem.log
4240
@echo "PASS: staticmemory-bucket-optimizer checks"

0 commit comments

Comments
 (0)