#####################################################################
#testing internet access and date on the target
-error(){
- echo "[ERROR]" $1
- exit 1
-}
-
-check_network_access(){
- echo "--- Checking for network access..."
- ping -c 2 www.google.com > /dev/null || error 'Network not accessible'
- echo 'Network access OK'
-}
-
-check_date(){
- echo "--- Checkig date..."
- date
- openssl verify -CAfile /opt/apps/widget/tests/vcore_certs/cacert.pem /opt/apps/widget/tests/vcore_certs/respcert.pem 2>/dev/null | grep OK 1>/dev/null || error 'Date not set properly'
- echo 'Date OK'
-}
-
-kill_daemon(){
- echo "--- Killing daemon"
- wrt_security_create_clean_db.sh
- pkill -9 security-ser && sleep 3
- echo "--- Done"
-}
-
echo "### Starting tests ######################################################"
case $1 in
-"capi")
- echo "========================================================================="
- echo "CAPI"
- echo
- #check network and date
- check_network_access
- check_date
- #test binary execution
- cert-svc-tests-capi $2 $3
- ;;
-
-"pkcs")
- echo "========================================================================="
- echo "PKCS12"
- echo
- #test binary execution
- cert-svc-tests-pkcs12 $2 $3
- ;;
-
-"vcore")
+"smack")
echo "========================================================================="
- echo "VCORE"
+ echo $1
echo
- #check network and date
- check_network_access
- check_date
- #environment setup
- cert-svc-tests-vcore-ocsp-server.sh &
- #test binary execution
- cert-svc-tests-vcore $2 $3
+ libsmack-test "${@:2}" # propagate all remaining arguments (except first)
;;
-
-"smack")
+"libprivilege-control")
echo "========================================================================="
- echo "SMACK"
+ echo $1
echo
- #test binary execution
- libsmack-test $2 $3
+ libprivilege-control-test "${@:2}"
;;
-
-"pc")
+"ss-clientsmack")
echo "========================================================================="
- echo "PRIVILEGE CONTROL"
+ echo "SECURITY SERVER TEST CLIENT SMACK"
echo
- #test binary execution
- libprivilege-control-test $2 $3
+ security-server-tests-client-smack "${@:2}"
;;
-
-"ace")
+"ss-stress")
echo "========================================================================="
- echo "ACE"
+ echo "SECURITY SERVER TEST STRESS"
echo
- #environment setup
- cp /usr/etc/ace/WAC2.0Policy.xml /usr/etc/ace/WAC2.0Policy.xml.bk
- cp /usr/etc/ace/TizenPolicy.xml /usr/etc/ace/TizenPolicy.xml.bk
- cp /usr/etc/ace/WAC2.0Policy-test.xml /usr/etc/ace/WAC2.0Policy.xml
- cp /usr/etc/ace/TizenPolicy-test.xml /usr/etc/ace/TizenPolicy.xml
- kill_daemon
- #test binary execution
- wrt-tests-ace $2 $3
+ security-server-tests-stress "${@:2}"
;;
-
-"ace-client")
+"ss-server")
echo "========================================================================="
- echo "ACE-CLIENT"
+ echo "SECURITY SERVER TEST SERVER"
echo
- #environment setup
- cp /usr/etc/ace/WAC2.0Policy.xml.bk /usr/etc/ace/WAC2.0Policy.xml
- cp /usr/etc/ace/TizenPolicy.xml.bk /usr/etc/ace/TizenPolicy.xml
- kill_daemon
- #test binary execution
- wrt-tests-ace-client $2 $3
+ security-server-tests-server "${@:2}"
;;
-
-"ace-settings")
+"ss-api-speed")
echo "========================================================================="
- echo "ACE-SETTINGS"
+ echo "SECURITY SERVER MEASURER SERVER"
echo
- #environment setup
- kill_daemon
- #test binary execution
- wrt-tests-ace-settings $2 $3
+ security-server-tests-api-speed "${@:2}"
;;
-
-"ace-install")
+"ss-password")
echo "========================================================================="
- echo "ACE-INSTALL"
+ echo "SECURITY SERVER TEST PASSWORD"
echo
- #environment setup
- kill_daemon
- cp /usr/etc/ace/WAC2.0Policy.xml /usr/etc/ace/WAC2.0Policy.xml.bk
- cp /usr/etc/ace/ace-install-api-demo-policy.xml /usr/etc/ace/WAC2.0Policy.xml
- wrt_security_change_policy.sh
- #test binary execution
- wrt-tests-ace-install $2 $3
+ security-server-tests-password "${@:2}"
;;
-
-"security-daemon")
+"ss-dbus")
echo "========================================================================="
- echo "SECURITY-DAEMON"
+ echo "SECURITY SERVER TEST DBUS"
echo
- #environment setup
- cp /usr/etc/ace/WAC2.0Policy.xml.bk /usr/etc/ace/WAC2.0Policy.xml
- kill_daemon
- cp /usr/etc/ace/WAC2.0Policy.xml /usr/etc/ace/WAC2.0Policy.xml.bk
- cp /usr/etc/ace/ipc-tests-demo.xml /usr/etc/ace/WAC2.0Policy.xml
- wrt_security_change_policy.sh
- #test binary execution
- wrt-tests-security-daemon $2 $3
+ security-server-tests-dbus "${@:2}"
;;
-
*)
echo "Correct using:"
echo " security_test.sh <module> <args_for_module>"
echo
- echo "modules: ace, ace-client, ace-settings, ace-install,"
- echo " security-daemon, vcore, capi, pkcs, smack"
+ echo "modules: smack, libprivilege-control, ss-clientsmack"
+ echo " ss-server, ss-api-speed, ss-password, ss-stress"
;;
esac
-#clean up
-pkill -9 wrt-secur # security daemon needs to be killed, as database connections need to be changed (SQLite files are changed!)
-
echo "### Tests done ##########################################################"