From b9230d1bbb45e61a1c03c5169cce921c2711d0e7 Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Tue, 10 Oct 2017 10:28:56 +0100 Subject: [PATCH] [functional-tests] roll all the C code into a single libft.so --- Makefile.in | 22 ++++++++++++++----- {functional-tests/bcache => ft-lib}/bcache.c | 0 {functional-tests/bcache => ft-lib}/bcache.h | 0 {functional-tests/crc32c => ft-lib}/crc32c.c | 0 .../device-mapper => ft-lib}/dm-ioctl.c | 0 {functional-tests/bcache => ft-lib}/list.h | 0 functional-tests/bcache/block-manager.scm | 2 +- functional-tests/crc32c/checksum.scm | 2 +- functional-tests/device-mapper/ioctl.scm | 2 +- 9 files changed, 19 insertions(+), 9 deletions(-) rename {functional-tests/bcache => ft-lib}/bcache.c (100%) rename {functional-tests/bcache => ft-lib}/bcache.h (100%) rename {functional-tests/crc32c => ft-lib}/crc32c.c (100%) rename {functional-tests/device-mapper => ft-lib}/dm-ioctl.c (100%) rename {functional-tests/bcache => ft-lib}/list.h (100%) diff --git a/Makefile.in b/Makefile.in index 0aa9401..e745739 100644 --- a/Makefile.in +++ b/Makefile.in @@ -22,7 +22,7 @@ PROGRAMS=\ bin/pdata_tools .PHONY: all -all: $(PROGRAMS) +all: $(PROGRAMS) lib/libft.so SOURCE=\ base/output_file_requirements.cc \ @@ -231,7 +231,7 @@ clean: find . -name \*.o -delete find . -name \*.gmo -delete find . -name \*.d -delete - $(RM) $(TEST_PROGRAMS) $(PROGRAMS) $(GMOCK_OBJECTS) lib/*.a + $(RM) $(TEST_PROGRAMS) $(PROGRAMS) $(GMOCK_OBJECTS) lib/*.a lib/*.so distclean: clean $(RM) config.cache config.log config.status configure.h version.h Makefile unit-tests/Makefile @@ -319,12 +319,22 @@ include contrib/Makefile ifeq ("@TESTING@", "yes") include unit-tests/Makefile -.PHONEY: features +LIBFT_SOURCE=\ + ft-lib/bcache.c \ + ft-lib/crc32c.c \ + ft-lib/dm-ioctl.c -features: pdata_tools - cucumber --no-color --format progress +LIBFT_OBJECTS=$(subst .c,.o,$(LIBFT_SOURCE)) -test: features unit-test +lib/libft.so: $(LIBFT_OBJECTS) + gcc -shared -o $@ $+ -laio + +.PHONEY: functional-test unit-test + +functional-test: bin/pdata_tools lib/libft.so + cd functional-tests && ./run-tests run + +test: functional-test unit-test endif -include $(DEPEND_FILES) diff --git a/functional-tests/bcache/bcache.c b/ft-lib/bcache.c similarity index 100% rename from functional-tests/bcache/bcache.c rename to ft-lib/bcache.c diff --git a/functional-tests/bcache/bcache.h b/ft-lib/bcache.h similarity index 100% rename from functional-tests/bcache/bcache.h rename to ft-lib/bcache.h diff --git a/functional-tests/crc32c/crc32c.c b/ft-lib/crc32c.c similarity index 100% rename from functional-tests/crc32c/crc32c.c rename to ft-lib/crc32c.c diff --git a/functional-tests/device-mapper/dm-ioctl.c b/ft-lib/dm-ioctl.c similarity index 100% rename from functional-tests/device-mapper/dm-ioctl.c rename to ft-lib/dm-ioctl.c diff --git a/functional-tests/bcache/list.h b/ft-lib/list.h similarity index 100% rename from functional-tests/bcache/list.h rename to ft-lib/list.h diff --git a/functional-tests/bcache/block-manager.scm b/functional-tests/bcache/block-manager.scm index 7df31cf..2f59d51 100644 --- a/functional-tests/bcache/block-manager.scm +++ b/functional-tests/bcache/block-manager.scm @@ -26,7 +26,7 @@ (srfi s8 receive) (utils)) - (define __ (load-shared-object "./bcache/bcache.so")) + (define __ (load-shared-object "../lib/libft.so")) (define bcache-simple (foreign-procedure "bcache_simple" (string unsigned) ptr)) diff --git a/functional-tests/crc32c/checksum.scm b/functional-tests/crc32c/checksum.scm index dfd4a15..2f64f74 100644 --- a/functional-tests/crc32c/checksum.scm +++ b/functional-tests/crc32c/checksum.scm @@ -5,7 +5,7 @@ (import (chezscheme)) - (define __ (load-shared-object "./crc32c/crc32c.so")) + (define __ (load-shared-object "../lib/libft.so")) (define crc32c (foreign-procedure "crc32c" (unsigned-32 (* unsigned-8) unsigned) unsigned-32))) diff --git a/functional-tests/device-mapper/ioctl.scm b/functional-tests/device-mapper/ioctl.scm index 8093569..24990ac 100644 --- a/functional-tests/device-mapper/ioctl.scm +++ b/functional-tests/device-mapper/ioctl.scm @@ -16,7 +16,7 @@ (srfi s8 receive) (utils)) - (define __ (load-shared-object "./device-mapper/dm-ioctl.so")) + (define __ (load-shared-object "../lib/libft.so")) (define (fail msg) (raise