@@ -1,4 +1,5 @@
*.o
+*.pyc
Makefile
libpseudo.so
pseudo_wrapfuncs.*
@@ -14,3 +15,5 @@ pseudo_ports.h
templatefile.pyc
func_deps.mk
port_deps.mk
+test/test-*
+!test/test-*.*
@@ -55,6 +55,7 @@ GUTS=$(filter-out "$(GLOB_PATTERN)",$(wildcard $(GLOB_PATTERN)))
SOURCES=$(wildcard *.c)
OBJS=$(subst .c,.o,$(SOURCES))
+TESTS=$(patsubst %.c,%,$(wildcard test/*.c))
SHOBJS=pseudo_tables.o pseudo_util.o
DBOBJS=pseudo_db.o
@@ -74,13 +75,11 @@ TABLES=table_templates/pseudo_tables.c table_templates/pseudo_tables.h
all: $(LIBPSEUDO) $(PSEUDO) $(PSEUDODB) $(PSEUDOLOG) $(PSEUDO_PROFILE)
-test: all | $(BIN) $(LIB) $(LOCALSTATE)
- $(CC) $(CFLAGS) $(CFLAGS_PSEUDO) -o test/test-rename-fstat test/test-rename-fstat.c
- $(CC) $(CFLAGS) $(CFLAGS_PSEUDO) -o test/test-openat test/test-openat.c
- $(CC) $(CFLAGS) $(CFLAGS_PSEUDO) -o test/test-statx test/test-statx.c
- $(CC) $(CFLAGS) $(CFLAGS_PSEUDO) -o test/test-fstat test/test-fstat.c
- $(CC) $(CFLAGS) $(CFLAGS_PSEUDO) -o test/test-fcntl test/test-fcntl.c
- @./run_tests.sh -v
+test: all $(TESTS) | $(BIN) $(LIB)
+ ./run_tests.sh -v
+
+test/%: test/%.c
+ $(CC) $(CFLAGS) $(CFLAGS_PSEUDO) -o $@ $<
install-lib: $(LIBPSEUDO)
mkdir -p $(DESTDIR)$(LIBDIR)
@@ -96,7 +95,7 @@ install-data:
install: all install-lib install-bin install-data
-$(BIN) $(LIB) $(LOCALSTATE):
+$(BIN) $(LIB):
mkdir -p $@
pseudo: $(PSEUDO)
@@ -170,7 +169,8 @@ pseudo_profile: Makefile pseudo_profile.c tables wrappers
$(CC) $(CFLAGS) $(CFLAGS_PSEUDO) -o pseudo_profile pseudo_profile.c
clean:
- rm -f *.o *.so $(PSEUDO) $(PSEUDODB) $(PSEUDOLOG) \
+ rm -f *.o $(LIBPSEUDO) $(PSEUDO) $(PSEUDODB) $(PSEUDOLOG) \
+ $(TESTS) \
pseudo_wrapfuncs.h pseudo_wrapfuncs.c \
pseudo_wrapper_table.c \
pseudo_tables.c pseudo_tables.h \
@@ -181,8 +181,8 @@ clean:
touch port_deps.mk func_deps.mk
distclean: clean
- rm -f Makefile
- rm -rf ./$(BIN) ./$(LIB) ./$(LOCALSTATE)
+ rm -f Makefile port_deps.mk func_deps.mk
+ rm -rf ./$(BIN) ./$(LIB) ./$(LOCALSTATE) ./__pycache__
@echo "WARNING: Makefile has been removed. You must reconfigure to do anything else."
nuke: distclean
@@ -35,3 +35,4 @@ case $(mode b) in
*) exit 1;;
esac
+rm a b
- "make test" did not build "test/test-chroot-symlink", so the test failed - "make clean" did not delete libpseudo.so correctly - "test/test-umask.sh" did not clean up its test files - build test binaries only if needed, and delete them in "make clean" - remove var/pseudo from Makefile (run_tests.sh makes it anyway) - add *.pyc and test binaries (no file extension) to .gitignore - delete more things in "make distclean" Signed-off-by: Tomi Belan <tomi.belan@gmail.com> --- Here is my fourth patch for 'pseudo'. It is a bunch of developer experience improvements. It does not affect pseudo and libpseudo itself. It could be split into smaller commits, but I thought this would be easier to send and to review. Now "git status" doesn't show any untracked files, and "make distclean" deletes everything listed by "git ls-files -o", with one exception: there is still a generated file named "ports/linux/guts/prctl.c". I didn't know what to do with it and why it isn't committed in Git, so I left it alone. .gitignore | 3 +++ Makefile.in | 22 +++++++++++----------- test/test-umask.sh | 1 + 3 files changed, 15 insertions(+), 11 deletions(-)