[PATCH] libosmocore[master]: Embedded: add sercomm stubs

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Thu Jan 18 16:21:01 UTC 2018


Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/5873

to look at the new patch set (#2).

Embedded: add sercomm stubs

The sercomm functions are unavailable in case of embedded build. Add
stub and link the tests against it.

Change-Id: I9bc5cb2f822b1a3ffdc6ec29f46b6bac8288314e
---
M .gitignore
M configure.ac
M tests/Makefile.am
A tests/libsercomstub.c
M tests/sercomm/sercomm_test.c
5 files changed, 15 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/73/5873/2

diff --git a/.gitignore b/.gitignore
index 657120d..db17535 100644
--- a/.gitignore
+++ b/.gitignore
@@ -90,3 +90,4 @@
 
 # vi files
 *.sw?
+/tests/libsercomstub.a
diff --git a/configure.ac b/configure.ac
index 3c15896..60c177f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -238,6 +238,7 @@
 	[embedded=$enableval], [embedded="no"])
 
 AM_CONDITIONAL(ENABLE_STATS_TEST, true)
+AM_CONDITIONAL(ENABLE_SERCOM_STUB, false)
 
 if test x"$embedded" = x"yes"
 then
@@ -253,6 +254,7 @@
 	AM_CONDITIONAL(ENABLE_GNUTLS, false)
 	AM_CONDITIONAL(ENABLE_PCSC, false)
 	AM_CONDITIONAL(ENABLE_PSEUDOTALLOC, true)
+	AM_CONDITIONAL(ENABLE_SERCOM_STUB, true)
 	AM_CONDITIONAL(ENABLE_STATS_TEST, false)
 	AC_DEFINE([USE_GNUTLS], [0])
 	AC_DEFINE([PANIC_INFLOOP],[1],[Use infinite loop on panic rather than fprintf/abort])
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e199ccc..5dd8e22 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -3,6 +3,11 @@
 AM_LDFLAGS =
 LDADD = $(top_builddir)/src/libosmocore.la $(TALLOC_LIBS)
 
+if ENABLE_SERCOM_STUB
+noinst_LIBRARIES = libsercomstub.a
+LDADD += $(top_builddir)/tests/libsercomstub.a
+endif
+
 check_PROGRAMS = timer/timer_test sms/sms_test ussd/ussd_test		\
                  smscb/smscb_test bits/bitrev_test a5/a5_test		\
                  conv/conv_test auth/milenage_test lapd/lapd_test	\
@@ -55,10 +60,10 @@
 stats_stats_test_LDADD = $(LDADD) $(top_builddir)/src/gsm/libosmogsm.la
 
 a5_a5_test_SOURCES = a5/a5_test.c
-a5_a5_test_LDADD = $(top_builddir)/src/gsm/libgsmint.la
+a5_a5_test_LDADD = $(LDADD) $(top_builddir)/src/gsm/libgsmint.la
 
 kasumi_kasumi_test_SOURCES = kasumi/kasumi_test.c
-kasumi_kasumi_test_LDADD = $(top_builddir)/src/gsm/libgsmint.la
+kasumi_kasumi_test_LDADD = $(LDADD) $(top_builddir)/src/gsm/libgsmint.la
 
 comp128_comp128_test_SOURCES = comp128/comp128_test.c
 comp128_comp128_test_LDADD = $(LDADD) $(top_builddir)/src/gsm/libosmogsm.la
@@ -84,10 +89,10 @@
 bits_bitfield_test_SOURCES = bits/bitfield_test.c
 
 conv_conv_test_SOURCES = conv/conv_test.c conv/conv.c
-conv_conv_test_LDADD = $(top_builddir)/src/gsm/libgsmint.la
+conv_conv_test_LDADD = $(LDADD) $(top_builddir)/src/gsm/libgsmint.la
 
 conv_conv_gsm0503_test_SOURCES = conv/conv_gsm0503_test.c conv/conv.c conv/gsm0503_test_vectors.c
-conv_conv_gsm0503_test_LDADD = $(top_builddir)/src/gsm/libgsmint.la
+conv_conv_gsm0503_test_LDADD = $(LDADD) $(top_builddir)/src/gsm/libgsmint.la
 conv_conv_gsm0503_test_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/tests/conv
 
 gsm0808_gsm0808_test_SOURCES = gsm0808/gsm0808_test.c
diff --git a/tests/libsercomstub.c b/tests/libsercomstub.c
new file mode 100644
index 0000000..99662d0
--- /dev/null
+++ b/tests/libsercomstub.c
@@ -0,0 +1,3 @@
+/* Stubs for embedded build */
+void sercomm_drv_lock(unsigned long __attribute__((unused)) *flags) {}
+void sercomm_drv_unlock(unsigned long __attribute__((unused)) *flags) {}
diff --git a/tests/sercomm/sercomm_test.c b/tests/sercomm/sercomm_test.c
index 4a40f62..058c9eb 100644
--- a/tests/sercomm/sercomm_test.c
+++ b/tests/sercomm/sercomm_test.c
@@ -27,10 +27,6 @@
 
 struct osmo_sercomm_inst g_osi;
 
-/* Locking details are not checked by this test anyway */
-void sercomm_drv_lock(unsigned long __attribute__((unused)) *flags) {}
-void sercomm_drv_unlock(unsigned long __attribute__((unused)) *flags) {}
-
 static const uint8_t valid_dlci3[] = { 0x7E, 3, 0x03, 'f', 'o', 'o', 0x7E };
 static const uint8_t valid_dlci23[] = { 0x7E, 23, 0x03, '2', '3', 0x7E };
 static const uint8_t valid_dlci23esc[] = { 0x7E, 23, 0x03, 0x7D, '2' ^ (1 << 5), '3', 0x7E };

-- 
To view, visit https://gerrit.osmocom.org/5873
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I9bc5cb2f822b1a3ffdc6ec29f46b6bac8288314e
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list