Skip to content
Snippets Groups Projects
Commit f47eee7b authored by Pospelov, Gennady's avatar Pospelov, Gennady
Browse files

Removed *.pro machinery from FunctionalTestCore

parent 5a078678
No related branches found
No related tags found
No related merge requests found
Showing with 12 additions and 223 deletions
#include "FunctionalTestRegistry.h"
#include "Exceptions.h"
#include "Utils.h"
#include <iostream>
#include <iomanip>
......@@ -105,10 +106,18 @@ void FunctionalTestRegistry::Catalogue::print()
std::cout << "--- FunctionalTestRegistry::Catalogue::print() ---" << std::endl;
for(catalogue_t::iterator it = m_data.begin(); it!= m_data.end(); ++it) {
FunctionalTestInfo &info = (*it).second;
std::cout << std::setw(12) << std::left << info.m_name << " | "
<< std::setw(24) << std::left << info.m_description << " | "
<< std::setw(12) << std::left << info.m_reference_file << " | "
// std::cout << std::setw(21) << std::left << info.m_name << " | "
// << std::setw(34) << std::left << info.m_description << " | "
// << std::setw(12) << std::left << info.m_reference_file << " | "
// << std::setw(6) << std::left << info.m_threshold << std::endl;
std::cout << Utils::AdjustStringLength(info.m_name, 20) << " | "
<< Utils::AdjustStringLength(info.m_description, 40) << " | "
<< Utils::AdjustStringLength(info.m_reference_file, 40) << " | "
<< std::setw(6) << std::left << info.m_threshold << std::endl;
}
}
......
TEMPLATE = app
CONFIG += console
CONFIG -= qt app_bundle
QT -= core gui
include($$PWD/../../../../shared.pri)
DEFINES += STANDALONE
INCLUDEPATH *= $$EIGEN_INCLUDE_DIR
INCLUDEPATH *= $$BOOST_INCLUDE_DIR
INCLUDEPATH += $$BornAgainCore_INCLUDE_DIR
LIBS += $$BOOST_LIBRARY $$BornAgainCore_LIBRARY
SOURCES += IsGISAXS01.cpp
HEADERS += IsGISAXS01.h
TEMPLATE = app
CONFIG += console
CONFIG -= qt app_bundle
QT -= core gui
include($$PWD/../../../../shared.pri)
DEFINES += STANDALONE
INCLUDEPATH *= $$EIGEN_INCLUDE_DIR
INCLUDEPATH *= $$BOOST_INCLUDE_DIR
INCLUDEPATH += $$BornAgainCore_INCLUDE_DIR
LIBS += $$BOOST_LIBRARY $$BornAgainCore_LIBRARY
SOURCES += IsGISAXS02.cpp
HEADERS += IsGISAXS02.h
TEMPLATE = app
CONFIG += console
CONFIG -= qt app_bundle
QT -= core gui
include($$PWD/../../../../shared.pri)
DEFINES += STANDALONE
INCLUDEPATH *= $$EIGEN_INCLUDE_DIR
INCLUDEPATH *= $$BOOST_INCLUDE_DIR
INCLUDEPATH += $$BornAgainCore_INCLUDE_DIR
LIBS += $$BOOST_LIBRARY $$BornAgainCore_LIBRARY
SOURCES += IsGISAXS07.cpp
HEADERS += IsGISAXS07.h
TEMPLATE = app
CONFIG += console
CONFIG -= qt app_bundle
QT -= core gui
include($$PWD/../../../../shared.pri)
DEFINES += STANDALONE
INCLUDEPATH *= $$EIGEN_INCLUDE_DIR
INCLUDEPATH *= $$BOOST_INCLUDE_DIR
INCLUDEPATH += $$BornAgainCore_INCLUDE_DIR
LIBS += $$BOOST_LIBRARY $$BornAgainCore_LIBRARY
SOURCES += IsGISAXS10.cpp
HEADERS += IsGISAXS10.h
TEMPLATE = app
CONFIG += console
CONFIG -= qt app_bundle
QT -= core gui
include($$PWD/../../../../shared.pri)
DEFINES += STANDALONE
INCLUDEPATH *= $$EIGEN_INCLUDE_DIR
INCLUDEPATH *= $$BOOST_INCLUDE_DIR
INCLUDEPATH += $$BornAgainCore_INCLUDE_DIR
LIBS += $$BOOST_LIBRARY $$BornAgainCore_LIBRARY
SOURCES += IsGISAXS11.cpp
HEADERS += IsGISAXS11.h
TEMPLATE = app
CONFIG += console
CONFIG -= qt app_bundle
QT -= core gui
include($$PWD/../../../../shared.pri)
DEFINES += STANDALONE
INCLUDEPATH *= $$EIGEN_INCLUDE_DIR
INCLUDEPATH *= $$BOOST_INCLUDE_DIR
INCLUDEPATH += $$BornAgainCore_INCLUDE_DIR
LIBS += $$BOOST_LIBRARY $$BornAgainCore_LIBRARY
SOURCES += IsGISAXS15.cpp
HEADERS += IsGISAXS15.h
TEMPLATE = app
CONFIG += console
CONFIG -= qt app_bundle
QT -= core gui
include($$PWD/../../../../shared.pri)
DEFINES += STANDALONE
INCLUDEPATH *= $$EIGEN_INCLUDE_DIR
INCLUDEPATH *= $$BOOST_INCLUDE_DIR
INCLUDEPATH += $$BornAgainCore_INCLUDE_DIR
LIBS += $$BOOST_LIBRARY $$BornAgainCore_LIBRARY
SOURCES += MesoCrystal1.cpp SampleBuilder.cpp
HEADERS += MesoCrystal1.h SampleBuilder.h
TEMPLATE = subdirs
SUBDIRS += \
IsGISAXS01 \
IsGISAXS02 \
IsGISAXS03 \
IsGISAXS04 \
IsGISAXS06 \
IsGISAXS07 \
IsGISAXS08 \
IsGISAXS09 \
IsGISAXS10 \
IsGISAXS11 \
IsGISAXS15 \
MesoCrystal1
CONFIG += ordered
# Run C++ core tests for libBornAgainCore library
# Usage: python test_all.py
import sys
import os
import subprocess
import time
import platform
Tests = [
"IsGISAXS01",
"IsGISAXS02",
"IsGISAXS03",
"IsGISAXS04",
"IsGISAXS06",
"IsGISAXS07",
"IsGISAXS08",
"IsGISAXS09",
"IsGISAXS10",
"IsGISAXS11",
"IsGISAXS15",
"MesoCrystal1",
]
test_info = []
# run system command and catch multiline stdout and stderr
def run_command(command):
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell = True)
p.wait()
return iter(p.stdout.readline, b''), iter(p.stderr.readline, b'')
# parse stdout, stderr for test description and test result
def parse_output(testName, stdout, stderr):
# normally the message from test looks like "IsGISAXS01 Mixture of cylinders and prisms [OK]"
# we want to find status (FAILED or OK) and extract description "Mixture of cylinders and prisms"
status="OK"
for line in stderr:
status="FAILED" # test failed, if there are some non empty stderr messages
descr=""
for line in stdout:
if testName in line:
if "FAILED" in line: status="FAILED"
descr=line.strip(testName).strip("\n")
descr=descr.strip("[OK]")
descr=descr.strip("[FAILED]")
descr = descr[:55]
descr = descr.ljust(55).lstrip()
return descr, status
# run tests one by one
def runTests():
print ">>> Running TestCore, {0:-2d} tests total ...".format(len(Tests))
for testName in Tests:
command = testName+"/"+testName # i.e. "path/executable" like "IsGISAXS01/IsGISAXS01"
if "Windows" in platform.system(): command = testName+"\\"+testName+".exe"
path = os.path.split(__file__)[0]
if path: command = os.path.join(path, command)
print "Running test ", testName
start_time = time.time()
stdout, stderr = run_command(command)
total_time = time.time() - start_time
descr, status = parse_output(testName, stdout, stderr)
test_info.append((testName, descr, total_time, status))
return getSummary()
# making summary
def getSummary():
summary = "--------------------------------------------------------------------------------\n"
summary += "Functional Tests of libBornAgainCore (C++) \n"
summary += "--------------------------------------------------------------------------------\n"
n=1
for x in test_info:
if(x[2] < 10):
summary += '{0:2d}. {1:<13} {2:.51s} {3:.2f} [{4}] '.format(n, x[0],x[1],x[2],x[3]) + "\n"
else:
summary += '{0:2d}. {1:<13} {2:.51s} {3:.2f} [{4}] '.format(n, x[0],x[1],x[2],x[3]) + "\n"
n+=1
return summary
#-------------------------------------------------------------
# main()
#-------------------------------------------------------------
if __name__ == '__main__':
summary = runTests()
print summary
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment