Skip to contentSkip to conversation

cross_compilation: Add test cases for commands of cross_compilation.

PATCH Superseded Wang Mingyu 1 participant 3 messages Apr 9, 2019

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 cross_compilation: Add test cases for commands of cross_compilation.

The test set is used to verify whether the cross compilation is normally performed.
The verification is performed on the binary format of the executable, whether it works as specified by the help option (or equivalent).

---
 .../cross_compilation_test.sh                      |  4 ++++
 tests/Functional.cross_compilation/fuego_test.sh   | 28 ++++++++++++++++++++++
 tests/Functional.cross_compilation/parser.py       | 20 ++++++++++++++++
 tests/Functional.cross_compilation/spec.json       |  6 +++++
 .../tests/cross_compilation_dotlockfile.sh         | 15 ++++++++++++
 .../tests/cross_compilation_drbdsetup.sh           | 13 ++++++++++
 .../tests/cross_compilation_jpegtran.sh            | 15 ++++++++++++
 .../tests/cross_compilation_lockfile-create.sh     | 15 ++++++++++++
 .../tests/cross_compilation_logcheck.sh            | 13 ++++++++++
 .../tests/cross_compilation_mip6d.sh               | 15 ++++++++++++
 .../tests/cross_compilation_ntfsend.sh             | 13 ++++++++++
 .../tests/cross_compilation_openhpid.sh            | 13 ++++++++++
 .../tests/cross_compilation_openl2tpd.sh           | 15 ++++++++++++
 .../tests/cross_compilation_ptpd2.sh               | 13 ++++++++++
 .../tests/cross_compilation_setuidgid.sh           | 15 ++++++++++++
 .../tests/cross_compilation_smartctl.sh            | 13 ++++++++++
 16 files changed, 226 insertions(+)
 create mode 100644 tests/Functional.cross_compilation/cross_compilation_test.sh
 create mode 100644 tests/Functional.cross_compilation/fuego_test.sh
 create mode 100644 tests/Functional.cross_compilation/parser.py
 create mode 100644 tests/Functional.cross_compilation/spec.json
 create mode 100644 tests/Functional.cross_compilation/tests/cross_compilation_dotlockfile.sh
 create mode 100644 tests/Functional.cross_compilation/tests/cross_compilation_drbdsetup.sh
 create mode 100644 tests/Functional.cross_compilation/tests/cross_compilation_jpegtran.sh
 create mode 100644 tests/Functional.cross_compilation/tests/cross_compilation_lockfile-create.sh
 create mode 100644 tests/Functional.cross_compilation/tests/cross_compilation_logcheck.sh
 create mode 100644 tests/Functional.cross_compilation/tests/cross_compilation_mip6d.sh
 create mode 100644 tests/Functional.cross_compilation/tests/cross_compilation_ntfsend.sh
 create mode 100644 tests/Functional.cross_compilation/tests/cross_compilation_openhpid.sh
 create mode 100644 tests/Functional.cross_compilation/tests/cross_compilation_openl2tpd.sh
 create mode 100644 tests/Functional.cross_compilation/tests/cross_compilation_ptpd2.sh
 create mode 100644 tests/Functional.cross_compilation/tests/cross_compilation_setuidgid.sh
 create mode 100644 tests/Functional.cross_compilation/tests/cross_compilation_smartctl.sh
