# Host test for the parked relay connection (main/hub_park.c).
#
#   nix develop --command sh -c 'cd tests/hub_park && make && ./test_hub_park'
#
# hub_park.c is compiled straight from the firmware source against the host's
# sockets; a socketpair stands in for the board's connection to the relay.

CFLAGS += -O1 -g -std=c11 -D_DEFAULT_SOURCE -Wall -Wextra
SAN ?= -fsanitize=address,undefined -fno-omit-frame-pointer

MAIN = ../../main

SRCS = test_hub_park.c $(MAIN)/hub_park.c

all: test_hub_park

test_hub_park: $(SRCS) $(MAIN)/hub_park.h
	$(CC) $(CFLAGS) $(SAN) -I$(MAIN) -o $@ $(SRCS)

clean:
	rm -f test_hub_park

.PHONY: all clean
