test/ffi_test/Makefile - ktap

  1. obj-m += ktap_ffi_test.o

  2. all: funct_mod cparser_test

  3. funct_mod:
  4.     make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

  5. INC=../../include
  6. U_DIR=../../userspace
  7. RUNTIME=../../runtime
  8. U_FFI_DIR=$(U_DIR)/ffi
  9. CPARSER_FILES=cparser.o ctype.o ffi_type.o
  10. KTAPC_CFLAGS = -Wall -O2

  11. cparser.o: $(U_FFI_DIR)/cparser.c $(INC)/*
  12.     $(QUIET_CC)$(CC) -DCONFIG_KTAP_FFI -o $@ -c $<

  13. ctype.o: $(U_FFI_DIR)/ctype.c $(INC)/*
  14.     $(QUIET_CC)$(CC) -DCONFIG_KTAP_FFI -o $@ -c $<

  15. ffi_type.o: $(RUNTIME)/ffi/ffi_type.c $(INC)/*
  16.     $(QUIET_CC)$(CC) -DCONFIG_KTAP_FFI -o $@ -c $<

  17. cparser_test: cparser_test.c $(CPARSER_FILES) $(INC)/*
  18.     $(QUIET_CC)$(CC) -DCONFIG_KTAP_FFI -I$(INC) -I$(U_DIR) $(KTAPC_CFLAGS) \
  19.         -o $@ $< $(CPARSER_FILES)

  20. load:
  21.     insmod ktap_ffi_test.ko

  22. unload:
  23.     rmmod ktap_ffi_test

  24. test: all
  25.     @echo "testing cparser:"
  26.     ./cparser_test
  27.     @echo "testing ffi module:"
  28.     rmmod ktap_ffi_test > /dev/null 2>&1 || true
  29.     insmod ktap_ffi_test.ko
  30.     ../../ktap ffi_test.kp
  31.     rmmod ktap_ffi_test.ko
  32.     @echo "[*] all ffi tests passed."

  33. clean:
  34.     make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
  35.     rm -rf cparser_test