tests/Functional.cross_compilation/cross_compilation_test.sh new file +4 -0
new file mode 100644
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.cross_compilation/fuego_test.sh new file +28 -0
new file mode 100644
index 0000000..1989831
@@ -0,0 +1,28 @@
+function test_pre_check {
+    assert_has_program dotlockfile
+    assert_has_program drbdsetup
+    assert_has_program jpegtran
+    assert_has_program lockfile-create
+    assert_has_program logcheck
+    assert_has_program mip6d
+    assert_has_program ntfsend
+    assert_has_program openhpid
+    assert_has_program openl2tpd
+    assert_has_program ptpd2
+    assert_has_program setuidgid
+    assert_has_program smartctl
+}
+
+function test_deploy {
+    put $TEST_HOME/cross_compilation_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./cross_compilation_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.cross_compilation/parser.py new file +20 -0
new file mode 100644
index 0000000..f25a608
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+    for m in matches:
+        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
tests/Functional.cross_compilation/spec.json new file +6 -0
new file mode 100644
index 0000000..87ebd21
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.cross_compilation",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.cross_compilation/tests/cross_compilation_dotlockfile.sh new file +15 -0
new file mode 100644
index 0000000..20b19b5
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  The testscript checks the command dotlockfile.
+#  option: none
+
+test="dotlockfile"
+
+dotlockfile > log 2>&1
+if cat log | grep Usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+rm log
tests/Functional.cross_compilation/tests/cross_compilation_drbdsetup.sh new file +13 -0
new file mode 100644
index 0000000..29d2b9b
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  The testscript checks the command drbdsetup.
+#  option: -h
+
+test="drbdsetup"
+
+if drbdsetup -h | grep USAGE
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
tests/Functional.cross_compilation/tests/cross_compilation_jpegtran.sh new file +15 -0
new file mode 100644
index 0000000..4fce7ab
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  The testscript checks the command jpegtran.
+#  option: -h
+
+test="jpegtran"
+
+jpegtran -h > log 2>&1
+if cat log | grep usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm log
tests/Functional.cross_compilation/tests/cross_compilation_lockfile-create.sh new file +15 -0
new file mode 100644
index 0000000..e9c1286
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  The testscript checks the command lockfile-create.
+#  option: none
+
+test="lockfile-create"
+
+lockfile-create > log 2>&1
+if cat log | grep usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+rm log
tests/Functional.cross_compilation/tests/cross_compilation_logcheck.sh new file +13 -0
new file mode 100644
index 0000000..269999d
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  The testscript checks the command logcheck.
+#  option: -h
+
+test="logcheck"
+
+if sudo -u logcheck logcheck -h | grep usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
tests/Functional.cross_compilation/tests/cross_compilation_mip6d.sh new file +15 -0
new file mode 100644
index 0000000..4c6ee01
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  The testscript checks the command mip6d.
+#  option: -h
+
+test="mip6d"
+
+mip6d -h > log 2>&1
+if cat log | grep Usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm log
tests/Functional.cross_compilation/tests/cross_compilation_ntfsend.sh new file +13 -0
new file mode 100644
index 0000000..3f80215
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  The testscript checks the command ntfsend.
+#  option: --help
+
+test="ntfsend"
+
+if ntfsend --help | grep "ntfsend - send notification"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
tests/Functional.cross_compilation/tests/cross_compilation_openhpid.sh new file +13 -0
new file mode 100644
index 0000000..308497e
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  The testscript checks the command openhpid.
+#  option: -h
+
+test="openhpid"
+
+if openhpid -h | grep Usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
tests/Functional.cross_compilation/tests/cross_compilation_openl2tpd.sh new file +15 -0
new file mode 100644
index 0000000..d49224a
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  The testscript checks the command openl2tpd.
+#  option: -h
+
+test="openl2tpd"
+
+openl2tpd -h > log 2>&1
+if cat log | grep Usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm log
tests/Functional.cross_compilation/tests/cross_compilation_ptpd2.sh new file +13 -0
new file mode 100644
index 0000000..f00d4ce
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  The testscript checks the command ptpd2.
+#  option: -h
+
+test="ptpd2"
+
+if ptpd2 -h | grep usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
tests/Functional.cross_compilation/tests/cross_compilation_setuidgid.sh new file +15 -0
new file mode 100644
index 0000000..18acea7
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command setuidgid.
+#  option: --help
+
+test="setuidgid"
+
+setuidgid --help > log 2>&1
+if cat log | grep usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm log
tests/Functional.cross_compilation/tests/cross_compilation_smartctl.sh new file +13 -0
new file mode 100644
index 0000000..8188d1b
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  The testscript checks the command smartctl.
+#  option: -h
+
+test="smartctl"
+
+if smartctl -h | grep Usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH v2 1/1 acl: Add test cases for commands of ACL.

ACLs are a second level of discretionary permissions, that may override the standard ugo/rwx ones. This is a simple test to check the commands of ACL.

---
 tests/Functional.acl/acl_test.sh           |  4 ++++
 tests/Functional.acl/fuego_test.sh         | 21 ++++++++++++++++++++
 tests/Functional.acl/parser.py             | 20 +++++++++++++++++++
 tests/Functional.acl/spec.json             |  6 ++++++
 tests/Functional.acl/test.yaml             | 32 ++++++++++++++++++++++++++++++
 tests/Functional.acl/tests/acl_chacl.sh    | 20 +++++++++++++++++++
 tests/Functional.acl/tests/acl_getfacl1.sh | 13 ++++++++++++
 tests/Functional.acl/tests/acl_getfacl2.sh | 20 +++++++++++++++++++
 tests/Functional.acl/tests/acl_getfacl3.sh | 20 +++++++++++++++++++
 tests/Functional.acl/tests/acl_setfacl1.sh | 13 ++++++++++++
 tests/Functional.acl/tests/acl_setfacl2.sh | 19 ++++++++++++++++++
 tests/Functional.acl/tests/acl_setfacl3.sh | 19 ++++++++++++++++++
 tests/Functional.acl/tests/acl_setfacl4.sh | 19 ++++++++++++++++++
 tests/Functional.acl/tests/acl_setfacl5.sh | 19 ++++++++++++++++++
 14 files changed, 245 insertions(+)
 create mode 100644 tests/Functional.acl/acl_test.sh
 create mode 100644 tests/Functional.acl/fuego_test.sh
 create mode 100644 tests/Functional.acl/parser.py
 create mode 100644 tests/Functional.acl/spec.json
 create mode 100644 tests/Functional.acl/test.yaml
 create mode 100644 tests/Functional.acl/tests/acl_chacl.sh
 create mode 100644 tests/Functional.acl/tests/acl_getfacl1.sh
 create mode 100644 tests/Functional.acl/tests/acl_getfacl2.sh
 create mode 100644 tests/Functional.acl/tests/acl_getfacl3.sh
 create mode 100644 tests/Functional.acl/tests/acl_setfacl1.sh
 create mode 100644 tests/Functional.acl/tests/acl_setfacl2.sh
 create mode 100644 tests/Functional.acl/tests/acl_setfacl3.sh
 create mode 100644 tests/Functional.acl/tests/acl_setfacl4.sh
 create mode 100644 tests/Functional.acl/tests/acl_setfacl5.sh
tests/Functional.acl/acl_test.sh new file +4 -0
new file mode 100644
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.acl/fuego_test.sh new file +21 -0
new file mode 100644
index 0000000..a65e39c
@@ -0,0 +1,21 @@
+function test_pre_check {
+    assert_has_program chacl
+    assert_has_program setfacl
+    assert_has_program getfacl
+}
+
+function test_deploy {
+    put $TEST_HOME/acl_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    export tst_acl_ram=$DISK_DEV;\
+    export tst_acl_media=$DISK_MEDIA;\
+    ./acl_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.acl/parser.py new file +20 -0
new file mode 100644
index 0000000..f25a608
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+    for m in matches:
+        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
tests/Functional.acl/spec.json new file +6 -0
new file mode 100644
index 0000000..e3432a2
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.acl",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.acl/test.yaml new file +32 -0
new file mode 100644
index 0000000..9959fb3
@@ -0,0 +1,32 @@
+fuego_package_version: 1
+name: Functional.acl
+description: |
+      ACLs are a second level of discretionary permissions, that may override the standard ugo/rwx ones.
+      When used correctly they can grant you a better granularity in setting access to a file or a directory.
+      This is a simple test to check the commands of ACL.
+license: Unknown
+author: Wang Mingyu <[email protected]>
+maintainer: Tim Bird <[email protected]>
+version: 1.00
+fuego_release: 1
+type: Functional
+tags: ['vlan']
+params:
+      DISK_DEV="the device file in your target board" Defined in board file
+      DISK_MEDIA="the mount point of device in your target board" Defined in board file
+data_files:
+ - acl_test.sh
+ - fuego_test.sh
+ - parser.py
+ - spec.json
+ - test.yaml
+ - tests
+    acl_chacl.sh
+    acl_getfacl1.sh
+    acl_getfacl2.sh
+    acl_getfacl3.sh
+    acl_setfacl1.sh
+    acl_setfacl2.sh
+    acl_setfacl3.sh
+    acl_setfacl4.sh
+    acl_setfacl5.sh
tests/Functional.acl/tests/acl_chacl.sh new file +20 -0
new file mode 100644
index 0000000..df4fde5
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+#  Create a new file and run getfacl to check the string "user:: RWX".
+test="chacl"
+
+modprobe brd
+yes | mke2fs -j $tst_acl_ram
+mkdir $tst_acl_media
+mount -t ext3 -o acl $tst_acl_ram $tst_acl_media
+touch $tst_acl_media/testfile
+chacl u::rwx,g::r-x,o::r-- $tst_acl_media/testfile
+if getfacl $tst_acl_media/testfile | grep "user::rwx"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f $tst_acl_media/testfile
+umount $tst_acl_media
+rm -rf $tst_acl_media
tests/Functional.acl/tests/acl_getfacl1.sh new file +13 -0
new file mode 100644
index 0000000..5d183a6
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# Check the help message of command getfacl.
+# option: --help
+
+test="getfacl"
+
+if getfacl --help | grep Usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
tests/Functional.acl/tests/acl_getfacl2.sh new file +20 -0
new file mode 100644
index 0000000..c2daf9a
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# Create a new file with the target and execute setfacl (allow RW for user FTP) to execute getfacl to check output.
+test="getfacl2"
+
+modprobe brd
+yes | mke2fs -j $tst_acl_ram
+mkdir $tst_acl_media
+mount -t ext3 -o acl $tst_acl_ram $tst_acl_media
+touch $tst_acl_media/testfile
+setfacl -m u:ftp:rw $tst_acl_media/testfile
+if getfacl $tst_acl_media/testfile | grep "user:ftp"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f $tst_acl_media/testfile
+umount $tst_acl_media
+rm -rf $tst_acl_media
tests/Functional.acl/tests/acl_getfacl3.sh new file +20 -0
new file mode 100644
index 0000000..0fdac59
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# After a new file is created, and setfacl is executed, all the ACLS specified in the file are deleted, and getfacl is executed to check the output.
+test="getfacl3"
+
+yes | mke2fs -j /dev/ram
+mkdir /media/ram
+mount -t ext3 -o acl /dev/ram /media/ram
+touch /media/ram/testfile
+setfacl -m u:ftp:rw /media/ram/testfile
+setfacl -b /media/ram/testfile
+if getfacl /media/ram/testfile | grep "user::"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f /media/ram/testfile
+umount /media/ram
+rm -rf /media/ram
tests/Functional.acl/tests/acl_setfacl1.sh new file +13 -0
new file mode 100644
index 0000000..00db23d
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# Check the help message of command setfacl.
+# option: --help
+
+test="setfacl1"
+
+if setfacl --help | grep Usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
tests/Functional.acl/tests/acl_setfacl2.sh new file +19 -0
new file mode 100644
index 0000000..ee72bb6
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# Create a new file with the target and execute setfacl (allow RW for user FTP) to verify the end of the operation.
+test="setfacl2"
+
+modprobe brd
+yes | mke2fs -j $tst_acl_ram
+mkdir $tst_acl_media
+mount -t ext3 -o acl $tst_acl_ram $tst_acl_media
+touch $tst_acl_media/testfile
+if setfacl -m u:ftp:rw $tst_acl_media/testfile
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f $tst_acl_media/testfile
+umount $tst_acl_media
+rm -rf $tst_acl_media
tests/Functional.acl/tests/acl_setfacl3.sh new file +19 -0
new file mode 100644
index 0000000..44f6b3e
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# After a new file is created by the target and setfacl is executed, delete the ACL specified in the file.
+test="setfacl3"
+
+yes | mke2fs -j /dev/ram
+mkdir /media/ram
+mount -t ext3 -o acl /dev/ram /media/ram
+touch /media/ram/testfile
+setfacl -m u:ftp:rw /media/ram/testfile
+if setfacl -x u:ftp /media/ram/testfile
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f /media/ram/testfile
+umount /media/ram
+rm -rf /media/ram
tests/Functional.acl/tests/acl_setfacl4.sh new file +19 -0
new file mode 100644
index 0000000..2e03f72
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# Create a new file with the target and execute setfacl (allow r for group FTP).
+test="setfacl4"
+
+modprobe brd
+yes | mke2fs -j $tst_acl_ram
+mkdir $tst_acl_media
+mount -t ext3 -o acl $tst_acl_ram $tst_acl_media
+touch $tst_acl_media/testfile
+if setfacl -m g:ftp:r $tst_acl_media/testfile
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f /meida/ram/testfile
+umount $tst_acl_media
+rm -rf $tst_acl_media
tests/Functional.acl/tests/acl_setfacl5.sh new file +19 -0
new file mode 100644
index 0000000..9ccf676
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# After a new file is created by the target and setfacl is executed, delete all the ACLS specified in the file.
+test="setfacl5"
+
+yes | mke2fs -j /dev/ram
+mkdir /media/ram
+mount -t ext3 -o acl /dev/ram /media/ram
+touch /media/ram/testfile
+setfacl -m u:ftp:rw /media/ram/testfile
+if setfacl -b /media/ram/testfile
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f /media/ram/testfile
+umount /media/ram
+rm -rf /media/ram
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH v3 1/1 samhain: Add test cases of command samhain.

In reply to Wang Mingyu

Command samhain is used to check file integrity.
This test set is to check the initialization of the database of file signatures. And check the filesystem against the database of file signatures.

---
 tests/Functional.samhain/fuego_test.sh          | 20 ++++++++
 tests/Functional.samhain/parser.py              | 20 ++++++++
 tests/Functional.samhain/samhain_test.sh        |  4 ++
 tests/Functional.samhain/spec.json              |  6 +++
 tests/Functional.samhain/tests/samhain_check.sh | 64 +++++++++++++++++++++++++
 tests/Functional.samhain/tests/samhain_help.sh  | 13 +++++
 tests/Functional.samhain/tests/samhain_init.sh  | 49 +++++++++++++++++++
 7 files changed, 176 insertions(+)
 create mode 100644 tests/Functional.samhain/fuego_test.sh
 create mode 100644 tests/Functional.samhain/parser.py
 create mode 100644 tests/Functional.samhain/samhain_test.sh
 create mode 100644 tests/Functional.samhain/spec.json
 create mode 100644 tests/Functional.samhain/tests/samhain_check.sh
 create mode 100644 tests/Functional.samhain/tests/samhain_help.sh
 create mode 100644 tests/Functional.samhain/tests/samhain_init.sh
tests/Functional.samhain/fuego_test.sh new file +20 -0
new file mode 100644
index 0000000..186a74e
@@ -0,0 +1,20 @@
+function test_pre_check {
+    assert_has_program samhain
+}
+
+function test_deploy {
+    put $TEST_HOME/samhain_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put $FUEGO_CORE/scripts/fuego_board_function_lib.sh $BOARD_TESTDIR/fuego.$TESTDIR
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    export board=$BOARD_TESTDIR;\
+    export testdir=$TESTDIR;\
+    ./samhain_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.samhain/parser.py new file +20 -0
new file mode 100644
index 0000000..f25a608
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+    for m in matches:
+        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
tests/Functional.samhain/samhain_test.sh new file +4 -0
new file mode 100644
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.samhain/spec.json new file +6 -0
new file mode 100644
index 0000000..da029b3
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.samhain",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.samhain/tests/samhain_check.sh new file +64 -0

64 lines not on this page · raw message

tests/Functional.samhain/tests/samhain_help.sh new file +13 -0
new file mode 100644
index 0000000..f16b680
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command samhain.
+#  option: --help
+
+test="help"
+
+if samhain --help | grep "Usage"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
tests/Functional.samhain/tests/samhain_init.sh new file +49 -0

49 lines not on this page · raw message

Signature · 1 line
1.8.3.1