aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/tests
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2009-06-10 05:40:52 +0800
committerHarald Welte <laforge@gnumonks.org>2009-06-10 05:40:52 +0800
commit13e10daa330ea2b699c9aa9d14b3adbd01111fd6 (patch)
treebf9144f9cf625baab472492b3047970cab14ef83 /openbsc/tests
parentf7c43524cfc6e30a0223d3aaff89fe955d6e5146 (diff)
move openbsc into its own subdirectory
Diffstat (limited to 'openbsc/tests')
-rw-r--r--openbsc/tests/Makefile.am1
-rw-r--r--openbsc/tests/db/Makefile.am8
-rw-r--r--openbsc/tests/db/db_test.c106
-rw-r--r--openbsc/tests/debug/Makefile.am4
-rw-r--r--openbsc/tests/debug/debug_test.c34
-rw-r--r--openbsc/tests/gsm0408/Makefile.am5
-rw-r--r--openbsc/tests/gsm0408/gsm0408_test.c72
-rw-r--r--openbsc/tests/sms.txt50
-rw-r--r--openbsc/tests/sms/Makefile.am5
-rw-r--r--openbsc/tests/sms/sms_test.c110
-rw-r--r--openbsc/tests/timer/Makefile.am5
-rw-r--r--openbsc/tests/timer/timer_test.c70
12 files changed, 470 insertions, 0 deletions
diff --git a/openbsc/tests/Makefile.am b/openbsc/tests/Makefile.am
new file mode 100644
index 000000000..2b72c9c11
--- /dev/null
+++ b/openbsc/tests/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = debug timer sms gsm0408 db
diff --git a/openbsc/tests/db/Makefile.am b/openbsc/tests/db/Makefile.am
new file mode 100644
index 000000000..3d9722c50
--- /dev/null
+++ b/openbsc/tests/db/Makefile.am
@@ -0,0 +1,8 @@
+INCLUDES = $(all_includes) -I$(top_srcdir)/include
+AM_CFLAGS=-Wall -ggdb3
+
+noinst_PROGRAMS = db_test
+
+db_test_SOURCES = db_test.c
+db_test_LDADD = $(top_builddir)/src/libbsc.a -ldl -ldbi
+
diff --git a/openbsc/tests/db/db_test.c b/openbsc/tests/db/db_test.c
new file mode 100644
index 000000000..6962aa3bf
--- /dev/null
+++ b/openbsc/tests/db/db_test.c
@@ -0,0 +1,106 @@
+/* (C) 2008 by Jan Luebbe <jluebbe@debian.org>
+ * (C) 2009 by Holger Hans Peter Freyther <zecke@selfish.org>
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#include <openbsc/db.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#define COMPARE(original, copy) \
+ if (original->id != copy->id) \
+ fprintf(stderr, "Ids do not match in %s:%d %llu %llu\n", \
+ __FUNCTION__, __LINE__, original->id, copy->id); \
+ if (original->lac != copy->lac) \
+ fprintf(stderr, "LAC do not match in %s:%d %d %d\n", \
+ __FUNCTION__, __LINE__, original->lac, copy->lac); \
+ if (original->authorized != copy->authorized) \
+ fprintf(stderr, "Authorize do not match in %s:%d %d %d\n", \
+ __FUNCTION__, __LINE__, original->authorized, \
+ copy->authorized); \
+ if (strcmp(original->imsi, copy->imsi) != 0) \
+ fprintf(stderr, "IMSIs do not match in %s:%d '%s' '%s'\n", \
+ __FUNCTION__, __LINE__, original->imsi, copy->imsi); \
+ if (strcmp(original->tmsi, copy->tmsi) != 0) \
+ fprintf(stderr, "TMSIs do not match in %s:%d '%s' '%s'\n", \
+ __FUNCTION__, __LINE__, original->tmsi, copy->tmsi); \
+ if (strcmp(original->name, copy->name) != 0) \
+ fprintf(stderr, "names do not match in %s:%d '%s' '%s'\n", \
+ __FUNCTION__, __LINE__, original->name, copy->name); \
+ if (strcmp(original->extension, copy->extension) != 0) \
+ fprintf(stderr, "names do not match in %s:%d '%s' '%s'\n", \
+ __FUNCTION__, __LINE__, original->extension, copy->extension); \
+
+int main() {
+
+ if (db_init("hlr.sqlite3")) {
+ printf("DB: Failed to init database. Please check the option settings.\n");
+ return 1;
+ }
+ printf("DB: Database initialized.\n");
+
+ if (db_prepare()) {
+ printf("DB: Failed to prepare database.\n");
+ return 1;
+ }
+ printf("DB: Database prepared.\n");
+
+ struct gsm_subscriber *alice = NULL;
+ struct gsm_subscriber *alice_db;
+
+ char *alice_imsi = "3243245432345";
+ alice = db_create_subscriber(alice_imsi);
+ db_sync_subscriber(alice);
+ alice_db = db_get_subscriber(GSM_SUBSCRIBER_IMSI, alice->imsi);
+ COMPARE(alice, alice_db);
+ subscr_put(alice_db);
+ subscr_put(alice);
+
+ alice_imsi = "3693245423445";
+ alice = db_create_subscriber(alice_imsi);
+ db_subscriber_assoc_imei(alice, "1234567890");
+ db_subscriber_alloc_tmsi(alice);
+ alice->lac=42;
+ db_sync_subscriber(alice);
+ alice_db = db_get_subscriber(GSM_SUBSCRIBER_IMSI, alice_imsi);
+ COMPARE(alice, alice_db);
+ subscr_put(alice);
+ subscr_put(alice_db);
+
+ alice_imsi = "9993245423445";
+ alice = db_create_subscriber(alice_imsi);
+ db_subscriber_alloc_tmsi(alice);
+ alice->lac=42;
+ db_sync_subscriber(alice);
+ db_subscriber_assoc_imei(alice, "1234567890");
+ db_subscriber_assoc_imei(alice, "6543560920");
+ alice_db = db_get_subscriber(GSM_SUBSCRIBER_IMSI, alice_imsi);
+ COMPARE(alice, alice_db);
+ subscr_put(alice);
+ subscr_put(alice_db);
+
+ db_fini();
+
+ return 0;
+}
+
+/* stubs */
+void input_event(void) {}
+void nm_state_event(void) {}
diff --git a/openbsc/tests/debug/Makefile.am b/openbsc/tests/debug/Makefile.am
new file mode 100644
index 000000000..0cdf46ad5
--- /dev/null
+++ b/openbsc/tests/debug/Makefile.am
@@ -0,0 +1,4 @@
+INCLUDES = $(all_includes) -I$(top_srcdir)/include
+noinst_PROGRAMS = debug_test
+
+debug_test_SOURCES = debug_test.c $(top_srcdir)/src/debug.c
diff --git a/openbsc/tests/debug/debug_test.c b/openbsc/tests/debug/debug_test.c
new file mode 100644
index 000000000..77ac01532
--- /dev/null
+++ b/openbsc/tests/debug/debug_test.c
@@ -0,0 +1,34 @@
+/* simple test for the debug interface */
+/*
+ * (C) 2008 by Holger Hans Peter Freyther <zecke@selfish.org>
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#include <openbsc/debug.h>
+
+
+int main(int argc, char** argv)
+{
+ debug_parse_category_mask("DRLL");
+ DEBUGP(DCC, "You should not see this\n");
+
+ debug_parse_category_mask("DRLL:DCC");
+ DEBUGP(DRLL, "You should see this\n");
+ DEBUGP(DCC, "You should see this\n");
+ DEBUGP(DMM, "You should not see this\n");
+}
diff --git a/openbsc/tests/gsm0408/Makefile.am b/openbsc/tests/gsm0408/Makefile.am
new file mode 100644
index 000000000..51463dcbf
--- /dev/null
+++ b/openbsc/tests/gsm0408/Makefile.am
@@ -0,0 +1,5 @@
+INCLUDES = $(all_includes) -I$(top_srcdir)/include
+noinst_PROGRAMS = gsm0408_test
+
+gsm0408_test_SOURCES = gsm0408_test.c
+gsm0408_test_LDADD = $(top_builddir)/src/libbsc.a -ldbi
diff --git a/openbsc/tests/gsm0408/gsm0408_test.c b/openbsc/tests/gsm0408/gsm0408_test.c
new file mode 100644
index 000000000..c99766a72
--- /dev/null
+++ b/openbsc/tests/gsm0408/gsm0408_test.c
@@ -0,0 +1,72 @@
+/* simple test for the gsm0408 formatting functions */
+/*
+ * (C) 2008 by Holger Hans Peter Freyther <zecke@selfish.org>
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <openbsc/gsm_04_08.h>
+
+#define COMPARE(result, op, value) \
+ if (!((result) op (value))) {\
+ fprintf(stderr, "Compare failed. Was %x should be %x in %s:%d\n",result, value, __FILE__, __LINE__); \
+ exit(-1); \
+ }
+
+
+/*
+ * Test Location Area Identifier formatting. Table 10.5.3 of 04.08
+ */
+static void test_location_area_identifier(void)
+{
+ struct gsm48_loc_area_id lai48;
+
+ printf("Testing test location area identifier\n");
+
+ /*
+ * Test the default/test setup. Coming from
+ * bsc_hack.c dumps
+ */
+ gsm0408_generate_lai(&lai48, 1, 1, 1);
+ COMPARE(lai48.digits[0], ==, 0x00);
+ COMPARE(lai48.digits[1], ==, 0xF1);
+ COMPARE(lai48.digits[2], ==, 0x10);
+ COMPARE(lai48.lac, ==, htons(0x0001));
+
+ gsm0408_generate_lai(&lai48, 602, 1, 15);
+ COMPARE(lai48.digits[0], ==, 0x06);
+ COMPARE(lai48.digits[1], ==, 0xF2);
+ COMPARE(lai48.digits[2], ==, 0x10);
+ COMPARE(lai48.lac, ==, htons(0x000f));
+}
+
+int main(int argc, char** argv)
+{
+ test_location_area_identifier();
+}
+
+
+
+/*
+ * Stubs to compile and link
+ */
+void input_event(void) {}
+void nm_state_event(void) {}
diff --git a/openbsc/tests/sms.txt b/openbsc/tests/sms.txt
new file mode 100644
index 000000000..06c885b8b
--- /dev/null
+++ b/openbsc/tests/sms.txt
@@ -0,0 +1,50 @@
+03 02 01 0a 02 43 0b 00 1d 39 01 1a 00 01 00 07 91 55 11 18 31 28 00 0e 31 20 04 81 21 43 00 00 ff 04 d4 f2 9c 0e
+
+03 02 01 0a 02 43 0b 00 1d -
+39 - TransactionID 3, SMS messages :: gh->proto_discr
+01 - CP-DATA :: gh->msg_type
+1a - Length: 26 :: gh->data[0]
+00 - MTI 0 RP-DATA (ms->n)
+01 - MR 1
+00 - RP-OA
+07 - RP-DA (SMSC Length)
+91 - International No, Numbering Plan
+55 11 18 31 28 00 - 551181138200
+0e - RP-UD len (14)
+
+TPDU (14 byte):
+31 - MTI(01), VPF(2:relative), MMS(0), SRI(1), UDHI(0), RP(0)
+20 - Message Reference
+04 - DA length
+81 - Numbering Plan, National number
+21 43 - DA 1234
+00 - PID
+00 - DCS
+ff - Validity period
+04 - User Data length (04)
+d4 f2 9c 0e - gsm_default 7bit encoded "Test" (4 byte)
+
+03 02 01 0a 02 43 0b 00 9f 09 01 9c 00 da 00 07 91 88 96 13 00 00 99 90 11 7b 04 81 22 22 00 08 ff 86 6c 38 8c 50 92 80 88 4c 00 4d 00 4d 00 41 6a 19 67 03 74 06 8c a1 7d b2 00 20 00 20 51 68 74 03 99 96 52 75 7d b2 8d ef 6a 19 67 03 ff 0c 6a 19 67 03 96 f6 98 a8 96 aa ff 01 8b 93 60 a8 80 70 66 0e 51 32 84 c4 ff 0c 97 48 6d 3b 62 95 8c c7 ff 01 73 fe 57 28 52 a0 51 65 90 01 96 50 91 cf 59 27 80 6f 76 df 6d 0b 57 fa 96 8a 91 77 5e 63 53 61 ff 0c 8a cb 4e 0a 7d b2 64 1c 5c 0b 30 0c 6a 19 67 03 30 0d
+
+03 02 01 0a 02 43 0b 00 9f - lower levels
+09 - TransactionID 0, SMS messages
+01 - CP-DATA
+9c - Length: (156)
+00 - MTI 0 RP-DATA (ms->n)
+da - MR (?)
+00 - RP-OA
+07 - RP-DA (SMSC Length)
+91 - International No.
+88 96 13 00 00 99
+90 - RP-UD len (144)
+11 -
+7b - Message Reference
+04 - DA length
+81 - Numbering Plan
+22 22 - Address 2222
+00 - PID
+08 - DCS (UCS2 charset)
+ff - Validity period
+86 - User Data length (134)
+6c 38 8c 50 92 80 88 4c 00 4d 00 4d 00 41 6a 19 67 03 74 06 8c a1 7d b2 00 20 00 20 51 68 74 03 99 96 52 75 7d b2 8d ef 6a 19 67 03 ff 0c 6a 19 67 03 96 f6 98 a8 96 aa ff 01 8b 93 60 a8 80 70 66 0e 51 32 84 c4 ff 0c 97 48 6d 3b 62 95 8c c7 ff 01 73 fe 57 28 52 a0 51 65 90 01 96 50 91 cf 59 27 80 6f 76 df 6d 0b 57 fa 96 8a 91 77 5e 63 53 61 ff 0c 8a cb 4e 0a 7d b2 64 1c 5c 0b 30 0c 6a 19 67 03 30 0d
+
diff --git a/openbsc/tests/sms/Makefile.am b/openbsc/tests/sms/Makefile.am
new file mode 100644
index 000000000..23df8717b
--- /dev/null
+++ b/openbsc/tests/sms/Makefile.am
@@ -0,0 +1,5 @@
+INCLUDES = $(all_includes) -I$(top_srcdir)/include
+noinst_PROGRAMS = sms_test
+
+sms_test_SOURCES = sms_test.c
+sms_test_LDADD = $(top_builddir)/src/libbsc.a -ldl -ldbi
diff --git a/openbsc/tests/sms/sms_test.c b/openbsc/tests/sms/sms_test.c
new file mode 100644
index 000000000..dfc43cf70
--- /dev/null
+++ b/openbsc/tests/sms/sms_test.c
@@ -0,0 +1,110 @@
+/*
+ * (C) 2008 by Daniel Willmann <daniel@totalueberwachung.de>
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <openbsc/debug.h>
+#include <openbsc/msgb.h>
+#include <openbsc/gsm_04_11.h>
+#include <openbsc/gsm_04_08.h>
+#include <openbsc/gsm_utils.h>
+
+/* SMS data from MS starting with layer 3 header */
+static u_int8_t sms1[] = {
+ 0x39, 0x01, 0x1a, 0x00, 0x01, 0x00, 0x07, 0x91, 0x55, 0x11,
+ 0x18, 0x31, 0x28, 0x00, 0x0e, 0x31, 0x20, 0x04, 0x81, 0x21,
+ 0x43, 0x00, 0x00, 0xff, 0x04, 0xd4, 0xf2, 0x9c, 0x0e
+};
+
+static u_int8_t sms2[] = {
+ 0x09, 0x01, 0x9c, 0x00, 0xda, 0x00, 0x07, 0x91, 0x88, 0x96, 0x13,
+ 0x00, 0x00, 0x99, 0x90, 0x11, 0x7b, 0x04, 0x81, 0x22, 0x22, 0x00,
+ 0x08, 0xff, 0x86, 0x6c, 0x38, 0x8c, 0x50, 0x92, 0x80, 0x88, 0x4c,
+ 0x00, 0x4d, 0x00, 0x4d, 0x00, 0x41, 0x6a, 0x19, 0x67, 0x03, 0x74,
+ 0x06, 0x8c, 0xa1, 0x7d, 0xb2, 0x00, 0x20, 0x00, 0x20, 0x51, 0x68,
+ 0x74, 0x03, 0x99, 0x96, 0x52, 0x75, 0x7d, 0xb2, 0x8d, 0xef, 0x6a,
+ 0x19, 0x67, 0x03, 0xff, 0x0c, 0x6a, 0x19, 0x67, 0x03, 0x96, 0xf6,
+ 0x98, 0xa8, 0x96, 0xaa, 0xff, 0x01, 0x8b, 0x93, 0x60, 0xa8, 0x80,
+ 0x70, 0x66, 0x0e, 0x51, 0x32, 0x84, 0xc4, 0xff, 0x0c, 0x97, 0x48,
+ 0x6d, 0x3b, 0x62, 0x95, 0x8c, 0xc7, 0xff, 0x01, 0x73, 0xfe, 0x57,
+ 0x28, 0x52, 0xa0, 0x51, 0x65, 0x90, 0x01, 0x96, 0x50, 0x91, 0xcf,
+ 0x59, 0x27, 0x80, 0x6f, 0x76, 0xdf, 0x6d, 0x0b, 0x57, 0xfa, 0x96,
+ 0x8a, 0x91, 0x77, 0x5e, 0x63, 0x53, 0x61, 0xff, 0x0c, 0x8a, 0xcb,
+ 0x4e, 0x0a, 0x7d, 0xb2, 0x64, 0x1c, 0x5c, 0x0b, 0x30, 0x0c, 0x6a,
+ 0x19, 0x67, 0x03, 0x30, 0x0d
+};
+
+struct sms_datum {
+ u_int8_t len;
+ u_int8_t *data;
+};
+
+static struct sms_datum sms_data[] = {
+ {
+ .len = sizeof(sms1),
+ .data = sms1,
+ }, {
+ .len = sizeof(sms2),
+ .data = sms2,
+ }
+};
+
+#define SMS_NUM (sizeof(sms_data)/sizeof(sms_data[0]))
+
+int main(int argc, char** argv)
+{
+ DEBUGP(DSMS, "SMS testing\n");
+ struct msgb *msg;
+ u_int8_t *sms;
+ u_int8_t i;
+
+ /* test 7-bit coding/decoding */
+ const char *input = "test text";
+ u_int8_t length;
+ u_int8_t coded[256];
+ char result[256];
+
+ length = gsm_7bit_encode(coded, input);
+ gsm_7bit_decode(result, coded, length);
+ if (strcmp(result, input) != 0) {
+ printf("7 Bit coding failed... life sucks\n");
+ printf("Wanted: '%s' got '%s'\n", input, result);
+ }
+
+ for(i=0;i<SMS_NUM;i++) {
+ /* Setup SMS msgb */
+ msg = msgb_alloc(sms_data[i].len);
+ sms = msgb_put(msg, sms_data[i].len);
+
+ memcpy(sms, sms_data[i].data, sms_data[i].len);
+ msg->l3h = sms;
+
+ gsm0411_rcv_sms(msg);
+ msgb_free(msg);
+ }
+
+ gsm0411_send_sms(0, 0);
+}
+
+/* stubs */
+void input_event(void) {}
+void nm_state_event(void) {}
diff --git a/openbsc/tests/timer/Makefile.am b/openbsc/tests/timer/Makefile.am
new file mode 100644
index 000000000..9f12d23ac
--- /dev/null
+++ b/openbsc/tests/timer/Makefile.am
@@ -0,0 +1,5 @@
+INCLUDES = $(all_includes) -I$(top_srcdir)/include
+noinst_PROGRAMS = timer_test
+
+timer_test_SOURCES = timer_test.c $(top_srcdir)/src/timer.c $(top_srcdir)/src/select.c
+
diff --git a/openbsc/tests/timer/timer_test.c b/openbsc/tests/timer/timer_test.c
new file mode 100644
index 000000000..26fcbc938
--- /dev/null
+++ b/openbsc/tests/timer/timer_test.c
@@ -0,0 +1,70 @@
+/*
+ * (C) 2008 by Holger Hans Peter Freyther <zecke@selfish.org>
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#include <stdio.h>
+
+#include <openbsc/timer.h>
+#include <openbsc/select.h>
+
+static void timer_fired(unsigned long data);
+
+static struct timer_list timer_one = {
+ .cb = timer_fired,
+ .data = (void*)1,
+};
+
+static struct timer_list timer_two = {
+ .cb = timer_fired,
+ .data = (void*)2,
+};
+
+static struct timer_list timer_three = {
+ .cb = timer_fired,
+ .data = (void*)3,
+};
+
+static void timer_fired(unsigned long data)
+{
+ printf("Fired timer: %lu\n", data);
+
+ if (data == 1) {
+ bsc_schedule_timer(&timer_one, 3, 0);
+ bsc_del_timer(&timer_two);
+ } else if (data == 2) {
+ printf("Should not be fired... bug in del_timer\n");
+ } else if (data == 3) {
+ printf("Timer fired not registering again\n");
+ } else {
+ printf("wtf... wrong data\n");
+ }
+}
+
+int main(int argc, char** argv)
+{
+ printf("Starting... timer\n");
+
+ bsc_schedule_timer(&timer_one, 3, 0);
+ bsc_schedule_timer(&timer_two, 5, 0);
+ bsc_schedule_timer(&timer_three, 4, 0);
+
+ while (1) {
+ bsc_select_main(0);
+ }
+}