mirror of git://git.sysmocom.de/ofono
build: Split non-root unit tests to have make check succeed
This commit is contained in:
parent
0c20ee6c53
commit
7f7492669a
|
@ -36,6 +36,7 @@ unit/test-common
|
||||||
unit/test-util
|
unit/test-util
|
||||||
unit/test-idmap
|
unit/test-idmap
|
||||||
unit/test-sms
|
unit/test-sms
|
||||||
|
unit/test-sms-root
|
||||||
unit/test-simutil
|
unit/test-simutil
|
||||||
unit/test-mux
|
unit/test-mux
|
||||||
unit/test-caif
|
unit/test-caif
|
||||||
|
|
|
@ -571,7 +571,11 @@ unit_test_cdmasms_SOURCES = unit/test-cdmasms.c src/cdma-smsutil.c
|
||||||
unit_test_cdmasms_LDADD = @GLIB_LIBS@
|
unit_test_cdmasms_LDADD = @GLIB_LIBS@
|
||||||
unit_objects += $(unit_test_cdmasms_OBJECTS)
|
unit_objects += $(unit_test_cdmasms_OBJECTS)
|
||||||
|
|
||||||
noinst_PROGRAMS = unit/test-mux unit/test-caif
|
noinst_PROGRAMS = unit/test-sms-root unit/test-mux unit/test-caif
|
||||||
|
|
||||||
|
unit_test_sms_root_SOURCES = unit/test-sms.c src/util.c src/smsutil.c src/storage.c
|
||||||
|
unit_test_sms_root_LDADD = @GLIB_LIBS@
|
||||||
|
unit_objects += $(unit_test_sms_root_OBJECTS)
|
||||||
|
|
||||||
unit_test_mux_SOURCES = unit/test-mux.c $(gatchat_sources)
|
unit_test_mux_SOURCES = unit/test-mux.c $(gatchat_sources)
|
||||||
unit_test_mux_LDADD = @GLIB_LIBS@
|
unit_test_mux_LDADD = @GLIB_LIBS@
|
||||||
|
|
|
@ -0,0 +1,97 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* oFono - Open Source Telephony
|
||||||
|
*
|
||||||
|
* Copyright (C) 2008-2010 Intel Corporation. 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 version 2 as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* 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 St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
#include <glib/gprintf.h>
|
||||||
|
|
||||||
|
#include "util.h"
|
||||||
|
#include "smsutil.h"
|
||||||
|
|
||||||
|
static void test_serialize_assembly(void)
|
||||||
|
{
|
||||||
|
unsigned char pdu[176];
|
||||||
|
long pdu_len;
|
||||||
|
struct sms sms;
|
||||||
|
struct sms_assembly *assembly = sms_assembly_new("1234");
|
||||||
|
guint16 ref;
|
||||||
|
guint8 max;
|
||||||
|
guint8 seq;
|
||||||
|
GSList *l;
|
||||||
|
|
||||||
|
decode_hex_own_buf(assembly_pdu1, -1, &pdu_len, 0, pdu);
|
||||||
|
sms_decode(pdu, pdu_len, FALSE, assembly_pdu_len1, &sms);
|
||||||
|
|
||||||
|
sms_extract_concatenation(&sms, &ref, &max, &seq);
|
||||||
|
l = sms_assembly_add_fragment(assembly, &sms, time(NULL),
|
||||||
|
&sms.deliver.oaddr, ref, max, seq);
|
||||||
|
|
||||||
|
if (g_test_verbose()) {
|
||||||
|
g_print("Ref: %u\n", ref);
|
||||||
|
g_print("Max: %u\n", max);
|
||||||
|
g_print("From: %s\n",
|
||||||
|
sms_address_to_string(&sms.deliver.oaddr));
|
||||||
|
}
|
||||||
|
|
||||||
|
g_assert(g_slist_length(assembly->assembly_list) == 1);
|
||||||
|
g_assert(l == NULL);
|
||||||
|
|
||||||
|
decode_hex_own_buf(assembly_pdu2, -1, &pdu_len, 0, pdu);
|
||||||
|
sms_decode(pdu, pdu_len, FALSE, assembly_pdu_len2, &sms);
|
||||||
|
|
||||||
|
sms_extract_concatenation(&sms, &ref, &max, &seq);
|
||||||
|
l = sms_assembly_add_fragment(assembly, &sms, time(NULL),
|
||||||
|
&sms.deliver.oaddr, ref, max, seq);
|
||||||
|
g_assert(l == NULL);
|
||||||
|
|
||||||
|
sms_assembly_free(assembly);
|
||||||
|
|
||||||
|
assembly = sms_assembly_new("1234");
|
||||||
|
|
||||||
|
decode_hex_own_buf(assembly_pdu3, -1, &pdu_len, 0, pdu);
|
||||||
|
sms_decode(pdu, pdu_len, FALSE, assembly_pdu_len3, &sms);
|
||||||
|
|
||||||
|
sms_extract_concatenation(&sms, &ref, &max, &seq);
|
||||||
|
l = sms_assembly_add_fragment(assembly, &sms, time(NULL),
|
||||||
|
&sms.deliver.oaddr, ref, max, seq);
|
||||||
|
|
||||||
|
g_assert(l != NULL);
|
||||||
|
|
||||||
|
sms_assembly_free(assembly);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
g_test_init(&argc, &argv, NULL);
|
||||||
|
|
||||||
|
g_test_add_func("/testsms/Test SMS Assembly Serialize",
|
||||||
|
test_serialize_assembly);
|
||||||
|
|
||||||
|
return g_test_run();
|
||||||
|
}
|
|
@ -1389,58 +1389,6 @@ static void test_cbs_assembly(void)
|
||||||
cbs_assembly_free(assembly);
|
cbs_assembly_free(assembly);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_serialize_assembly(void)
|
|
||||||
{
|
|
||||||
unsigned char pdu[176];
|
|
||||||
long pdu_len;
|
|
||||||
struct sms sms;
|
|
||||||
struct sms_assembly *assembly = sms_assembly_new("1234");
|
|
||||||
guint16 ref;
|
|
||||||
guint8 max;
|
|
||||||
guint8 seq;
|
|
||||||
GSList *l;
|
|
||||||
|
|
||||||
decode_hex_own_buf(assembly_pdu1, -1, &pdu_len, 0, pdu);
|
|
||||||
sms_decode(pdu, pdu_len, FALSE, assembly_pdu_len1, &sms);
|
|
||||||
|
|
||||||
sms_extract_concatenation(&sms, &ref, &max, &seq);
|
|
||||||
l = sms_assembly_add_fragment(assembly, &sms, time(NULL),
|
|
||||||
&sms.deliver.oaddr, ref, max, seq);
|
|
||||||
|
|
||||||
if (g_test_verbose()) {
|
|
||||||
g_print("Ref: %u\n", ref);
|
|
||||||
g_print("Max: %u\n", max);
|
|
||||||
g_print("From: %s\n",
|
|
||||||
sms_address_to_string(&sms.deliver.oaddr));
|
|
||||||
}
|
|
||||||
|
|
||||||
g_assert(g_slist_length(assembly->assembly_list) == 1);
|
|
||||||
g_assert(l == NULL);
|
|
||||||
|
|
||||||
decode_hex_own_buf(assembly_pdu2, -1, &pdu_len, 0, pdu);
|
|
||||||
sms_decode(pdu, pdu_len, FALSE, assembly_pdu_len2, &sms);
|
|
||||||
|
|
||||||
sms_extract_concatenation(&sms, &ref, &max, &seq);
|
|
||||||
l = sms_assembly_add_fragment(assembly, &sms, time(NULL),
|
|
||||||
&sms.deliver.oaddr, ref, max, seq);
|
|
||||||
g_assert(l == NULL);
|
|
||||||
|
|
||||||
sms_assembly_free(assembly);
|
|
||||||
|
|
||||||
assembly = sms_assembly_new("1234");
|
|
||||||
|
|
||||||
decode_hex_own_buf(assembly_pdu3, -1, &pdu_len, 0, pdu);
|
|
||||||
sms_decode(pdu, pdu_len, FALSE, assembly_pdu_len3, &sms);
|
|
||||||
|
|
||||||
sms_extract_concatenation(&sms, &ref, &max, &seq);
|
|
||||||
l = sms_assembly_add_fragment(assembly, &sms, time(NULL),
|
|
||||||
&sms.deliver.oaddr, ref, max, seq);
|
|
||||||
|
|
||||||
g_assert(l != NULL);
|
|
||||||
|
|
||||||
sms_assembly_free(assembly);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *ranges[] = { "1-5, 2, 3, 600, 569-900, 999",
|
static const char *ranges[] = { "1-5, 2, 3, 600, 569-900, 999",
|
||||||
"0-20, 33, 44, 50-60, 20-50, 1-5, 5, 3, 5",
|
"0-20, 33, 44, 50-60, 20-50, 1-5, 5, 3, 5",
|
||||||
NULL };
|
NULL };
|
||||||
|
@ -1731,9 +1679,6 @@ int main(int argc, char **argv)
|
||||||
test_cbs_encode_decode);
|
test_cbs_encode_decode);
|
||||||
g_test_add_func("/testsms/Test CBS Assembly", test_cbs_assembly);
|
g_test_add_func("/testsms/Test CBS Assembly", test_cbs_assembly);
|
||||||
|
|
||||||
g_test_add_func("/testsms/Test SMS Assembly Serialize",
|
|
||||||
test_serialize_assembly);
|
|
||||||
|
|
||||||
g_test_add_func("/testsms/Range minimizer", test_range_minimizer);
|
g_test_add_func("/testsms/Range minimizer", test_range_minimizer);
|
||||||
|
|
||||||
g_test_add_func("/testsms/Status Report Assembly", test_sr_assembly);
|
g_test_add_func("/testsms/Status Report Assembly", test_sr_assembly);
|
||||||
|
|
Loading…
Reference in New Issue