[Fuego] [PATCH 3/4] LTP: add pre-settings for smack and network related tests

Liu Wenlong liuwl.fnst at cn.fujitsu.com
Sun Mar 11 15:38:40 UTC 2018


About testsuite "smack",
- refer to [https://github.com/linux-test-project/ltp/blob/master/
  testcases/kernel/security/smack/README]

About networt related tests,
- refer to [https://github.com/linux-test-project/ltp/blob/master/
  testcases/network/stress/README]

Signed-off-by: Liu Wenlong <liuwl.fnst at cn.fujitsu.com>
---
 .../tests/Functional.LTP/scripts/setup_network.sh  | 41 ++++++++++++++++++++++
 engine/tests/Functional.LTP/scripts/setup_smack.sh | 32 +++++++++++++++++
 engine/tests/Functional.LTP/spec.json              | 15 ++++++++
 3 files changed, 88 insertions(+)
 create mode 100644 engine/tests/Functional.LTP/scripts/setup_network.sh
 create mode 100644 engine/tests/Functional.LTP/scripts/setup_smack.sh

diff --git a/engine/tests/Functional.LTP/scripts/setup_network.sh b/engine/tests/Functional.LTP/scripts/setup_network.sh
new file mode 100644
index 0000000..b66bb91
--- /dev/null
+++ b/engine/tests/Functional.LTP/scripts/setup_network.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+if [ "$1" == "end" ]; then
+    return 0
+fi
+
+#These tests[1] require two machines. And each machine needs to have 2 or more
+#interfaces. These tests assume that they run on the following topology.
+#
+#                              Control Link
+#                +------------------------------------+
+#                |                                    |
+#        +-------+-------+                    +-------+-------+
+#        |               +---- Test Link 0 ---+               |
+#        |  Local Host   +          :         +  Remote Host  |
+#        |               +---- Test Link n ---+               |
+#        +---------------+                    +---------------+
+#
+# For more details, please refer to [2].
+
+# The nestwork stress testcases require the following environment variables.
+# Those variables should be changed before testing to meet your own test env.
+
+# The host name of the remote host to access it via the control link.
+export RHOST="192.168.10.51"
+export RUSER="root"
+export PASSWD="root"
+# The blank-separated hardware address list and ethernet interfaces which are
+# connected to a test link at the local/remote host.
+export LHOST_HWADDRS="00:0e:c6:c5:b2:fe"
+export RHOST_HWADDRS="00:0e:c6:c5:c0:b4"
+export LHOST_IFACES="eth1"
+export RHOST_IFACES="enx000ec6c5c0b4"
+
+# [1] tests which require two machines:
+#     net.rpc_tests    net_stress.multicast    stress.part1       net.nfs    stress.part3
+#     net.multicast    net_stress.route        net.tirpc_tests    net.rpc    net.tcp_cmds
+#     Note:
+#         net.rpc_tests (named "rpc_tests" in some LTP version)
+#         net.tirpc_tests (named "tirpc_tests" in some LTP version)
+# [2] https://github.com/linux-test-project/ltp/blob/master/testcases/network/stress/README
diff --git a/engine/tests/Functional.LTP/scripts/setup_smack.sh b/engine/tests/Functional.LTP/scripts/setup_smack.sh
new file mode 100644
index 0000000..1d7605e
--- /dev/null
+++ b/engine/tests/Functional.LTP/scripts/setup_smack.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+cat /proc/filesystems | grep smackfs > /dev/null
+if [ $? -ne 0 ]; then
+    echo "CONFIG_SMACK not configured in your kernel."
+    exit 1
+fi
+
+if [ "$1" == "start" ]; then
+    mount | grep -v /sys/fs/smackfs | grep /smack > /dev/null
+    if [ $? -eq 0 ]; then
+        return 0
+    fi
+
+    if [ ! -d /smack ]; then
+        mkdir /smack > /dev/null
+        export NEW_DIR=1
+    fi
+
+    mount -t smackfs smackfs /smack
+    export NEW_FSTAB=1
+fi
+
+if [ "$1" == "end" ]; then
+    if [ "$NEW_FSTAB" == "1" ]; then
+        umount /smack
+    fi
+
+    if [ "$NEW_DIR" == "1" ]; then
+        rmdir /smack
+    fi
+fi
diff --git a/engine/tests/Functional.LTP/spec.json b/engine/tests/Functional.LTP/spec.json
index 3b48bdc..b81bb8b 100644
--- a/engine/tests/Functional.LTP/spec.json
+++ b/engine/tests/Functional.LTP/spec.json
@@ -72,6 +72,21 @@
             "tests": "cve",
             "extra_success_links": {"xlsx": "results.xlsx", "skiplist": "skiplist.txt"},
             "extra_fail_links": {"xlsx": "results.xlsx", "skiplist": "skiplist.txt"}
+        },
+        "rpc_tests": {
+            "tests": "net.rpc_tests net.tirpc_tests",
+            "test_operation": "/fuego-core/engine/tests/Functional.LTP/scripts/setup_network.sh",
+            "homedir": "/opt/ltp",
+            "extra_success_links": {"xlsx": "results.xlsx", "skiplist": "skiplist.txt"},
+            "extra_fail_links": {"xlsx": "results.xlsx", "skiplist": "skiplist.txt"}
+        },
+        "smack": {
+            "tests": "smack",
+            "skiplist": "smack_file_access smack_set_onlycap",
+            "test_operation": "/fuego-core/engine/tests/Functional.LTP/scripts/setup_smack.sh",
+            "homedir": "/opt/ltp",
+            "extra_success_links": {"xlsx": "results.xlsx", "skiplist": "skiplist.txt"},
+            "extra_fail_links": {"xlsx": "results.xlsx", "skiplist": "skiplist.txt"}
         }
     }
 }
-- 
2.7.4





More information about the Fuego mailing list