فهرست منبع

tcfgxx0003: check if[n]def error

Victor Seva 5 سال پیش
والد
کامیت
821586dfd2
3فایلهای تغییر یافته به همراه60 افزوده شده و 0 حذف شده
  1. 7 0
      units/tcfgxx0003/README.md
  2. 12 0
      units/tcfgxx0003/kamailio-tcfgxx0003.cfg
  3. 41 0
      units/tcfgxx0003/tcfgxx0003.sh

+ 7 - 0
units/tcfgxx0003/README.md

@@ -0,0 +1,7 @@
+# faulty config - ifdef check Tests #
+
+Summary: faulty config - ifdef check Tests
+
+Following tests are done:
+
+  * run kamailio -c with a faulty config

+ 12 - 0
units/tcfgxx0003/kamailio-tcfgxx0003.cfg

@@ -0,0 +1,12 @@
+#!KAMAILIO
+
+#!define WITH_ME
+
+request_route {
+	drop;
+}
+
+#!ifndef WITH_ME
+request[ME] {
+	exit;
+}

+ 41 - 0
units/tcfgxx0003/tcfgxx0003.sh

@@ -0,0 +1,41 @@
+#!/bin/bash
+
+. ../../etc/config
+. ../../libs/utils
+
+LOG=/tmp/kamailio-tcfgxx0003.log
+
+function check_out() {
+    if ! grep -q 'different number of preprocessor directives' ${LOG} ; then
+        echo "'different number of preprocessor directives' not found on check"
+        exit 1
+    fi
+    echo > ${LOG}
+}
+
+echo "--- run config check"
+${KAMBIN} -c -f ./kamailio-tcfgxx0003.cfg >/dev/null 2>&1
+ret=$?
+if [ "$ret" -eq 0 ] ; then
+    echo "kamailio didn't fail"
+    exit 1
+fi
+${KAMBIN} -c -f ./kamailio-tcfgxx0003.cfg 2>&1 | tee ${LOG}
+check_out
+
+echo
+echo "--- start kamailio -f ./kamailio-tcfgxx0003.cfg"
+${KAMBIN} -P ${KAMPID} -w ${KAMRUN} -Y ${KAMRUN} -a no -ddd -E \
+    -f ./kamailio-tcfgxx0003.cfg >/dev/null 2>&1
+ret=$?
+if [ "$ret" -eq 0 ] ; then
+    sleep 1
+    kill_pidfile ${KAMPID}
+    echo "kamailio didn't fail"
+    exit 1
+fi
+${KAMBIN} -P ${KAMPID} -w ${KAMRUN} -Y ${KAMRUN} -a no -ddd -E \
+    -f ./kamailio-tcfgxx0003.cfg 2>&1 | tee ${LOG}
+check_out
+
+exit 0