make test: fix/disable VAPI tests on centos 99/8599/1
authorKlement Sekera <ksekera@cisco.com>
Fri, 29 Sep 2017 10:36:37 +0000 (12:36 +0200)
committerKlement Sekera <ksekera@cisco.com>
Fri, 29 Sep 2017 10:59:19 +0000 (12:59 +0200)
Workaround old `check' library on centos.
Disable building/running of C++ VAPI test as centos's gcc can't compile
our C++ code (vapi.hpp) due to bug.

Change-Id: If9da9c7f1bc076f7cdfb9bd3016dfe60a08afa36
Signed-off-by: Klement Sekera <ksekera@cisco.com>
Makefile
test/ext/Makefile
test/ext/vapi_c_test.c
test/framework.py
test/test_vapi.py

index aaa6aee..cf77a41 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -82,6 +82,11 @@ RPM_DEPENDS  = redhat-lsb glibc-static java-1.8.0-openjdk-devel yum-utils
 RPM_DEPENDS += apr-devel
 RPM_DEPENDS += numactl-devel
 RPM_DEPENDS += check
+
+ifeq ($(filter centos,$(OS_ID)),$(OS_ID))
+       RPM_DEPENDS += check-devel subunit subunit-devel
+endif
+
 ifeq ($(OS_ID)-$(OS_VERSION_ID),fedora-25)
        RPM_DEPENDS += openssl-devel
        RPM_DEPENDS += python-devel
@@ -339,6 +344,7 @@ define test
          LD_LIBRARY_PATH=$(call libexpand,$(libs),$(2),) \
          EXTENDED_TESTS=$(EXTENDED_TESTS) \
          PYTHON=$(PYTHON) \
+         OS_ID=$(OS_ID) \
          $(3)
 endef
 
index 6b3cb90..6436302 100644 (file)
@@ -2,6 +2,10 @@ BINDIR = $(BR)/vapi_test/
 CBIN = $(addprefix $(BINDIR), vapi_c_test)
 CPPBIN = $(addprefix $(BINDIR), vapi_cpp_test)
 
+ifeq ($(filter centos,$(OS_ID)),$(OS_ID))
+CPPBIN=
+endif
+
 LIBS = -L$(VPP_TEST_BUILD_DIR)/vpp/.libs/ -L$(VPP_TEST_BUILD_DIR)/vpp/vpp-api/vapi/.libs/ -lvppinfra -lvlibmemoryclient -lsvm -lpthread -lcheck -lsubunit -lrt -lm -lvapiclient
 CFLAGS = -std=gnu99 -g -Wall -pthread -I$(WS_ROOT)/src -I$(VPP_TEST_INSTALL_PATH)/vpp/include -I$(BINDIR)
 CPPFLAGS = -std=c++11 -g -Wall -pthread -I$(WS_ROOT)/src -I$(VPP_TEST_INSTALL_PATH)/vpp/include -I$(BINDIR)
index 622b617..ad75ad6 100644 (file)
@@ -40,6 +40,16 @@ static char *api_prefix = NULL;
 static const int max_outstanding_requests = 64;
 static const int response_queue_size = 32;
 
+/* centos has ancient check so we hack our way around here
+ * to make it work somehow */
+#ifndef ck_assert_ptr_eq
+#define ck_assert_ptr_eq(X,Y) ck_assert_int_eq((long)X, (long)Y)
+#endif
+
+#ifndef ck_assert_ptr_ne
+#define ck_assert_ptr_ne(X,Y) ck_assert_int_ne((long)X, (long)Y)
+#endif
+
 START_TEST (test_invalid_values)
 {
   vapi_ctx_t ctx;
@@ -571,7 +581,7 @@ sw_interface_dump_cb (struct vapi_ctx_s *ctx, void *callback_ctx,
     }
   else
     {
-      ck_assert (reply);
+      ck_assert (NULL != reply);
       printf ("Interface dump entry: [%u]: %s\n", reply->sw_if_index,
              reply->interface_name);
       size_t i = 0;
index 008bda3..b658b38 100644 (file)
@@ -92,6 +92,15 @@ def running_extended_tests():
     return False
 
 
+def running_on_centos():
+    try:
+        os_id = os.getenv("OS_ID")
+        return True if "centos" in os_id.lower() else False
+    except:
+        return False
+    return False
+
+
 class KeepAliveReporter(object):
     """
     Singleton object which reports test start to parent process
index d8e1ebe..5f97232 100644 (file)
@@ -8,7 +8,8 @@ import signal
 import subprocess
 from threading import Thread
 from log import single_line_delim
-from framework import VppTestCase, running_extended_tests, VppTestRunner
+from framework import VppTestCase, running_extended_tests, \
+    running_on_centos, VppTestRunner
 
 
 class Worker(Thread):
@@ -73,6 +74,7 @@ class VAPITestCase(VppTestCase):
                 "Timeout! Worker did not finish in %ss" % timeout)
         self.assert_equal(worker.result, 0, "Binary test return code")
 
+    @unittest.skipIf(running_on_centos(), "Centos's gcc can't compile our C++")
     def test_vapi_cpp(self):
         """ run C++ VAPI tests """
         var = "BR"