make sure the test data exists, I guess

This commit is contained in:
Kyle Isom 2025-05-01 23:22:51 -07:00
parent 95cd22613f
commit d13176070f
3 changed files with 13 additions and 2 deletions

View File

@ -4,7 +4,7 @@ MANPAGE := libdirutils.3
OBJS := dirutils.o dirlist.o dirwalk.o
HEADERS := kst
LIBS :=
TEST_LIBS := -L/usr/local/lib -lcunit
TEST_LIBS := -L/usr/local/lib OS_TEST_LIBS -lcunit
PREFIX ?= $PREFIX
MANDIR ?= $MANDIR

View File

@ -13,6 +13,9 @@ OPSYS=$(uname -s)
echo "Configuring for ${OPSYS}..."
if [ "x${OPSYS}" = "xLinux" ]; then
OS_CFLAGS="-D_DEFAULT_SOURCE -D_POSIX_SOURCE -D_XOPEN_SOURCE"
elif [ "x${OPSYS}" = "xDarwin" ]; then
OS_CFLAGS="-I/opt/homebrew/include"
OS_TEST_LIBS="-L/opt/homebrew/lib"
else
OS_CFLAGS=""
fi
@ -43,7 +46,8 @@ echo "prefix: ${PREFIX}"
echo "mandir: ${MANDIR}"
echo "writing new Makefile"
cat Makefile.in | sed -e "s|OS_CFLAGS|${OS_CFLAGS}|" | \
cat Makefile.in | sed -e "s|OS_CFLAGS|${OS_CFLAGS}|" | \
sed -e "s|OS_TEST_LIBS|${OS_TEST_LIBS}|" | \
sed -e "s|\$PREFIX|${PREFIX}|" | \
sed -e "s|\$MANDIR|${MANDIR}|" > Makefile

View File

@ -46,6 +46,10 @@ test_exists(void)
char testnot[] = "testdata/nosuchfile";
EXISTS_STATUS ftype;
system("mkdir -p testdata/testdir");
system("touch testdata/testfile");
ftype = path_exists(testdir);
CU_ASSERT(EXISTS_DIR == ftype);
@ -54,6 +58,9 @@ test_exists(void)
ftype = path_exists(testnot);
CU_ASSERT(EXISTS_NOENT == ftype);
system("rm -r testdata/testdir");
system("rm testdata/testfile");
}
static void