]> infiniteadaptability.org Git - seeder/commitdiff
...
authoralex <[email protected]>
Sat, 11 Sep 2021 00:00:30 +0000 (17:00 -0700)
committeralex <[email protected]>
Sat, 11 Sep 2021 00:00:30 +0000 (17:00 -0700)
configure.ac
src/default.c
test/unit/Makefile.am
test/unit/test_utils.c
test/unit/test_utils.h
test/unit/util.filter.tests.c
test/unit/util.filter.tests.h

index ef805bc6525e53da7ecab0747322f64ed771ebc0..096f106aee52e38535259f4137c3097b8817826c 100644 (file)
@@ -33,7 +33,7 @@ AM_CONDITIONAL([HAVE_VALGRIND], [test -n "$VALGRIND"])
 AC_MSG_CHECKING([if debugging])
 if test x$enable_debug != xno; then
        AC_MSG_RESULT(yes)
-       CFLAGS="-ggdb -O0"
+       CFLAGS="-ggdb3 -O0"
 else
        AC_MSG_RESULT(no)
 fi
index 0498a150c6d7df4b3d67981b8dfec0a5708fd6eb..5402fca4a707f5884c9151368396b4d0ae5d54ef 100644 (file)
@@ -38,8 +38,8 @@ static int default_add_all_directories() {
        struct dirent *ent;
        char *p;
        if((dir = opendir(PREFIX))==NULL) {
-               log_err(DEFAULT_MESSAGE_COULD_NOT_OPEN);
-               return -1;
+               log_info(DEFAULT_MESSAGE_COULD_NOT_OPEN);
+               return 0;
        }
 
        while((ent = readdir(dir))!=NULL) {
index 69dc37ddd032e5695b4f9094df2f89935e8e38c7..8c53df34adf79285797fb3a6623aa65941697c3f 100644 (file)
@@ -1,5 +1,5 @@
 AM_CPPFLAGS = \
-       -DPREFIX=\"/tmp/seeder\" \
+       -DPREFIX=\".test\" \
        -Wall \
        -Werror
 
@@ -24,8 +24,21 @@ endif
 common_SOURCES = test_utils.c
 
 common_SOURCES += $(top_srcdir)/src/default.c
+common_SOURCES += $(top_srcdir)/src/file.c
+common_SOURCES += $(top_srcdir)/src/hashmap.c
 common_SOURCES += $(top_srcdir)/src/log.c
+common_SOURCES += $(top_srcdir)/src/session.c
+common_SOURCES += $(top_srcdir)/src/setup.c
+common_SOURCES += $(top_srcdir)/src/torrent.c
+common_SOURCES += $(top_srcdir)/src/tree.c
+common_SOURCES += $(top_srcdir)/src/opt/loglevel.c
 
 util_filter_tests_SOURCES = \
        $(common_SOURCES) \
-       util.filter.tests.c
+       util.filter.tests.c \
+       $(top_srcdir)/src/opt/filter.c \
+       $(top_srcdir)/src/opt/piecel.c \
+       $(top_srcdir)/src/opt/watch.c \
+       $(top_srcdir)/src/opt/worker.c \
+       $(top_srcdir)/src/util/dir.c \
+       $(top_srcdir)/src/util/file.c
index 1f219325307e89d00edb73c99926b47d9562abbb..e068038d5cc46fcfb88da86d5b23d8aaaa283030 100644 (file)
@@ -1,16 +1,35 @@
 #include<test_utils.h>
 
-void clean() {
+void clean_env() {
        system("rm -rf " PREFIX);
 }
 
 void reset_env() {
-       clean();
+       clean_env();
        setup_env();
 }
 
 void setup_env() {
+       clean_env();
+
+       create_test_directory(
+
        assert(setup_session()==1);
        assert(defaults()==1);
        assert(setup_logging()==1);
 }
+
+void create_test_directory(const char *directory) {
+       assert(mkdir(directory,0700)==0);
+}
+
+void create_test_file(const char *filename, const char *contents) {
+       FILE *fp;
+
+       printf("creating %s\n",filename);
+       fp = fopen(filename,"w+");
+       assert(NULL!=fp);
+
+       assert(strlen(contents)==fwrite(contents,sizeof(char),strlen(contents),fp));
+       assert(fclose(fp)==0);
+}
index 762acff602a2c6886ece903876b655d4aac50be6..3976831a778aa9ece576f7c809ea0d3c266ed2b3 100644 (file)
@@ -6,7 +6,7 @@
 #include<default.h>
 #include<setup.h>
 
-void clean();
+void clean_env();
 void reset_env();
 void setup_env();
 
index e06fa6bc8f4833067b00ff6ea5f1fd6af5f59ea5..73f5566c9647aa58af8ddd5dcde2cb2762840079 100644 (file)
@@ -3,7 +3,14 @@
 int main() {
        setup_env();
 
+       file_filter_all_basic_tests();
+
        clean();
 
        return EXIT_FAILURE;
 }
+
+void file_filter_all_basic_tests() {
+       log_info("%s\n",PREFIX);
+       assert(0);
+}
index d6bf96d223779df26d82a82468011b270716b440..ce4993e7321e9001132c4e04eca97640f1ee0727 100644 (file)
@@ -4,5 +4,6 @@
 #include<test_utils.h>
 
 int main();
+void file_filter_all_basic_tests();
 
 #endif