cleaning up and building lib
This commit is contained in:
parent
120b7ad7c8
commit
be730b75e2
|
@ -2,5 +2,7 @@
|
||||||
ke/ke
|
ke/ke
|
||||||
kte/kte
|
kte/kte
|
||||||
.a$
|
.a$
|
||||||
src/srm
|
srm/srm
|
||||||
src/iniparser-test
|
libdirutils/dirutils-test
|
||||||
|
Makefile
|
||||||
|
libiniparser/iniparser-test
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
VERSION := 1.1.1
|
VERSION := 1.1.1
|
||||||
CC := gcc
|
TARGET := libdirutils.a
|
||||||
TARGET := libdirutils.a
|
OBJS := dirutils.o dirlist.o dirwalk.o
|
||||||
OBJS := dirutils.o dirlist.o dirwalk.o
|
HEADERS := kst
|
||||||
HEADERS := kst
|
|
||||||
LIBS :=
|
LIBS :=
|
||||||
|
TEST_LIBS := -L/usr/local/lib -lcunit
|
||||||
|
|
||||||
PREFIX ?= $PREFIX
|
PREFIX ?= $PREFIX
|
||||||
MANDIR ?= $MANDIR
|
MANDIR ?= $MANDIR
|
||||||
|
@ -11,8 +11,7 @@ MANDIR ?= $MANDIR
|
||||||
CFLAGS += -Wall -Wextra -pedantic -Wshadow -Wpointer-arith -Wcast-align
|
CFLAGS += -Wall -Wextra -pedantic -Wshadow -Wpointer-arith -Wcast-align
|
||||||
CFLAGS += -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations
|
CFLAGS += -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations
|
||||||
CFLAGS += -Wnested-externs -Winline -Wno-long-long -Wunused-variable
|
CFLAGS += -Wnested-externs -Winline -Wno-long-long -Wunused-variable
|
||||||
CFLAGS += -Wstrict-prototypes -Werror -std=c99 -L/usr/local/lib
|
CFLAGS += -Wstrict-prototypes -Werror -std=c99 -I. -I/usr/local/include
|
||||||
CFLAGS += -I/usr/local/include
|
|
||||||
CFLAGS += OS_CFLAGS
|
CFLAGS += OS_CFLAGS
|
||||||
|
|
||||||
all: $(TARGET)
|
all: $(TARGET)
|
||||||
|
@ -51,9 +50,8 @@ tags:
|
||||||
|
|
||||||
test: dirutils-test
|
test: dirutils-test
|
||||||
|
|
||||||
TEST_LDFLAGS := -L/usr/local/lib
|
|
||||||
dirutils-test: $(TARGET) dirutils_test.o
|
dirutils-test: $(TARGET) dirutils_test.o
|
||||||
$(CC) -o $@ $(TEST_LDFLAGS) dirutils_test.o $(TARGET)
|
$(CC) -o $@ dirutils_test.o $(TARGET) $(TEST_LIBS)
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
$(CC) -c ${CFLAGS} $?
|
$(CC) -c ${CFLAGS} $?
|
||||||
|
|
|
@ -37,7 +37,7 @@ static int test_touch_file_helper(const char *);
|
||||||
/*
|
/*
|
||||||
* test the use of the exists function
|
* test the use of the exists function
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
test_exists(void)
|
test_exists(void)
|
||||||
{
|
{
|
||||||
char testdir[] = "testdata/testdir";
|
char testdir[] = "testdata/testdir";
|
||||||
|
@ -55,7 +55,7 @@ test_exists(void)
|
||||||
CU_ASSERT(EXISTS_NOENT == ftype);
|
CU_ASSERT(EXISTS_NOENT == ftype);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
test_makedirs(void)
|
test_makedirs(void)
|
||||||
{
|
{
|
||||||
char testpath[] = "testdata/foo/bar/baz\0";
|
char testpath[] = "testdata/foo/bar/baz\0";
|
||||||
|
@ -73,7 +73,7 @@ test_makedirs(void)
|
||||||
system("rm -r testdata/foo/");
|
system("rm -r testdata/foo/");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
test_empty_rmdirs(void)
|
test_empty_rmdirs(void)
|
||||||
{
|
{
|
||||||
char testpath[20] = "testdata/foo";
|
char testpath[20] = "testdata/foo";
|
||||||
|
@ -97,7 +97,7 @@ test_empty_rmdirs(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
static void
|
||||||
test_rmdirs_simple(void)
|
test_rmdirs_simple(void)
|
||||||
{
|
{
|
||||||
char testpath[] = "testdata/foo";
|
char testpath[] = "testdata/foo";
|
||||||
|
@ -124,7 +124,7 @@ test_rmdirs_simple(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
static void
|
||||||
test_dirutils(void)
|
test_dirutils(void)
|
||||||
{
|
{
|
||||||
char testpath[] = "testdata/dirutils";
|
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,
|
* required in this code. init_test is called each time a test is run,
|
||||||
* and cleanup is run after every test.
|
* and cleanup is run after every test.
|
||||||
*/
|
*/
|
||||||
int init_test(void)
|
static int
|
||||||
{
|
init_test(void)
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int cleanup_test(void)
|
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
static int
|
||||||
|
cleanup_test(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* fireball is the code called when adding test fails: cleanup the test
|
* fireball is the code called when adding test fails: cleanup the test
|
||||||
* registry and exit.
|
* registry and exit.
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
fireball(void)
|
fireball(void)
|
||||||
{
|
{
|
||||||
CU_cleanup_registry();
|
CU_cleanup_registry();
|
||||||
|
@ -243,7 +248,7 @@ main(void)
|
||||||
return EXIT_FAILURE;
|
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)
|
if (NULL == tsuite)
|
||||||
fireball();
|
fireball();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue