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
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) {
AM_CPPFLAGS = \
- -DPREFIX=\"/tmp/seeder\" \
+ -DPREFIX=\".test\" \
-Wall \
-Werror
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
#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);
+}
#include<default.h>
#include<setup.h>
-void clean();
+void clean_env();
void reset_env();
void setup_env();
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);
+}
#include<test_utils.h>
int main();
+void file_filter_all_basic_tests();
#endif