#!/bin/sh
#####################################################################
-# Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
+# Copyright (c) 2012-2014 Samsung Electronics Co., Ltd All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#####################################################################
#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")
+"smack")
echo "========================================================================="
- echo "CAPI"
+ echo $1
echo
- #check network and date
- check_network_access
- check_date
- #test binary execution
- cert-svc-tests-capi $2 $3
+ libsmack-test "${@:2}" # propagate all remaining arguments (except first)
;;
-
-"pkcs")
+"smack-dbus")
echo "========================================================================="
- echo "PKCS12"
+ echo "SMACK DBUS TEST"
echo
- #test binary execution
- cert-svc-tests-pkcs12 $2 $3
+ smack-dbus-tests "${@:2}"
;;
-
-"vcore")
+"libprivilege-control")
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
+ libprivilege-control-test "${@:2}"
;;
-
-"smack")
+"ss-clientsmack")
echo "========================================================================="
- echo "SMACK"
+ echo "SECURITY SERVER TEST CLIENT SMACK"
echo
- #test binary execution
- libsmack-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-privilege")
echo "========================================================================="
- echo "SECURITY-DAEMON"
+ echo "SECURITY SERVER TEST PRIVILEGE"
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-privilege "${@:2}"
+ ;;
+"security-manager")
+ echo "========================================================================="
+ echo "SECURITY MANAGER TESTS"
+ echo
+ security-manager-tests "${@:2}"
+ ;;
+"cynara")
+ echo "========================================================================="
+ echo "CYNARA TEST"
+ echo
+ cynara-test "${@: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, smack-dbus, libprivilege-control, ss-clientsmack"
+ echo " ss-server, ss-api-speed, ss-password, ss-stress"
+ echo " ss-privilege, security-manager, cynara"
;;
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 ##########################################################"