tests: Add a simple compile test for caa_get_cycles
authorMichael Jeanson <mjeanson@efficios.com>
Fri, 7 May 2021 16:05:38 +0000 (12:05 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 7 May 2021 17:44:24 +0000 (13:44 -0400)
Change-Id: Id2dbaf5f250a5e6e135700dabed5832e75ca7ce9
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
.gitignore
tests/unit/Makefile.am
tests/unit/test_arch.c [new file with mode: 0644]

index be01a127b0ad618f418f93391897a90e099d937c..eeb54653f8a7d55108d5677b2ae6e48039eca1cf 100644 (file)
@@ -2,6 +2,7 @@ tests/api.h
 
 
 tests/unit/urcu-asm.S
+tests/unit/test_arch
 tests/unit/test_uatomic
 tests/unit/test_urcu_multiflavor
 tests/unit/test_urcu_multiflavor_dynlink
index f3ab6709a59df024afbd9f9deabec9499b240f24..ef73127bb3176763970f9071cbae082501aef9f4 100644 (file)
@@ -4,7 +4,9 @@ LOG_DRIVER_FLAGS = --merge --comments
 LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \
        $(top_srcdir)/tests/utils/tap-driver.sh
 
-noinst_PROGRAMS = test_uatomic \
+noinst_PROGRAMS = \
+       test_arch \
+       test_uatomic \
        test_urcu_multiflavor \
        test_urcu_multiflavor_dynlink \
        test_urcu_multiflavor_single_unit \
@@ -23,6 +25,9 @@ URCU_BP_LIB=$(top_builddir)/src/liburcu-bp.la
 URCU_CDS_LIB=$(top_builddir)/src/liburcu-cds.la
 TAP_LIB=$(top_builddir)/tests/utils/libtap.a
 
+test_arch_SOURCES = test_arch.c
+test_arch_LDADD = $(URCU_COMMON_LIB) $(TAP_LIB)
+
 test_uatomic_SOURCES = test_uatomic.c
 test_uatomic_LDADD = $(URCU_COMMON_LIB) $(TAP_LIB)
 
diff --git a/tests/unit/test_arch.c b/tests/unit/test_arch.c
new file mode 100644 (file)
index 0000000..fb447d6
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * test_arch.c
+ *
+ * Userspace RCU library - test arch headers
+ *
+ * Copyright February 2021 Michael Jeanson <mjeanson@efficios.com>
+ *
+ * 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 <urcu/arch.h>
+
+#include "tap.h"
+
+#define NR_TESTS 1
+
+
+/*
+ * This is only to make sure the static inline caa_get_cycles() in the public
+ * headers builds properly.
+ */
+static
+void test_caa_get_cycles(void) {
+       caa_cycles_t cycles = 0;
+
+
+       cycles = caa_get_cycles();
+
+       ok(cycles != 0, "caa_get_cycles works");
+}
+
+int main(void)
+{
+       plan_tests(NR_TESTS);
+
+       test_caa_get_cycles();
+
+       return exit_status();
+}
This page took 0.027531 seconds and 4 git commands to generate.