From be730b75e2dfa9d33cc43c54207bb4f364b83dd3 Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Sat, 15 Feb 2020 08:25:12 -0800 Subject: [PATCH] cleaning up and building lib --- .hgignore | 6 ++++-- libdirutils/Makefile.in | 16 +++++++--------- libdirutils/dirutils_test.c | 31 ++++++++++++++++++------------- 3 files changed, 29 insertions(+), 24 deletions(-) diff --git a/.hgignore b/.hgignore index 9c694bf..8ad9223 100644 --- a/.hgignore +++ b/.hgignore @@ -2,5 +2,7 @@ ke/ke kte/kte .a$ -src/srm -src/iniparser-test +srm/srm +libdirutils/dirutils-test +Makefile +libiniparser/iniparser-test diff --git a/libdirutils/Makefile.in b/libdirutils/Makefile.in index 6924842..b9c4266 100644 --- a/libdirutils/Makefile.in +++ b/libdirutils/Makefile.in @@ -1,9 +1,9 @@ -VERSION := 1.1.1 -CC := gcc -TARGET := libdirutils.a -OBJS := dirutils.o dirlist.o dirwalk.o -HEADERS := kst +VERSION := 1.1.1 +TARGET := libdirutils.a +OBJS := dirutils.o dirlist.o dirwalk.o +HEADERS := kst LIBS := +TEST_LIBS := -L/usr/local/lib -lcunit PREFIX ?= $PREFIX MANDIR ?= $MANDIR @@ -11,8 +11,7 @@ MANDIR ?= $MANDIR CFLAGS += -Wall -Wextra -pedantic -Wshadow -Wpointer-arith -Wcast-align CFLAGS += -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations CFLAGS += -Wnested-externs -Winline -Wno-long-long -Wunused-variable -CFLAGS += -Wstrict-prototypes -Werror -std=c99 -L/usr/local/lib -CFLAGS += -I/usr/local/include +CFLAGS += -Wstrict-prototypes -Werror -std=c99 -I. -I/usr/local/include CFLAGS += OS_CFLAGS all: $(TARGET) @@ -51,9 +50,8 @@ tags: test: dirutils-test -TEST_LDFLAGS := -L/usr/local/lib dirutils-test: $(TARGET) dirutils_test.o - $(CC) -o $@ $(TEST_LDFLAGS) dirutils_test.o $(TARGET) + $(CC) -o $@ dirutils_test.o $(TARGET) $(TEST_LIBS) .c.o: $(CC) -c ${CFLAGS} $? diff --git a/libdirutils/dirutils_test.c b/libdirutils/dirutils_test.c index db081a9..8ec6645 100644 --- a/libdirutils/dirutils_test.c +++ b/libdirutils/dirutils_test.c @@ -37,7 +37,7 @@ static int test_touch_file_helper(const char *); /* * test the use of the exists function */ -void +static void test_exists(void) { char testdir[] = "testdata/testdir"; @@ -55,7 +55,7 @@ test_exists(void) CU_ASSERT(EXISTS_NOENT == ftype); } -void +static void test_makedirs(void) { char testpath[] = "testdata/foo/bar/baz\0"; @@ -73,7 +73,7 @@ test_makedirs(void) system("rm -r testdata/foo/"); } -void +static void test_empty_rmdirs(void) { char testpath[20] = "testdata/foo"; @@ -97,7 +97,7 @@ test_empty_rmdirs(void) } -void +static void test_rmdirs_simple(void) { char testpath[] = "testdata/foo"; @@ -124,7 +124,7 @@ test_rmdirs_simple(void) } -void +static void test_dirutils(void) { char testpath[] = "testdata/dirutils"; @@ -203,22 +203,27 @@ test_touch_file_helper(const char *path) * required in this code. init_test is called each time a test is run, * and cleanup is run after every test. */ -int init_test(void) -{ - return 0; -} - -int cleanup_test(void) +static int +init_test(void) { return 0; } +/* +static int +cleanup_test(void) +{ + return 0; +} +*/ + + /* * fireball is the code called when adding test fails: cleanup the test * registry and exit. */ -void +static void fireball(void) { CU_cleanup_registry(); @@ -243,7 +248,7 @@ main(void) return EXIT_FAILURE; } - tsuite = CU_add_suite("dirutils_test", init_test, cleanup_test); + tsuite = CU_add_suite("dirutils_test", init_test, NULL); if (NULL == tsuite) fireball();