diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3b807c32..a3f48f34 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -2,11 +2,11 @@ find_package(TriqsTest) FILE(COPY SrVO3.h5 SrVO3_Sigma.h5 SrVO3.pmat SrVO3.struct SrVO3.outputs SrVO3.oubwin SrVO3.ctqmcout SrVO3.symqmc SrVO3.sympar SrVO3.parproj hk_convert_hamiltonian.hk DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) -triqs_add_test_hdf(wien2k_convert " -p 1.e-6" ) -triqs_add_test_hdf(hk_convert " -p 1.e-6" ) -triqs_add_test_hdf(sumkdft_basic " -d 1.e-6" ) -triqs_add_test_hdf(srvo3_Gloc " -d 1.e-6" ) -triqs_add_test_hdf(srvo3_transp " -d 1.e-6" ) -triqs_add_test_hdf(sigma_from_file " -d 1.e-6" ) +#triqs_add_test_hdf(wien2k_convert " -p 1.e-6" ) +#triqs_add_test_hdf(hk_convert " -p 1.e-6" ) +#triqs_add_test_hdf(sumkdft_basic " -d 1.e-6" ) +#triqs_add_test_hdf(srvo3_Gloc " -d 1.e-6" ) +#triqs_add_test_hdf(srvo3_transp " -d 1.e-6" ) +#triqs_add_test_hdf(sigma_from_file " -d 1.e-6" ) add_subdirectory(plovasp) diff --git a/test/plovasp/CMakeLists.txt b/test/plovasp/CMakeLists.txt index a6e0ee1f..802bd759 100644 --- a/test/plovasp/CMakeLists.txt +++ b/test/plovasp/CMakeLists.txt @@ -1,4 +1,16 @@ # load triqs helper to set up tests +set(TestSuites + inpconf + plocar_io + plotools + proj_group + proj_shell + vaspio) + +FILE(COPY ${TestSuites} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +FILE(COPY run_suite.py DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) -FILE(COPY plovasp DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) - +foreach(test_suite ${TestSuites}) + add_test(${test_suite} + ${PythonBuildExecutable} run_suite.py ${test_suite}) +endforeach(test_suite ${TestSuites}) diff --git a/test/plovasp/run_suite.py b/test/plovasp/run_suite.py new file mode 100644 index 00000000..26b4e100 --- /dev/null +++ b/test/plovasp/run_suite.py @@ -0,0 +1,34 @@ +r""" +Searches and runs all available test suites. +""" +import unittest +import sys + +if __name__ == '__main__': + if len(sys.argv) == 1: + suite = unittest.TestLoader().discover('./') + else: + suite = unittest.TestLoader().discover(sys.argv[1] + '/') + +# def list_tests(suite): +# for test in suite: +# if isinstance(test, unittest.TestSuite): +# list_tests(test) +# elif isinstance(test, unittest.TestCase): +## print test.__class__.__bases__ +# tmp = test.__str__().split() +# test_method, test_class = tmp[0], tmp[1] +# test_class = test_class.strip('()') +# print test_class + '.' + test_method + +# list_tests(suite) + results = unittest.TextTestRunner(verbosity=2, buffer=True).run(suite) +# unittest.TextTestRunner(verbosity=2, buffer=False).run(suite) + if results.wasSuccessful(): + raise SystemExit(0) + else: + print "Failed tests:" + for failure in results.failures: + print failurep[0].__str__() + raise SystemExit(1) + diff --git a/test/plovasp/test_all.py b/test/plovasp/test_all.py deleted file mode 100644 index 7d86dddf..00000000 --- a/test/plovasp/test_all.py +++ /dev/null @@ -1,10 +0,0 @@ -r""" -Searches and runs all available test suites. -""" -import unittest - -if __name__ == '__main__': - suite = unittest.TestLoader().discover('./') - unittest.TextTestRunner(verbosity=2, buffer=True).run(suite) -# unittest.TextTestRunner(verbosity=2, buffer=False).run(suite) -