Skip to contentSkip to conversation

Add test cases of command logwatch.

PATCH New Wang Mingyu 1 participant 4 messages Nov 6, 2018 Arm STM32

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add test cases of command logwatch.

The command logwatch is a system log analyzer and reporter.

This test set is used to report the system log and mail it to email address.

---
 .../tests/Functional.logwatch/data/logwatch.conf   | 107 ++++
 engine/tests/Functional.logwatch/data/main.cf      | 651 +++++++++++++++++++++
 engine/tests/Functional.logwatch/fuego_test.sh     |  19 +
 engine/tests/Functional.logwatch/logwatch_test.sh  |   4 +
 engine/tests/Functional.logwatch/parser.py         |  22 +
 engine/tests/Functional.logwatch/spec.json         |   7 +
 .../Functional.logwatch/tests/logwatch_detail.sh   |  38 ++
 .../Functional.logwatch/tests/logwatch_help.sh     |  13 +
 .../Functional.logwatch/tests/logwatch_mailto.sh   |  43 ++
 9 files changed, 904 insertions(+)
 create mode 100644 engine/tests/Functional.logwatch/data/logwatch.conf
 create mode 100644 engine/tests/Functional.logwatch/data/main.cf
 create mode 100644 engine/tests/Functional.logwatch/fuego_test.sh
 create mode 100755 engine/tests/Functional.logwatch/logwatch_test.sh
 create mode 100644 engine/tests/Functional.logwatch/parser.py
 create mode 100644 engine/tests/Functional.logwatch/spec.json
 create mode 100644 engine/tests/Functional.logwatch/tests/logwatch_detail.sh
 create mode 100644 engine/tests/Functional.logwatch/tests/logwatch_help.sh
 create mode 100644 engine/tests/Functional.logwatch/tests/logwatch_mailto.sh
engine/tests/Functional.logwatch/data/logwatch.conf new file +107 -0
new file mode 100644
index 0000000..6621145
@@ -0,0 +1,107 @@
+########################################################
+# This was written and is maintained by:
+#    Kirk Bauer <[email protected]>
+#
+# Please send all comments, suggestions, bug reports,
+#    etc, to [email protected].
+#
+########################################################
+
+# NOTE:
+#   All these options are the defaults if you run logwatch with no
+#   command-line arguments.  You can override all of these on the
+#   command-line. 
+
+# You can put comments anywhere you want to.  They are effective for the
+# rest of the line.
+
+# this is in the format of <name> = <value>.  Whitespace at the beginning
+# and end of the lines is removed.  Whitespace before and after the = sign
+# is removed.  Everything is case *insensitive*.
+
+# Yes = True  = On  = 1
+# No  = False = Off = 0
+
+# Default Log Directory
+# All log-files are assumed to be given relative to this directory.
+LogDir = /var/log
+
+# You can override the default temp directory (/tmp) here
+TmpDir = /var/cache/logwatch
+
+# Default person to mail reports to.  Can be a local account or a
+# complete email address.
+MailTo = root
+
+# If set to 'Yes', the report will be sent to stdout instead of being
+# mailed to above person.
+Print = No
+
+# if set, the results will be saved in <filename> instead of mailed
+# or displayed.
+#Save = /tmp/logwatch
+
+# Use archives?  If set to 'Yes', the archives of logfiles
+# (i.e. /var/log/messages.1 or /var/log/messages.1.gz) will
+# be searched in addition to the /var/log/messages file.
+# This usually will not do much if your range is set to just
+# 'Yesterday' or 'Today'... it is probably best used with
+Archives = Yes
+Range = All
+
+# The default time range for the report...
+# The current choices are All, Today, Yesterday
+#Range = yesterday
+
+# The default detail level for the report.
+# This can either be Low, Med, High or a number.
+# Low = 0
+# Med = 5
+# High = 10
+Detail = Low 
+
+
+# The 'Service' option expects either the name of a filter
+# (in /usr/share/logwatch/scripts/services/*) or 'All'.
+# The default service(s) to report on.  This should be left as All for
+# most people.  
+Service = All
+# You can also disable certain services (when specifying all)
+Service = "-zz-network"     # Prevents execution of zz-network service, which
+                            # prints useful network configuration info.
+# If you only cared about FTP messages, you could use these 2 lines
+# instead of the above:
+#Service = ftpd-messages   # Processes ftpd messages in /var/log/messages
+#Service = ftpd-xferlog    # Processes ftpd messages in /var/log/xferlog
+# Maybe you only wanted reports on PAM messages, then you would use:
+#Service = pam_pwdb        # PAM_pwdb messages - usually quite a bit
+#Service = pam             # General PAM messages... usually not many
+
+# You can also choose to use the 'LogFile' option.  This will cause
+# logwatch to only analyze that one logfile.. for example:
+#LogFile = messages
+# will process /var/log/messages.  This will run all the filters that 
+# process that logfile.  This option is probably not too useful to
+# most people.  Setting 'Service' to 'All' above analyizes all LogFiles
+# anyways...
+
+#
+# some systems have different locations for mailers
+#
+#mailer = /bin/mail
+mailer = "sendmail -t"
+
+#
+# With this option set to 'Yes', only log entries for this particular host
+# (as returned by 'hostname' command) will be processed.  The hostname
+# can also be overridden on the commandline (with --hostname option).  This
+# can allow a log host to process only its own logs, or Logwatch can be
+# run once per host included in the logfiles. 
+#
+# The default is to report on all log entries, regardless of its source host.
+# Note that some logfiles do not include host information and will not be
+# influenced by this setting.
+#
+#HostLimit = Yes
+
+# vi: shiftwidth=3 tabstop=3 et
engine/tests/Functional.logwatch/data/main.cf new file +651 -0

