[Piglit] [PATCH 15/19] glean: Remove support for writing results databases.

Kenneth Graunke kenneth at whitecape.org
Mon Dec 31 18:41:04 PST 2012


At this point, Glean wasn't writing anything interesting anyway;
it was just clutter.

Since there's no need to specify a results directory on the command line
any longer, this patch also removes the -r option, making "run tests"
the default action.

This also allows us to simplify the Piglit runner framework a little:
it no longer has to pass around the results directory just to pass to
Glean.
---
 framework/core.py       |  3 +-
 framework/gleantest.py  | 11 ++-----
 piglit-run.py           |  2 +-
 tests/all.tests         | 86 ++++++++++++++++++++++++-------------------------
 tests/glean/environ.cpp | 65 -------------------------------------
 tests/glean/environ.h   |  9 ------
 tests/glean/main.cpp    | 28 ++--------------
 tests/glean/options.cpp |  1 -
 tests/glean/options.h   |  4 ---
 tests/glean/tbase.h     |  3 --
 tests/glean/test.cpp    | 35 --------------------
 tests/glean/test.h      | 26 ---------------
 tests/sanity.tests      |  4 +--
 13 files changed, 51 insertions(+), 226 deletions(-)

diff --git a/framework/core.py b/framework/core.py
index 5a97dba..73a238d 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -573,10 +573,9 @@ class TestProfile:
 ##### Loaders
 #############################################################################
 
-def loadTestProfile(filename, resdir):
+def loadTestProfile(filename):
 	ns = {
 		'__file__': filename,
-		'res_dir': resdir
 	}
 	try:
 		execfile(filename, ns)
diff --git a/framework/gleantest.py b/framework/gleantest.py
index f61f232..1143ebf 100644
--- a/framework/gleantest.py
+++ b/framework/gleantest.py
@@ -32,22 +32,15 @@ from exectest import ExecTest
 def gleanExecutable():
 	return testBinDir + 'glean'
 
-def gleanResultDir(r_dir):
-	return os.path.join(r_dir, 'glean')
-
 class GleanTest(ExecTest):
 	globalParams = []
 
