Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Sep 2013 19:51:00 GMT
From:      mattbw@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r256964 - soc2013/mattbw/tests
Message-ID:  <201309051951.r85Jp03C026985@socsvn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mattbw
Date: Thu Sep  5 19:50:59 2013
New Revision: 256964
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=256964

Log:
  Add basic functional test script for installing and uninstalling a test package.

Added:
  soc2013/mattbw/tests/ftest-install-remove-single.sh   (contents, props changed)

Added: soc2013/mattbw/tests/ftest-install-remove-single.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ soc2013/mattbw/tests/ftest-install-remove-single.sh	Thu Sep  5 19:50:59 2013	(r256964)
@@ -0,0 +1,79 @@
+#!/bin/sh
+# Functional test for installing/removing based on test repositories.
+
+# Expect testpkg not to be installed initially
+if [ -f /usr/local/testpkgs/testfile ]
+then
+	echo "Please remove testpkg and try again."
+	exit
+fi
+
+# It should come up as available...
+RESOLVE=`pkcon resolve --filter "~installed" testpkg | grep "Available.*"`
+if [ -z "${RESOLVE}" ]
+then
+	echo "Test failed: testpkg is not showing as available."
+	exit
+fi
+
+# ...but not installed.
+RESOLVE=`pkcon resolve --filter "installed" testpkg | grep "Installed.*"`
+if [ -n "${RESOLVE}" ]
+then
+	echo "Test failed: testpkg is showing as installed."
+	exit
+fi
+
+# ToDo: put more tests here?
+
+pkcon install testpkg
+
+# Expect testpkg to now be installed
+if [ ! -f /usr/local/testpkgs/testfile ]
+then
+	echo "Test failed: testpkg was not installed."
+	exit
+fi
+
+# It should come up as available...
+RESOLVE=`pkcon resolve --filter "~installed" testpkg | grep "Available.*"`
+if [ -n "${RESOLVE}" ]
+then
+	echo "Test failed: testpkg is showing as available post-install."
+	exit
+fi
+
+# ...but not installed.
+RESOLVE=`pkcon resolve --filter "installed" testpkg | grep "Installed.*"`
+if [ -z "${RESOLVE}" ]
+then
+	echo "Test failed: testpkg is not showing as installed post-install."
+	exit
+fi
+
+pkcon remove testpkg
+
+# Expect testpkg to now be uninstalled again
+if [ -f /usr/local/testpkgs/testfile ]
+then
+	echo "Test failed: testpkg was not uninstalled."
+	exit
+fi
+
+# It should once more come up as available...
+RESOLVE=`pkcon resolve --filter "~installed" testpkg | grep "Available.*"`
+if [ -z "${RESOLVE}" ]
+then
+	echo "Test failed: testpkg is not showing as available post-remove."
+	exit
+fi
+
+# ...but not installed.
+RESOLVE=`pkcon resolve --filter "installed" testpkg | grep "Installed.*"`
+if [ -n "${RESOLVE}" ]
+then
+	echo "Test failed: testpkg is showing as installed post-remove."
+	exit
+fi
+
+echo "Test succeeded."



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201309051951.r85Jp03C026985>