[mlpack-svn] r15811 - in mlpack/conf/jenkins-conf/benchmark: . tests

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Wed Sep 18 11:49:13 EDT 2013


Author: marcus
Date: Wed Sep 18 11:49:13 2013
New Revision: 15811

Log:
Makefile: add unittest option.

Modified:
   mlpack/conf/jenkins-conf/benchmark/Makefile
   mlpack/conf/jenkins-conf/benchmark/tests/tests.py

Modified: mlpack/conf/jenkins-conf/benchmark/Makefile
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/Makefile	(original)
+++ mlpack/conf/jenkins-conf/benchmark/Makefile	Wed Sep 18 11:49:13 2013
@@ -53,6 +53,7 @@
 memory: .check .memory
 reports: .check .reports
 scripts: .scripts
+checks: .check .checks
 
 .help:
 	@echo "Benchmark-Script"
@@ -127,3 +128,6 @@
 	javac -cp $(shell echo $(WEKA_CLASSPATH)) -d methods/weka methods/weka/src/*.java
 	# Compile the shogun K-Means (with initial centroids) Clustering method.
 	g++ -O0 methods/shogun/src/kmeans.cpp -o methods/shogun/kmeans -I$(SHOGUN_PATH)/include -L$(SHOGUN_PATH)/lib -lshogun
+
+.checks:
+	$(PYTHON_BIN) $(BENCHMARKDDIR)/tests/tests.py

Modified: mlpack/conf/jenkins-conf/benchmark/tests/tests.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/tests/tests.py	(original)
+++ mlpack/conf/jenkins-conf/benchmark/tests/tests.py	Wed Sep 18 11:49:13 2013
@@ -1,6 +1,7 @@
 import unittest
 
-testmodules = [
+# Test modules.
+modules = [
 'benchmark_allkfn',
 'benchmark_allknn',
 'benchmark_allkrann',
@@ -27,14 +28,12 @@
 'benchmark_sparse_coding'
 ]
 
-suite = unittest.TestSuite()
+if __name__ == '__main__':
+  suite = unittest.TestSuite()
 
-for t in testmodules:
-  try:
-    mod = __import__(t, globals(), locals(), ['suite'])
-    suitefn = getattr(mod, 'suite')
-    suite.addTest(suitefn())
-  except (ImportError, AttributeError):
-    suite.addTest(unittest.defaultTestLoader.loadTestsFromName(t))
+  # Add the modules to the suite.
+  for t in modules:
+      suite.addTest(unittest.defaultTestLoader.loadTestsFromName(t))
 
-unittest.TextTestRunner().run(suite)
+  # Run all modules (Testsuite).
+  unittest.TextTestRunner().run(suite)



More information about the mlpack-svn mailing list