Procházet zdrojové kódy

Created a more generic script for testing and added one more test file.

AdrianSimionov před 10 roky
rodič
revize
e9d0cbdcc0

+ 1 - 1
.travis.yml

@@ -8,4 +8,4 @@ before_install:
 script: 
   - ./configure && make && sudo make install
   - cd tests/
-  - ./TEST_0001.sh
+  - ./RunTests.sh

tests/test0001.cm → tests/BaseConfig.cm


tests/test0001.conf → tests/BaseConfig.conf


tests/test0001.txt → tests/BaseConfig.txt


+ 50 - 0
tests/RunTests.sh

@@ -0,0 +1,50 @@
+#!/bin/bash
+
+FILES=*.txt
+DOCSIS=../src/docsis
+KEYFILE=key
+
+for f in $FILES
+do
+  TEST=$(echo $f | cut -f1 -d.)
+  $DOCSIS -e $TEST.txt $KEYFILE $TEST.cm.new
+  if [ ! -f $TEST.cm.new ]; then
+    echo "Test $TEST failed to create CM file on first pass.";
+    exit 1;
+  fi
+  MD5SUM_1=$(md5sum $TEST.cm)
+  MD5SUM_1_array=($MD5SUM_1)
+  MD5SUM_2=$(md5sum $TEST.cm.new)
+  MD5SUM_2_array=($MD5SUM_2)
+  if [ "${MD5SUM_1_array[0]}" != "${MD5SUM_2_array[0]}" ]; then
+    echo "Test $TEST created a wrong CM file on first pass.";
+    exit 1;
+  fi
+  $DOCSIS -d $TEST.cm.new > $TEST.conf.new
+  if [ ! -f $TEST.conf.new ]; then
+    echo "Test $TEST failed to create a conf file on second pass.";
+    exit 1;
+  fi
+  MD5SUM_1=$(md5sum $TEST.conf)
+  MD5SUM_1_array=($MD5SUM_1)
+  MD5SUM_2=$(md5sum $TEST.conf.new)
+  MD5SUM_2_array=($MD5SUM_2)
+  if [ "${MD5SUM_1_array[0]}" != "${MD5SUM_2_array[0]}" ]; then
+    echo "Test $TEST created a wrong CONF file on second pass.";
+    exit 1;
+  fi
+  $DOCSIS -e $TEST.conf.new $KEYFILE $TEST.cm.new
+  if [ ! -f $TEST.cm.new ]; then
+    echo "Test $TEST failed to create CM file on third pass.";
+    exit 1;
+  fi
+  MD5SUM_1=$(md5sum $TEST.cm)
+  MD5SUM_1_array=($MD5SUM_1)
+  MD5SUM_2=$(md5sum $TEST.cm.new)
+  MD5SUM_2_array=($MD5SUM_2)
+  if [ "${MD5SUM_1_array[0]}" != "${MD5SUM_2_array[0]}" ]; then
+    echo "Test $TEST created a wrong CM file on third pass.";
+    exit 1;
+  fi
+  rm $TEST*.new
+done

+ 0 - 58
tests/TEST_0001.sh

@@ -1,58 +0,0 @@
-#!/bin/bash
-
-TEST=test0001
-DOCSIS=../src/docsis
-KEYFILE=../src/keyfile
-
-$DOCSIS -e $TEST.txt $KEYFILE $TEST.cm.new
-
-if [ ! -f $TEST.cm.new ]; then
-    echo "Test $TEST failed to create CM file on first pass.";
-    exit 1;
-fi
-
-MD5SUM_1=$(md5sum $TEST.cm)
-MD5SUM_1_array=($MD5SUM_1)
-MD5SUM_2=$(md5sum $TEST.cm.new)
-MD5SUM_2_array=($MD5SUM_2)
-
-if [ "${MD5SUM_1_array[0]}" != "${MD5SUM_2_array[0]}" ]; then
-    echo "Test $TEST created a wrong CM file on first pass.";
-    exit 1;
-fi
-
-$DOCSIS -d $TEST.cm.new > $TEST.conf.new
-
-if [ ! -f $TEST.conf.new ]; then
-    echo "Test $TEST failed to create a conf file on second pass.";
-    exit 1;
-fi
-
-MD5SUM_1=$(md5sum $TEST.conf)
-MD5SUM_1_array=($MD5SUM_1)
-MD5SUM_2=$(md5sum $TEST.conf.new)
-MD5SUM_2_array=($MD5SUM_2)
-
-if [ "${MD5SUM_1_array[0]}" != "${MD5SUM_2_array[0]}" ]; then
-    echo "Test $TEST created a wrong CONF file on second pass.";
-    exit 1;
-fi
-
-$DOCSIS -e $TEST.conf.new $KEYFILE $TEST.cm.new
-
-if [ ! -f $TEST.cm.new ]; then
-    echo "Test $TEST failed to create CM file on third pass.";
-    exit 1;
-fi
-
-MD5SUM_1=$(md5sum $TEST.cm)
-MD5SUM_1_array=($MD5SUM_1)
-MD5SUM_2=$(md5sum $TEST.cm.new)
-MD5SUM_2_array=($MD5SUM_2)
-
-if [ "${MD5SUM_1_array[0]}" != "${MD5SUM_2_array[0]}" ]; then
-    echo "Test $TEST created a wrong CM file on third pass.";
-    exit 1;
-fi
-
-rm $TEST*.new

binární
tests/TLV_22_43_4.cm


+ 30 - 0
tests/TLV_22_43_4.conf

@@ -0,0 +1,30 @@
+Main 
+{
+	NetworkAccess 1;
+	UsServiceFlow
+	{
+		UsServiceFlowRef 1;
+		QosParamSetType 7;
+	}
+	DsServiceFlow
+	{
+		DsServiceFlowRef 2;
+		QosParamSetType 7;
+	}
+	UsPacketClass
+	{
+		VendorSpecific
+		{
+			VendorIdentifier 0xffffff;
+			CMLoadBalancingPriority 1;
+			CMLoadBalancingGroupID 1;
+			CMRangingClassIDExtension 1;
+		}
+		ClassifierRef 1;
+		ServiceFlowRef 1;
+	}
+	/* CmMic 71a846ff23d830e0e727c61faf855399; */
+	/* CmtsMic 313b9e221df9fb1447ee6e7639d25371; */
+	/*EndOfDataMkr*/
+	/* Pad */
+}

+ 26 - 0
tests/TLV_22_43_4.txt

@@ -0,0 +1,26 @@
+Main 
+{
+NetworkAccess 1;
+UsServiceFlow
+{
+UsServiceFlowRef 1;
+QosParamSetType 7;
+}
+DsServiceFlow
+{
+DsServiceFlowRef 2;
+QosParamSetType 7;
+}
+UsPacketClass
+{
+VendorSpecific
+{
+VendorIdentifier 0xffffff;
+CMLoadBalancingPriority 1;
+CMLoadBalancingGroupID 1;
+CMRangingClassIDExtension 1;
+}
+ClassifierRef 1;
+ServiceFlowRef 1;
+}
+}

+ 1 - 0
tests/key

@@ -0,0 +1 @@
+DOCSIS