651 lines not on this page · raw message

engine/tests/Functional.logwatch/fuego_test.sh new file +19 -0
new file mode 100644
index 0000000..d3db69f
@@ -0,0 +1,19 @@
+function test_pre_check {
+    assert_has_program logwatch
+}
+
+function test_deploy {
+    put $TEST_HOME/logwatch_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put $FUEGO_CORE/engine/scripts/fuego_board_function_lib.sh $BOARD_TESTDIR/fuego.$TESTDIR
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/data $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./logwatch_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
engine/tests/Functional.logwatch/logwatch_test.sh new file +4 -0
new file mode 100755
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
engine/tests/Functional.logwatch/parser.py new file +22 -0
new file mode 100644
index 0000000..d85abd7
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+
+sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
+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))
engine/tests/Functional.logwatch/spec.json new file +7 -0
new file mode 100644
index 0000000..1a74497
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.logwatch",
+    "specs": {
+        "default": {}
+    }
+}
+
engine/tests/Functional.logwatch/tests/logwatch_detail.sh new file +38 -0
new file mode 100644
index 0000000..7ab3f8b
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+#  Run logwatch and print the log to standard output.
+#  option: --detail
+
+test="detail"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+logger_service=$(detect_logger_service)
+
+if [ -e /var/run/syslog-ng.pid ]
+then
+    exec_service_on_target $logger_service stop
+fi
+
+exec_service_on_target $logger_service restart
+cp /usr/share/logwatch/default.conf/services/*.conf /etc/logwatch/conf/services
+
+mv /etc/logwatch/conf/logwatch.conf /etc/logwatch/conf/logwatch.conf_bak
+cp data/logwatch.conf /etc/logwatch/conf/logwatch.conf
+
+mkdir test_dir
+logwatch --detail 10 --service kernel > test_dir/test.log
+
+if cat test_dir/test.log | grep "Kernel"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+rm -fr test_dir
+rm -f /etc/logwatch/conf/services/*.conf
+
+exec_service_on_target $logger_service stop
+mv /etc/logwatch/conf/logwatch.conf_bak /etc/logwatch/conf/logwatch.conf
engine/tests/Functional.logwatch/tests/logwatch_help.sh new file +13 -0
new file mode 100644
index 0000000..1933592
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In the target to execute command logwatch and confirm the result.
+#  option : --help
+
+test="help"
+
+if logwatch --help | grep "Usage"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
engine/tests/Functional.logwatch/tests/logwatch_mailto.sh new file +43 -0

43 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/1 Add test cases of service hostapd.

---
 engine/tests/Functional.hostapd/fuego_test.sh      | 18 ++++++++++++++++++
 engine/tests/Functional.hostapd/hostapd_test.sh    |  4 ++++
 engine/tests/Functional.hostapd/parser.py          | 22 ++++++++++++++++++++++
 engine/tests/Functional.hostapd/spec.json          |  7 +++++++
 .../tests/Functional.hostapd/tests/hostapd_help.sh | 15 +++++++++++++++
 .../Functional.hostapd/tests/hostapd_service.sh    | 19 +++++++++++++++++++
 6 files changed, 85 insertions(+)
 create mode 100644 engine/tests/Functional.hostapd/fuego_test.sh
 create mode 100755 engine/tests/Functional.hostapd/hostapd_test.sh
 create mode 100644 engine/tests/Functional.hostapd/parser.py
 create mode 100644 engine/tests/Functional.hostapd/spec.json
 create mode 100644 engine/tests/Functional.hostapd/tests/hostapd_help.sh
 create mode 100644 engine/tests/Functional.hostapd/tests/hostapd_service.sh
engine/tests/Functional.hostapd/fuego_test.sh new file +18 -0
new file mode 100644
index 0000000..7a25a72
@@ -0,0 +1,18 @@
+function test_pre_check {
+    assert_has_program hostapd
+}
+
+function test_deploy {
+    put $TEST_HOME/hostapd_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put $FUEGO_CORE/engine/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;\
+    ./hostapd_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
engine/tests/Functional.hostapd/hostapd_test.sh new file +4 -0
new file mode 100755
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
engine/tests/Functional.hostapd/parser.py new file +22 -0
new file mode 100644
index 0000000..d85abd7
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+
+sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
+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))
engine/tests/Functional.hostapd/spec.json new file +7 -0
new file mode 100644
index 0000000..db494d6
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.hostapd",
+    "specs": {
+        "default": {}
+    }
+}
+
engine/tests/Functional.hostapd/tests/hostapd_help.sh new file +15 -0
new file mode 100644
index 0000000..a5b904b
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In target, run command hostapd.
+#  option: --help.
+
+test="help"
+
+hostapd --help > help_log 2>&1
+if cat help_log | grep usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm help_log
engine/tests/Functional.hostapd/tests/hostapd_service.sh new file +19 -0
new file mode 100644
index 0000000..4ca6114
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+#  In the target to start hostapd and confirm the return value of the daemon startup script is "0"..
+#  option: none
+
+test="service"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+exec_service_on_target hostapd stop
+
+if exec_service_on_target hostapd start
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 1/1 Add test cases of command fetchmail.

In reply to Wang Mingyu

Fetchmail is an open source software utility for POSIX-compliant operating systems
which is used to retrieve e-mail from a remote POP3, IMAP, ETRN or ODMR mail server to the user's local system.

This test set is used to check command fetchmail and service postfix.

---
 .../tests/Functional.fetchmail/data/.fetchmailrc   |    4 +
 .../tests/Functional.fetchmail/data/dovecot.conf   | 1261 ++++++++++++++++++++
 engine/tests/Functional.fetchmail/data/main.cf     |  651 ++++++++++
 engine/tests/Functional.fetchmail/data/testmsg.txt |    1 +
 .../tests/Functional.fetchmail/fetchmail_test.sh   |    4 +
 engine/tests/Functional.fetchmail/fuego_test.sh    |   19 +
 engine/tests/Functional.fetchmail/parser.py        |   22 +
 engine/tests/Functional.fetchmail/spec.json        |    7 +
 .../tests/fetchmail_configdump.sh                  |   13 +
 .../tests/fetchmail_getmail.sh                     |   40 +
 .../Functional.fetchmail/tests/fetchmail_help.sh   |   13 +
 11 files changed, 2035 insertions(+)
 create mode 100644 engine/tests/Functional.fetchmail/data/.fetchmailrc
 create mode 100644 engine/tests/Functional.fetchmail/data/dovecot.conf
 create mode 100644 engine/tests/Functional.fetchmail/data/main.cf
 create mode 100644 engine/tests/Functional.fetchmail/data/testmsg.txt
 create mode 100755 engine/tests/Functional.fetchmail/fetchmail_test.sh
 create mode 100644 engine/tests/Functional.fetchmail/fuego_test.sh
 create mode 100644 engine/tests/Functional.fetchmail/parser.py
 create mode 100644 engine/tests/Functional.fetchmail/spec.json
 create mode 100644 engine/tests/Functional.fetchmail/tests/fetchmail_configdump.sh
 create mode 100644 engine/tests/Functional.fetchmail/tests/fetchmail_getmail.sh
 create mode 100644 engine/tests/Functional.fetchmail/tests/fetchmail_help.sh
engine/tests/Functional.fetchmail/data/.fetchmailrc new file +4 -0
new file mode 100644
index 0000000..4ad5050
@@ -0,0 +1,4 @@
+poll 127.0.0.1
+     protocol pop3
+     user test 
+     password test123 
engine/tests/Functional.fetchmail/data/dovecot.conf new file +1261 -0

1,261 lines not on this page · raw message

engine/tests/Functional.fetchmail/data/main.cf new file +651 -0

651 lines not on this page · raw message

engine/tests/Functional.fetchmail/data/testmsg.txt new file +1 -0
new file mode 100644
index 0000000..2d888c6
@@ -0,0 +1 @@
+msgtest
engine/tests/Functional.fetchmail/fetchmail_test.sh new file +4 -0
new file mode 100755
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
engine/tests/Functional.fetchmail/fuego_test.sh new file +19 -0
new file mode 100644
index 0000000..26fe73d
@@ -0,0 +1,19 @@
+function test_pre_check {
+    assert_has_program fetchmail
+}
+
+function test_deploy {
+    put $TEST_HOME/fetchmail_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put $FUEGO_CORE/engine/scripts/fuego_board_helper.sh $BOARD_TESTDIR/fuego.$TESTDIR
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/data $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./fetchmail_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
engine/tests/Functional.fetchmail/parser.py new file +22 -0
new file mode 100644
index 0000000..d85abd7
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+
+sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
+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))
engine/tests/Functional.fetchmail/spec.json new file +7 -0
new file mode 100644
index 0000000..cffb73d
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.fetchmail",
+    "specs": {
+        "default": {}
+    }
+}
+
engine/tests/Functional.fetchmail/tests/fetchmail_configdump.sh new file +13 -0
new file mode 100644
index 0000000..7d3be59
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command fetchmail.
+#  option: --configdump
+
+test="configdump"
+
+if fetchmail --configdump | grep "End of initializer"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
engine/tests/Functional.fetchmail/tests/fetchmail_getmail.sh new file +40 -0
new file mode 100644
index 0000000..ac4cd47
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+#  In target, run command fetchmail.
+#  option: none
+
+test="getmail"
+
+. fuego_board_helper.sh
+
+set_init_manager
+
+exec_service_on_target postfix stop
+mv /etc/postfix/main.cf /etc/postfix/main.cf_bak
+cp data/main.cf /etc/postfix/main.cf
+exec_service_on_target postfix start
+
+exec_service_on_target dovecot stop
+mv /etc/dovecot/dovecot.conf /etc/dovecot/dovecot.conf_bak
+cp data/dovecot.conf /etc/dovecot/dovecot.conf
+exec_service_on_target dovecot start
+
+cp data/.fetchmailrc /root/.fetchmailrc
+
+cat data/testmsg.txt | mailx -s testmsg test
+fetchmail
+
+if cat /var/spool/mail/test | grep msgtest
+
+if fetchmail --configdump | grep "End of initializer"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+exec_service_on_target postfix stop
+exec_service_on_target dovecot stop
+mv /etc/dovecot/dovecot.conf_bak /etc/dovecot/dovecot.conf
+mv /etc/postfix/main.cf_bak /etc/postfix/main.cf
+rm -f /root/.fetchmailrc
engine/tests/Functional.fetchmail/tests/fetchmail_help.sh new file +13 -0
new file mode 100644
index 0000000..f90c3d4
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command fetchmail.
+#  option: --help.
+
+test="help"
+
+if fetchmail --help | grep usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
Signature · 1 line
1.8.3.1
#3 lore raw

PATCH 1/1 Add test cases for commands of ACL.

In reply to Wang Mingyu

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.

---
 engine/tests/Functional.acl/acl_test.sh           |  4 +++
 engine/tests/Functional.acl/fuego_test.sh         | 21 +++++++++++++++
 engine/tests/Functional.acl/parser.py             | 22 ++++++++++++++++
 engine/tests/Functional.acl/spec.json             |  7 +++++
 engine/tests/Functional.acl/test.yaml             | 32 +++++++++++++++++++++++
 engine/tests/Functional.acl/tests/acl_chacl.sh    | 18 +++++++++++++
 engine/tests/Functional.acl/tests/acl_getfacl1.sh |  9 +++++++
 engine/tests/Functional.acl/tests/acl_getfacl2.sh | 18 +++++++++++++
 engine/tests/Functional.acl/tests/acl_getfacl3.sh | 18 +++++++++++++
 engine/tests/Functional.acl/tests/acl_setfacl1.sh |  9 +++++++
 engine/tests/Functional.acl/tests/acl_setfacl2.sh | 18 +++++++++++++
 engine/tests/Functional.acl/tests/acl_setfacl3.sh | 18 +++++++++++++
 engine/tests/Functional.acl/tests/acl_setfacl4.sh | 18 +++++++++++++
 engine/tests/Functional.acl/tests/acl_setfacl5.sh | 18 +++++++++++++
 14 files changed, 230 insertions(+)
 create mode 100755 engine/tests/Functional.acl/acl_test.sh
 create mode 100644 engine/tests/Functional.acl/fuego_test.sh
 create mode 100644 engine/tests/Functional.acl/parser.py
 create mode 100644 engine/tests/Functional.acl/spec.json
 create mode 100644 engine/tests/Functional.acl/test.yaml
 create mode 100644 engine/tests/Functional.acl/tests/acl_chacl.sh
 create mode 100644 engine/tests/Functional.acl/tests/acl_getfacl1.sh
 create mode 100644 engine/tests/Functional.acl/tests/acl_getfacl2.sh
 create mode 100644 engine/tests/Functional.acl/tests/acl_getfacl3.sh
 create mode 100644 engine/tests/Functional.acl/tests/acl_setfacl1.sh
 create mode 100644 engine/tests/Functional.acl/tests/acl_setfacl2.sh
 create mode 100644 engine/tests/Functional.acl/tests/acl_setfacl3.sh
 create mode 100644 engine/tests/Functional.acl/tests/acl_setfacl4.sh
 create mode 100644 engine/tests/Functional.acl/tests/acl_setfacl5.sh
engine/tests/Functional.acl/acl_test.sh new file +4 -0
new file mode 100755
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
engine/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"
+}
engine/tests/Functional.acl/parser.py new file +22 -0
new file mode 100644
index 0000000..d85abd7
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+
+sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
+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))
engine/tests/Functional.acl/spec.json new file +7 -0
new file mode 100644
index 0000000..6fcca9b
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.acl",
+    "specs": {
+        "default": {}
+    }
+}
+
engine/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
engine/tests/Functional.acl/tests/acl_chacl.sh new file +18 -0
new file mode 100644
index 0000000..f89dc9f
@@ -0,0 +1,18 @@
+#!/bin/sh
+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
engine/tests/Functional.acl/tests/acl_getfacl1.sh new file +9 -0
new file mode 100644
index 0000000..063c50b
@@ -0,0 +1,9 @@
+#!/bin/sh
+test="getfacl"
+
+if getfacl --help | grep Usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
engine/tests/Functional.acl/tests/acl_getfacl2.sh new file +18 -0
new file mode 100644
index 0000000..e570fd3
@@ -0,0 +1,18 @@
+#!/bin/sh
+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
engine/tests/Functional.acl/tests/acl_getfacl3.sh new file +18 -0
new file mode 100644
index 0000000..1875ae4
@@ -0,0 +1,18 @@
+#!/bin/sh
+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
engine/tests/Functional.acl/tests/acl_setfacl1.sh new file +9 -0
new file mode 100644
index 0000000..92ce0a1
@@ -0,0 +1,9 @@
+#!/bin/sh
+test="setfacl1"
+
+if setfacl --help | grep Usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
engine/tests/Functional.acl/tests/acl_setfacl2.sh new file +18 -0
new file mode 100644
index 0000000..427dfb8
@@ -0,0 +1,18 @@
+#!/bin/sh
+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
+setfacl -m u:ftp:rw $tst_acl_media/testfile
+if [ `echo $?` == 0 ]
+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
engine/tests/Functional.acl/tests/acl_setfacl3.sh new file +18 -0
new file mode 100644
index 0000000..79fd0db
@@ -0,0 +1,18 @@
+#!/bin/sh
+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
+setfacl -x u:ftp /media/ram/testfile
+if [ `echo $?` == 0 ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+rm -f /media/ram/testfile
+umount /media/ram
+rm -rf /media/ram
engine/tests/Functional.acl/tests/acl_setfacl4.sh new file +18 -0
new file mode 100644
index 0000000..9e7696c
@@ -0,0 +1,18 @@
+#!/bin/sh
+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
+setfacl -m g:ftp:r $tst_acl_media/testfile
+if [ `echo $?` == 0 ]
+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
engine/tests/Functional.acl/tests/acl_setfacl5.sh new file +18 -0
new file mode 100644
index 0000000..29a301e
@@ -0,0 +1,18 @@
+#!/bin/sh
+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
+setfacl -b /media/ram/testfile
+if [ `echo $?` == 0 ]
+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