summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas James Alexander Thurman <tthurman@src.gnome.org>2008-05-22 04:57:08 +0000
committerThomas James Alexander Thurman <tthurman@src.gnome.org>2008-05-22 04:57:08 +0000
commite4f869ada73bf9fdc7c14ee7f1cd41449a48c488 (patch)
tree7d7639c89a44036ae9a248109d1163fe2a05f4ef
parentf9dd0d59f935af98b60d27e1ab1f40c0d7984aff (diff)
downloadmetacity-e4f869ada73bf9fdc7c14ee7f1cd41449a48c488.tar.gz
Basic version (in flux)
svn path=/branches/test-system/; revision=3721
-rw-r--r--test/metacity-test105
1 files changed, 105 insertions, 0 deletions
diff --git a/test/metacity-test b/test/metacity-test
new file mode 100644
index 00000000..6d09d664
--- /dev/null
+++ b/test/metacity-test
@@ -0,0 +1,105 @@
+#!/usr/bin/python
+#
+# metacity-test.py -- testing for Metacity
+#
+# Copyright (C) 2008 Thomas Thurman
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+#
+
+import sys
+import getopt
+
+#################
+#
+# These belong in a file, one of several in a subdirectory
+# which gets scanned, so we can easily do plugins, and so
+# we get precompilation.
+
+build_tests = {
+ 'ansi': {'c': ['-ansi']},
+ 'gconfoff': {'configure': ['--disable-gconf']},
+ 'compositoroff': {'configure': ['--disable-compositor']},
+ 'teston': {'configure': ['--enable-testing']},
+}
+
+# XXX Fixme, but we'll check this in first:
+# We need to make all these subclasses of a build test subclass of
+# a test class.
+
+#################
+#
+# And back in the ordinary world...
+
+def run_test(testname):
+ print 'Running test ',testname
+
+def show_help():
+ print ' --- metacity-test --- a test system for metacity.'
+ print 'There are three kinds of test: unit, regression, or build.'
+ print 'Only build tests are currently implemented.'
+ print
+ print 'Syntax:'
+ print ' metacity-test <switches> <test names>'
+ print 'where <switches> can be:'
+ print ' -h Show this help and exit'
+ print ' -l List all known tests and exit'
+ print ' -r=n Use revision n, or directory n as pristine'
+ print
+
+def show_tests():
+ print 'Build tests:'
+ for test in build_tests:
+ print ' %s' % (test)
+
+ print
+ print 'Unit tests:'
+ print ' -- Not yet implemented.'
+ print
+ print 'Regression tests:'
+ print ' -- Not yet implemented.'
+
+def main():
+ try:
+ (opts, testlist) = getopt.gnu_getopt(
+ sys.argv[1:],
+ 'lhr=',
+ )
+ except getopt.GetoptError, e:
+ print 'Error:', e
+ print 'Use -h for help, or -l to list all tests.'
+ sys.exit(1)
+
+ if (len(opts)==0 and len(testlist)==0) or (('-h', '') in opts):
+ show_help()
+ elif ('-l', '') in opts:
+ show_tests()
+ elif not testlist:
+ print "Warning: You didn't specify any tests to run."
+ else:
+ # Later we need to add
+ # - all, allbut
+ # - .foo = all with the tag "foo"
+ # - .build, etc., which are implicit tags
+ # - for regression tests, selection by bug number
+ # - very simple dependencies (you need the output of a particular build
+ # test before you can run a given unit test on it!)
+
+ for test in testlist:
+ run_test(test)
+
+if __name__=='__main__':
+ main()