Skip to content

Commit

Permalink
Add task table tests to the build
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanie committed Nov 2, 2016
1 parent f26c221 commit 989b00e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
4 changes: 3 additions & 1 deletion src/common/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ redis:
hiredis:
git submodule update --init --recursive -- "thirdparty/hiredis" ; cd thirdparty/hiredis ; make

test: hiredis redis $(BUILD)/common_tests $(BUILD)/task_log_tests $(BUILD)/object_table_tests $(BUILD)/db_tests $(BUILD)/io_tests $(BUILD)/task_tests $(BUILD)/redis_tests FORCE
test: hiredis redis $(BUILD)/common_tests $(BUILD)/task_log_tests $(BUILD)/object_table_tests $(BUILD)/db_tests $(BUILD)/io_tests $(BUILD)/task_tests $(BUILD)/redis_tests $(BUILD)/task_table_tests FORCE
./thirdparty/redis-3.2.3/src/redis-server &
sleep 1s
./build/common_tests
Expand All @@ -51,6 +51,7 @@ test: hiredis redis $(BUILD)/common_tests $(BUILD)/task_log_tests $(BUILD)/objec
./build/redis_tests
./build/task_log_tests
./build/object_table_tests
./build/task_table_tests

valgrind: test
valgrind --leak-check=full --error-exitcode=1 ./build/common_tests
Expand All @@ -60,5 +61,6 @@ valgrind: test
valgrind --leak-check=full --error-exitcode=1 ./build/redis_tests
valgrind --leak-check=full --error-exitcode=1 ./build/task_log_tests
valgrind --leak-check=full --error-exitcode=1 ./build/object_table_tests
valgrind --leak-check=full --error-exitcode=1 ./build/task_table_tests

FORCE:
21 changes: 9 additions & 12 deletions src/common/test/task_table_tests.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "greatest.h"

#include "event_loop.h"
#include "example_task.h"
#include "test_common.h"
#include "common.h"
#include "state/task_table.h"
#include "state/redis.h"
Expand Down Expand Up @@ -400,17 +400,14 @@ TEST add_late_test(void) {
}

SUITE(task_table_tests) {
redisContext *context = redisConnect("127.0.0.1", 6379);
freeReplyObject(redisCommand(context, "FLUSHALL"));
RUN_REDIS_TEST(context, lookup_nil_test);
RUN_REDIS_TEST(context, add_lookup_test);
RUN_REDIS_TEST(context, lookup_timeout_test);
RUN_REDIS_TEST(context, add_timeout_test);
RUN_REDIS_TEST(context, lookup_retry_test);
RUN_REDIS_TEST(context, add_retry_test);
RUN_REDIS_TEST(context, lookup_late_test);
RUN_REDIS_TEST(context, add_late_test);
redisFree(context);
RUN_REDIS_TEST(lookup_nil_test);
RUN_REDIS_TEST(add_lookup_test);
RUN_REDIS_TEST(lookup_timeout_test);
RUN_REDIS_TEST(add_timeout_test);
RUN_REDIS_TEST(lookup_retry_test);
RUN_REDIS_TEST(add_retry_test);
RUN_REDIS_TEST(lookup_late_test);
RUN_REDIS_TEST(add_late_test);
}

GREATEST_MAIN_DEFS();
Expand Down

0 comments on commit 989b00e

Please sign in to comment.