[Fuego] Patch for Functional.check_mounts

Kumar T <[email protected]>
Newsgroups dev.linux.lists.fuego
Message-ID <CA+wOOGgZyE3du7Zj6iiErVdx4MSnYENpaGH166bSkyYwRUbUdA@mail.gmail.com>
Hi Tim,

      I am Kumar from HCL Technologies. I am developing test cases for
"Functional.check_mounts" as discussed earlier. Updated the code as per
your review comments.

Please find the attached PATCH and other source files. Please review.

Thanks & Regards,
Kumar.
0001-check_mounts-PATCH-1-1.patch (text/x-patch, 3 KB)
From 1ce54041f21a7185e060714d79b595016a6f39e2 Mon Sep 17 00:00:00 2001
From: HCL-BMC <[email protected]>
Date: Tue, 19 Nov 2019 13:12:36 +0530
Subject: [PATCH] <check_mounts>:[PATCH 1/1]

This PATCH added test cases to check the expected mounts
with system mount points. If any mount point is not matched
test would fail. It has save_baseline spec to save the
system mount points as expected mount points.
---
 tests/Functional.check_mounts/fuego_test.sh | 28 ++++++++++++++++++---
 tests/Functional.check_mounts/spec.json     |  6 ++++-
 tests/Functional.check_mounts/test.yaml     |  4 +--
 3 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/tests/Functional.check_mounts/fuego_test.sh b/tests/Functional.check_mounts/fuego_test.sh
index 7e93f6f..609999b 100755
--- a/tests/Functional.check_mounts/fuego_test.sh
+++ b/tests/Functional.check_mounts/fuego_test.sh
@@ -5,13 +5,35 @@ function test_build {
 }
 
 function test_deploy {
-    put fs_test $BOARD_TESTDIR/fuego.$TESTDIR/
-    put /fuego-rw/boards/rpi3/expected_mounts.txt $BOARD_TESTDIR/fuego.$TESTDIR/
+
+    EXPECTED_FILE=/fuego-rw/boards/$NODE_NAME/expected_mounts.txt
+
+    if [ "$TESTSPEC" = "default" ] ; then
+
+    	if [ -f "${EXPECTED_FILE}" ] ; then
+      	    put "${EXPECTED_FILE}" $BOARD_TESTDIR/fuego.$TESTDIR/ 
+	else
+            abort_job "Please create file ${EXPECTED_FILE} with the list of expected mounts"
+        fi
+
+        put fs_test $BOARD_TESTDIR/fuego.$TESTDIR/
+    fi
+
 }
  
 function test_run {
-    report "cd $BOARD_TESTDIR/fuego.$TESTDIR; \
+
+    DATA_FILE=$LOGDIR/expected_mount_data.txt
+
+    if [ "$TESTSPEC" = "save_baseline" ] ; then
+        mount | awk '{print substr($1, 1, length($1))}'>$DATA_FILE
+	cp $DATA_FILE ${EXPECTED_FILE}
+        log_this "echo \"baseline file: ${EXPECTED_FILE} saved\""
+        return 0
+    else
+        report "cd $BOARD_TESTDIR/fuego.$TESTDIR; \
         ./fs_test"
+    fi
 }
 
 function test_processing {
diff --git a/tests/Functional.check_mounts/spec.json b/tests/Functional.check_mounts/spec.json
index 65eab4d..e3e383f 100644
--- a/tests/Functional.check_mounts/spec.json
+++ b/tests/Functional.check_mounts/spec.json
@@ -1,7 +1,11 @@
 {
     "testName": "Functional.check_mounts",
     "specs": {
-        "default": {}
+        "default": {
+	},
+	"save_baseline": {
+            "save_baseline": "true"
+	}
     }
 }
 
diff --git a/tests/Functional.check_mounts/test.yaml b/tests/Functional.check_mounts/test.yaml
index 57942b5..beaa67c 100644
--- a/tests/Functional.check_mounts/test.yaml
+++ b/tests/Functional.check_mounts/test.yaml
@@ -1,8 +1,8 @@
 fuego_package_version: 1
 name: Functional.check_mounts
 description: |
-    Sample test that runs fs_test. This test
-    comes with specs to check the expected mounts with system's mount.
+    Run fs_test, using an 'expected_mounts.txt' file, in order to verify
+    that the mouned filesystems on the target board are as expected.
 license: MIT
 author: Kumar Thangavel <[email protected]>
 maintainer: Kumar Thangavel <[email protected]>
-- 
2.17.1
fs-test-1.1.tgz (application/x-compressed-tar, 2.2 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.