-	def __init__(self, name, resdir):
+	def __init__(self, name):
 		ExecTest.__init__(self, \
-			[gleanExecutable(), "-r", os.path.join(gleanResultDir(resdir), name),
+			[gleanExecutable(),
 			"-o",
 			"-v", "-v", "-v",
 			"-t", "+"+name])
-
-		if resdir[0] not in '$%':
-			checkDir(os.path.join(gleanResultDir(resdir), name), False)
-
 		self.name = name
 
 	def run(self, valgrind):
diff --git a/piglit-run.py b/piglit-run.py
index ced8160..9713277 100755
--- a/piglit-run.py
+++ b/piglit-run.py
@@ -185,7 +185,7 @@ def main():
 	for (key, value) in env.collectData().items():
 		json_writer.write_dict_item(key, value)
 
-	profile = core.loadTestProfile(profileFilename, resultsDir)
+	profile = core.loadTestProfile(profileFilename)
 
 	json_writer.write_dict_key('tests')
 	json_writer.open_dict()
diff --git a/tests/all.tests b/tests/all.tests
index e72e164..8ef4e6d 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -86,64 +86,64 @@ def add_fbo_depthstencil_tests(group, format):
 	group[prefix + 'depthstencil-' + format + '-blit'] = PlainExecTest(['fbo-depthstencil', '-auto', 'blit', format])
 
 glean = Group()
-glean['basic'] = GleanTest('basic', res_dir)
-glean['api2'] = GleanTest('api2', res_dir)
-glean['makeCurrent'] = GleanTest('makeCurrent', res_dir)
-glean['blendFunc'] = GleanTest('blendFunc', res_dir)
-glean['bufferObject'] = GleanTest('bufferObject', res_dir)
-glean['clipFlat'] = GleanTest('clipFlat', res_dir)
-glean['depthStencil'] = GleanTest('depthStencil', res_dir)
-glean['fbo'] = GleanTest('fbo', res_dir)
-glean['fpexceptions'] = GleanTest('fpexceptions', res_dir)
-glean['getString'] = GleanTest('getString', res_dir)
-glean['logicOp'] = GleanTest('logicOp', res_dir)
-glean['maskedClear'] = GleanTest('maskedClear', res_dir)
-glean['occluquery'] = GleanTest('occluQry', res_dir)
-glean['orthoPosRandTris'] = GleanTest('orthoPosRandTris', res_dir)
-glean['orthoPosRandRects'] = GleanTest('orthoPosRandRects', res_dir)
-glean['orthoPosTinyQuads'] = GleanTest('orthoPosTinyQuads', res_dir)
-glean['orthoPosHLines'] = GleanTest('orthoPosHLines', res_dir)
-glean['orthoPosVLines'] = GleanTest('orthoPosVLines', res_dir)
-glean['orthoPosPoints'] = GleanTest('orthoPosPoints', res_dir)
-glean['paths'] = GleanTest('paths', res_dir)
-glean['pbo'] = GleanTest('pbo', res_dir)
-glean['polygonOffset'] = GleanTest('polygonOffset', res_dir)
-glean['pixelFormats'] = GleanTest('pixelFormats', res_dir)
-glean['pointAtten'] = GleanTest('pointAtten', res_dir)
-glean['pointSprite'] = GleanTest('pointSprite', res_dir)
+glean['basic'] = GleanTest('basic')
+glean['api2'] = GleanTest('api2')
+glean['makeCurrent'] = GleanTest('makeCurrent')
+glean['blendFunc'] = GleanTest('blendFunc')
+glean['bufferObject'] = GleanTest('bufferObject')
+glean['clipFlat'] = GleanTest('clipFlat')
+glean['depthStencil'] = GleanTest('depthStencil')
+glean['fbo'] = GleanTest('fbo')
+glean['fpexceptions'] = GleanTest('fpexceptions')
+glean['getString'] = GleanTest('getString')
+glean['logicOp'] = GleanTest('logicOp')
+glean['maskedClear'] = GleanTest('maskedClear')
+glean['occluquery'] = GleanTest('occluQry')
+glean['orthoPosRandTris'] = GleanTest('orthoPosRandTris')
+glean['orthoPosRandRects'] = GleanTest('orthoPosRandRects')
+glean['orthoPosTinyQuads'] = GleanTest('orthoPosTinyQuads')
+glean['orthoPosHLines'] = GleanTest('orthoPosHLines')
+glean['orthoPosVLines'] = GleanTest('orthoPosVLines')
+glean['orthoPosPoints'] = GleanTest('orthoPosPoints')
+glean['paths'] = GleanTest('paths')
+glean['pbo'] = GleanTest('pbo')
+glean['polygonOffset'] = GleanTest('polygonOffset')
+glean['pixelFormats'] = GleanTest('pixelFormats')
+glean['pointAtten'] = GleanTest('pointAtten')
+glean['pointSprite'] = GleanTest('pointSprite')
 # exactRGBA is not included intentionally, because it's too strict and
 # the equivalent functionality is covered by other tests
-glean['readPixSanity'] = GleanTest('readPixSanity', res_dir)
-glean['scissor'] = GleanTest('scissor', res_dir)
-glean['shaderAPI'] = GleanTest('shaderAPI', res_dir)
-glean['stencil2'] = GleanTest('stencil2', res_dir)
-glean['texCombine'] = GleanTest('texCombine', res_dir)
-glean['texCube'] = GleanTest('texCube', res_dir)
-glean['texEnv'] = GleanTest('texEnv', res_dir)
-glean['texgen'] = GleanTest('texgen', res_dir)
-glean['texRect'] = GleanTest('texRect', res_dir)
-glean['texCombine4'] = GleanTest('texCombine4', res_dir)
-glean['texSwizzle'] = GleanTest('texSwizzle', res_dir)
-glean['texture_srgb'] = GleanTest('texture_srgb', res_dir)
-glean['texUnits'] = GleanTest('texUnits', res_dir)
-glean['vertArrayBGRA'] = GleanTest('vertArrayBGRA', res_dir)
-glean['vertattrib'] = GleanTest('vertattrib', res_dir)
+glean['readPixSanity'] = GleanTest('readPixSanity')
+glean['scissor'] = GleanTest('scissor')
+glean['shaderAPI'] = GleanTest('shaderAPI')
+glean['stencil2'] = GleanTest('stencil2')
+glean['texCombine'] = GleanTest('texCombine')
+glean['texCube'] = GleanTest('texCube')
+glean['texEnv'] = GleanTest('texEnv')
+glean['texgen'] = GleanTest('texgen')
+glean['texRect'] = GleanTest('texRect')
+glean['texCombine4'] = GleanTest('texCombine4')
+glean['texSwizzle'] = GleanTest('texSwizzle')
+glean['texture_srgb'] = GleanTest('texture_srgb')
+glean['texUnits'] = GleanTest('texUnits')
+glean['vertArrayBGRA'] = GleanTest('vertArrayBGRA')
+glean['vertattrib'] = GleanTest('vertattrib')
 
 def add_glsl1(name):
 	testname = 'glsl1-' + name
-	glean[testname] = GleanTest('glsl1', res_dir)
+	glean[testname] = GleanTest('glsl1')
 	glean[testname].env['PIGLIT_TEST'] = name
 execfile(testsDir + '/glean-glsl1.tests')
 
 def add_fp1(name):
 	testname = 'fp1-' + name
-	glean[testname] = GleanTest('fragProg1', res_dir)
+	glean[testname] = GleanTest('fragProg1')
 	glean[testname].env['PIGLIT_TEST'] = name
 execfile(testsDir + '/glean-fragProg1.tests')
 
 def add_vp1(name):
 	testname = 'vp1-' + name
-	glean[testname] = GleanTest('vertProg1', res_dir)
+	glean[testname] = GleanTest('vertProg1')
 	glean[testname].env['PIGLIT_TEST'] = name
 execfile(testsDir + '/glean-vertProg1.tests')
 
diff --git a/tests/glean/environ.cpp b/tests/glean/environ.cpp
index c690677..824d24f 100644
--- a/tests/glean/environ.cpp
+++ b/tests/glean/environ.cpp
@@ -59,71 +59,6 @@ Environment::Environment(Options& opt):
     log(cout),
     winSys(opt)
 {
-#   if defined(__UNIX__)
-
-	// If running tests, first create the results directory.
-	// Refuse to overwrite one that already exists.
-	if (opt.mode == Options::run) {
-		if (opt.overwrite) {
-			// remove existing db dir
-			// XXX using system() probably isn't ideal
-			char cmd[1000];
-			snprintf(cmd, 999, "rm -rf %s", opt.db1Name.c_str());
-			system(cmd);
-		}
-		if (mkdir(opt.db1Name.c_str(), 0755)) {
-			if (errno == EEXIST)
-				throw DBExists();
-			else
-				throw DBCantOpen(opt.db1Name);
-		}
-	}
-
-#   elif defined(__MS__)
-	// If running tests, first create the results directory.
-	// Refuse to overwrite one that already exists.
-	if (opt.mode == Options::run) {
-		if (opt.overwrite) {
-			char cmd[1000];
-#if defined(_MSC_VER)
-			_snprintf(cmd, 999, "rd /s /q %s", opt.db1Name.c_str());
-#else
-			snprintf(cmd, 999, "rd /s /q %s", opt.db1Name.c_str());
-#endif
-			system(cmd);
-		}
-		if (!CreateDirectory(opt.db1Name.c_str(),0)) {
-			if (GetLastError() == ERROR_ALREADY_EXISTS)
-				throw DBExists();
-			else
-				throw DBCantOpen(opt.db1Name);
-		}
-	}
-
-#   endif
 } // Environment::Environment()
 
-///////////////////////////////////////////////////////////////////////////////
-// Results-file access utilities
-///////////////////////////////////////////////////////////////////////////////
-string
-Environment::resultFileName(string& dbName, string& testName) {
-#   if defined(__UNIX__)
-	string dirName(dbName + '/' + testName);
-	if (mkdir(dirName.c_str(), 0755)) {
-		if (errno != EEXIST)
-			throw DBCantOpen(dirName);
-	}
-	string fileName(dirName + "/results");
-#   elif defined(__MS__)
-	string dirName(dbName + '/' + testName);
-	if (!CreateDirectory(dirName.c_str(),0)) {
-		if (GetLastError() != ERROR_ALREADY_EXISTS)
-			throw DBCantOpen(dirName);
-	}
-	string fileName(dirName + "/results");
-#   endif
-	return fileName;
-} // Environment::resultFileName
-
 } // namespace GLEAN
