[csw-devel] SF.net SVN: gar:[14389] csw/mgar/pkg/cswclassutils/trunk/files/ cswmigrateconf_test.sh
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Sun Apr 24 11:13:29 CEST 2011
Revision: 14389
http://gar.svn.sourceforge.net/gar/?rev=14389&view=rev
Author: wahwah
Date: 2011-04-24 09:13:29 +0000 (Sun, 24 Apr 2011)
Log Message:
-----------
cswclassutils: Adding a unit test for cswmigrateconf
Added Paths:
-----------
csw/mgar/pkg/cswclassutils/trunk/files/cswmigrateconf_test.sh
Added: csw/mgar/pkg/cswclassutils/trunk/files/cswmigrateconf_test.sh
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/files/cswmigrateconf_test.sh (rev 0)
+++ csw/mgar/pkg/cswclassutils/trunk/files/cswmigrateconf_test.sh 2011-04-24 09:13:29 UTC (rev 14389)
@@ -0,0 +1,55 @@
+#!/opt/csw/bin/bash
+
+set -x
+set -u
+set -e
+
+readonly CAS_DIR="files"
+readonly CAS_UNDER_TEST="CSWcswclassutils.i.cswmigrateconf"
+readonly TMP_DIR="$(gmktemp -d castest.XXXXXXXXXX)"
+readonly SRC_DIR="${TMP_DIR}/src"
+PKG_INSTALL_ROOT="${TMP_DIR}/root"
+readonly OLD_CONFDIR_ABS="${PKG_INSTALL_ROOT}/opt/csw/etc"
+readonly NEW_CONFDIR_ABS="${PKG_INSTALL_ROOT}/etc/opt/csw"
+
+cleanup() {
+tree "${TMP_DIR}"
+echo "To clean up:"
+echo "rm -rf \"${TMP_DIR}\""
+read -p "Clean? [y/n] > " ANSWER
+if [[ "${ANSWER}" == y ]]
+then
+ rm -rf "${TMP_DIR}"
+else
+ echo "Not removing."
+fi
+}
+
+trap cleanup EXIT
+
+echo "Working in '${TMP_DIR}'"
+mkdir -p "${PKG_INSTALL_ROOT}"
+mkdir -p "${SRC_DIR}"
+
+# Place files
+echo "MIGRATE_FILES=\"foo.conf bar.d\"" > "${SRC_DIR}/foo"
+echo "MIGRATE_FILES=\"bar.d\"" > "${SRC_DIR}/foo"
+mkdir -p "${OLD_CONFDIR_ABS}"
+echo "foo: bar" > "${OLD_CONFDIR_ABS}/foo.conf"
+
+mkdir -p "${OLD_CONFDIR_ABS}/bar.d"
+echo "I am the bar daemon." > "${OLD_CONFDIR_ABS}/bar.d/bar.conf"
+
+# And a directory
+
+# Running the script
+
+echo "${SRC_DIR}/foo bar" | PKG_INSTALL_ROOT=${PKG_INSTALL_ROOT} /bin/sh -x "${CAS_DIR}/${CAS_UNDER_TEST}"
+
+if [[ $? -ne 0 ]]; then
+ echo "Test failed."
+fi
+
+# Verification
+# What?
+
Property changes on: csw/mgar/pkg/cswclassutils/trunk/files/cswmigrateconf_test.sh
___________________________________________________________________
Added: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the devel
mailing list