diff options
author | Timo Dritschler <timo.dritschler@kit.edu> | 2015-03-09 16:42:34 +0100 |
---|---|---|
committer | Timo Dritschler <timo.dritschler@kit.edu> | 2015-03-09 17:35:40 +0100 |
commit | 3f65e7bc3386d1a761fc33683c005181184fd8e4 (patch) | |
tree | 6925a2e3ce12e02d0862b4bb57203bb07ee5d27f /test | |
parent | 138cf0430005193de7777ebf72328f819876e775 (diff) | |
download | kiro-3f65e7bc3386d1a761fc33683c005181184fd8e4.tar.gz kiro-3f65e7bc3386d1a761fc33683c005181184fd8e4.tar.bz2 kiro-3f65e7bc3386d1a761fc33683c005181184fd8e4.tar.xz kiro-3f65e7bc3386d1a761fc33683c005181184fd8e4.zip |
Added kiro-test-partial tool for kiro_sync_partial testing
Changed KiroSbSyncCallbacks to pass generic void* userdata instead of KiroSb*
Diffstat (limited to 'test')
-rw-r--r-- | test/CMakeLists.txt | 2 | ||||
-rw-r--r-- | test/test-partial.c | 48 | ||||
-rw-r--r-- | test/test-server.c | 1 |
3 files changed, 51 insertions, 0 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 35b0531..4ae047b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -18,6 +18,8 @@ add_executable(kiro-test-bandwidth test-client-bandwidth.c) target_link_libraries(kiro-test-bandwidth kiro gobject-2.0 glib-2.0) add_executable(kiro-server test-server.c) target_link_libraries(kiro-server kiro gobject-2.0 glib-2.0) +add_executable(kiro-test-partial test-partial.c) +target_link_libraries(kiro-test-partial kiro gobject-2.0 glib-2.0) install(TARGETS kiro-test-bandwidth kiro-test-latency kiro-server RUNTIME DESTINATION ${KIRO_BINDIR}) diff --git a/test/test-partial.c b/test/test-partial.c new file mode 100644 index 0000000..62b91ad --- /dev/null +++ b/test/test-partial.c @@ -0,0 +1,48 @@ +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <assert.h> +#include "kiro-trb.h" +#include "kiro-sb.h" + + +int count = 0; + + +KiroContinueFlag +callback (KiroSb *sb) { + (void)sb; + g_message ("Got new element"); + count++; + return KIRO_CALLBACK_CONTINUE; +} + +int +main ( int argc, char *argv[] ) +{ + if (argc < 3) { + printf ("Not enough aruments. Usage: kiro-test-bandwidth <address> <port>\n"); + return -1; + } + + + KiroSb *ksb = kiro_sb_new (); + kiro_sb_clone (ksb, argv[1], argv[2]); + unsigned long int callback_id = kiro_sb_add_sync_callback (ksb, (KiroSbSyncCallbackFunc)callback, ksb); + + while (count < 3) {} + kiro_sb_remove_sync_callback (ksb, callback_id); + + while (count < 6) { + kiro_sb_get_data_blocking (ksb); + g_message ("Got new element"); + count++; + } + + kiro_sb_free (ksb); + + return 0; +} + + + diff --git a/test/test-server.c b/test/test-server.c index 87ff5d0..7d34384 100644 --- a/test/test-server.c +++ b/test/test-server.c @@ -178,6 +178,7 @@ main (void) gchar *buffer = NULL; while (1) { + sleep (1); buffer = kiro_trb_dma_push (rb); print_current_frame (buffer, frame, 512, 512, rand); frame++; |