cleaning up and building lib

This commit is contained in:
Kyle Isom 2020-02-15 08:25:12 -08:00
parent 120b7ad7c8
commit be730b75e2
3 changed files with 29 additions and 24 deletions

View File

@ -2,5 +2,7 @@
ke/ke
kte/kte
.a$
src/srm
src/iniparser-test
srm/srm
libdirutils/dirutils-test
Makefile
libiniparser/iniparser-test

View File

@ -1,9 +1,9 @@
VERSION := 1.1.1
CC := gcc
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} $?

View File

@ -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();