diff --git a/tests/glean/environ.h b/tests/glean/environ.h
index b8e4a50..2970c7f 100644
--- a/tests/glean/environ.h
+++ b/tests/glean/environ.h
@@ -69,15 +69,6 @@ class Environment {
 
 	WindowSystem winSys;	// The window system providing the OpenGL
 				// implementation under test.
-
-	string resultFileName(string& dbName, string& testName);
-				// Return name of results file for given
-				// test.  Suitable for opening a stream.
-				// XXX Creates results directory as a side
-				// effect.  Should separate this.
-	inline string resultFileName(string& testName) {
-		return resultFileName(options.db1Name, testName);
-	}
 }; // class Environment
 
 } // namespace GLEAN
diff --git a/tests/glean/main.cpp b/tests/glean/main.cpp
index 5b8ce1a..91d1419 100644
--- a/tests/glean/main.cpp
+++ b/tests/glean/main.cpp
@@ -68,6 +68,7 @@ main(int argc, char* argv[]) {
                 allTestNames.push_back(t->name);
         sort(allTestNames.begin(), allTestNames.end());
         o.selectedTests = allTestNames;
+	o.mode = Options::run;
 
 	for (int i = 1; i < argc; ++i) {
 		if (!strcmp(argv[i], "--help")) {
@@ -75,11 +76,6 @@ main(int argc, char* argv[]) {
 		} else if (!strcmp(argv[i], "-v")
 		    || !strcmp(argv[i], "--verbose")) {
 			++o.verbosity;
-		} else if (!strcmp(argv[i], "-r")
-		    || !strcmp(argv[i], "--run")) {
-			o.mode = Options::run;
-			++i;
-			o.db1Name = mandatoryArg(argc, argv, i);
 		} else if (!strcmp(argv[i], "-o")
 		    || !strcmp(argv[i], "--overwrite")) {
 			o.overwrite = true;
@@ -106,9 +102,6 @@ main(int argc, char* argv[]) {
 		}
 	}
 
-	if (o.mode == Options::notSet)
-		usage(argv[0]);
-
 	if (o.mode == Options::listtests) {
 		listTests(Test::testList, o.verbosity);
 		exit(0);
@@ -157,20 +150,6 @@ main(int argc, char* argv[]) {
 		cerr << "^ " << e.err << '\n';
 		exit(1);
 	}
-	catch (Environment::DBExists) {
-		cerr << "Won't overwrite existing database " << o.db1Name
-			<< "\n";
-		exit(1);
-	}
-	catch (Environment::DBCantOpen e) {
-		cerr << "Can't open database directory " << *e.db << "\n";
-		exit(1);
-	}
-	catch (Test::CantOpenResultsFile e) {
-		cerr << "Can't open results file for test " << e.testName
-			<< " in database " << e.dbName << '\n';
-		exit(1);
-	}
 	catch (...) {
 		cerr << "caught an unexpected error in main()\n";
 		exit(1);
@@ -290,10 +269,7 @@ listTests(const Test *tests, bool verbose) {
 void
 usage(char* command) {
 	cerr << GLEAN::versionString << '\n';
-	cerr << "Usage:  " << command << " mode [options]\n"
-"\n"
-"mode:\n"
-"       (-r|--run) results-directory\n"
+	cerr << "Usage:  " << command << " [options]\n"
 "\n"
 "options:\n"
 "       (-v|--verbose)             # each occurrence increases\n"
diff --git a/tests/glean/options.cpp b/tests/glean/options.cpp
index a221a91..9c39388 100644
--- a/tests/glean/options.cpp
+++ b/tests/glean/options.cpp
@@ -43,7 +43,6 @@ namespace GLEAN {
 Options::Options() {
 	mode = notSet;
 	verbosity = 0;
-	db1Name = "results";
 	visFilter = "1";
 	maxVisuals = ~0U;
 	selectedTests.resize(0);
diff --git a/tests/glean/options.h b/tests/glean/options.h
index c68dc71..4332177 100644
--- a/tests/glean/options.h
+++ b/tests/glean/options.h
@@ -64,10 +64,6 @@ class Options {
 	int verbosity;		// Verbosity level.  0 == concise; larger
 				// values imply more verbose output.
 
-	string db1Name;		// Name of output database.
-				// Typically the pathname of a directory,
-				// provided on the command line.
-
 	string visFilter;	// Filter constraining the set of visuals
 				// (FBConfigs, pixel formats) that will be
 				// available for test.  See
diff --git a/tests/glean/tbase.h b/tests/glean/tbase.h
index d4f283f..5e2feff 100644
--- a/tests/glean/tbase.h
+++ b/tests/glean/tbase.h
@@ -286,8 +286,6 @@ public:
 		WindowSystem& ws = env->winSys;
 
 		try {
-			OutputStream os(*this);	// open results file
-
 			// Select the drawing configurations for testing
 			DrawingSurfaceFilter f(filter);
 			vector<DrawingSurfaceConfig*>
@@ -335,7 +333,6 @@ public:
 
 				// Save the result
 				results.push_back(r);
-				r->put(os);
 
 				// if testOne, skip remaining surface configs
 				if (testOne)
diff --git a/tests/glean/test.cpp b/tests/glean/test.cpp
index f94680f..e67b33f 100644
--- a/tests/glean/test.cpp
+++ b/tests/glean/test.cpp
@@ -80,39 +80,4 @@ Test::Test(const char* testName, const char *descrip, Test** thePrereqs):
 Test::~Test() {
 } // Test::~Test
 
-///////////////////////////////////////////////////////////////////////////////
-// Stream opening utilities for results databases
-///////////////////////////////////////////////////////////////////////////////
-
-Test::OutputStream::OutputStream(Test& t) {
-	s = new ofstream(t.env->resultFileName(t.name).c_str());
-	if (!*s)
-		throw Test::CantOpenResultsFile(t.name, t.env->options.db1Name);
-} // Test::OutputStream::OutputStream
-
-Test::OutputStream::~OutputStream() {
-	s->close();
-	delete s;
-} // Test::OutputStream::~OutputStream
-
-Test::OutputStream::operator ofstream& () {
-	return *s;
-} // Test::OutputStream::operator ::ofstream&
-
-Test::Input1Stream::Input1Stream(Test& t) {
-	s = new ifstream(t.env->resultFileName(
-		t.env->options.db1Name, t.name).c_str());
-	if (!*s)
-		throw Test::CantOpenResultsFile(t.name, t.env->options.db1Name);
-} // Test::Input1Stream::Input1Stream
-
-Test::Input1Stream::~Input1Stream() {
-	s->close();
-	delete s;
-} // Test::Input1Stream::~Input1Stream
-
-Test::Input1Stream::operator ifstream& () {
-	return *s;
-} // Test::Input1Stream::operator ::ifstream&
-
 } // namespace GLEAN
diff --git a/tests/glean/test.h b/tests/glean/test.h
index d0f500b..540faac 100644
--- a/tests/glean/test.h
+++ b/tests/glean/test.h
@@ -100,32 +100,6 @@ class Test {
 
 	// Exceptions:
 	struct Error { };	// Base class for all exceptions.
-	struct CantOpenResultsFile: public Error {
-		const string& testName;
-		const string& dbName;
-		CantOpenResultsFile(const string& test, const string& db):
-			testName(test), dbName(db) { }
-	};
-
-
-	// OutputStream and Input*Stream objects provide convenient access
-	// to the results database, and close the file streams automatically
-	// when their destructors are executed.
-	class OutputStream {	// Open an output stream for storing results.
-	    public:
-		ofstream* s;
-		OutputStream(Test& t);
-		~OutputStream();
-		operator ofstream& ();
-	};
-	class Input1Stream {	// Open db #1 input stream for reading results.
-	    public:
-		ifstream* s;
-	    	Input1Stream(Test& t);
-		~Input1Stream();
-		operator ifstream& ();
-	};
-
 
 	static Test* testList;	// List of all test objects.  Built by
 				// constructor Test::Test(...).
diff --git a/tests/sanity.tests b/tests/sanity.tests
index 035cfb9..baff0db 100644
--- a/tests/sanity.tests
+++ b/tests/sanity.tests
@@ -6,8 +6,8 @@ from framework.core import *
 from framework.gleantest import *
 
 glean = Group()
-glean['basic'] = GleanTest('basic', res_dir)
-glean['readPixSanity'] = GleanTest('readPixSanity', res_dir)
+glean['basic'] = GleanTest('basic')
+glean['readPixSanity'] = GleanTest('readPixSanity')
 
 profile = TestProfile()
 profile.tests['glean'] = glean
-- 
1.8.0.3



More information about the Piglit mailing list