criu/soccr/test/Makefile
Adrian Reber f1341e3856 soccr/test: fix build and Python 3 compatibility
- Add -I../../include to CFLAGS so common/config.h is found.
- Guard the TCP queue enum in tcp-conn.c with
  #ifndef CONFIG_HAS_TCP_REPAIR, matching soccr.h, to avoid
  redeclaration errors on systems where <netinet/tcp.h> already
  provides these symbols.
- Use libsoccr_release(so) instead of libsoccr_resume(so) for the
  original socket handle whose fd was already closed, fixing a
  Bad file descriptor error from setsockopt.
- Port run.py and tcp-test.py to Python 3: use bytes literals for
  pipe I/O, read from sys.stdin.buffer, and decode pipe output
  before parsing.
- Replace eval() with ast.literal_eval() to avoid code injection
  warnings.
- Clean all test binaries in the clean target, and hook it into
  the top-level make clean/mrproper via clean-top.
- Add soccr/test Python files to the top-level ruff target.

Assisted-by: Claude Code (claude-opus-4-6)
Signed-off-by: Adrian Reber <areber@redhat.com>
2026-07-16 10:50:07 +01:00

28 lines
792 B
Makefile

CFLAGS += -Wall -g -I../../ -I../../include
LDFLAGS += -L../ -lsoccr ../libsoccr.a -lnet
RUN ?= tcp-constructor
run:
./local.sh
tcp-constructor: tcp-constructor.c ../libsoccr.a
$(CC) $(CFLAGS) tcp-constructor.c -o tcp-constructor $(LDFLAGS)
clean:
@rm -f tcp-constructor tcp-conn tcp-conn-v6
tcp-conn: tcp-conn.c
$(CC) $(CFLAGS) tcp-conn.c -o tcp-conn $(LDFLAGS)
tcp-conn-v6: tcp-conn-v6.c
$(CC) $(CFLAGS) -DTEST_IPV6 tcp-conn-v6.c -o tcp-conn-v6 $(LDFLAGS)
# Do not call this target directly. Use "make run" instead, which
# sets up the network namespace that tcp-constructor requires.
test: tcp-constructor tcp-conn tcp-conn-v6
unshare -n sh -c "ip link set up dev lo; ./tcp-conn"
unshare -n sh -c "ip link set up dev lo; ./tcp-conn-v6"
python3 run.py ./$(RUN)
.PHONY: test