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

Fix in running all python functional tests from Windows

parent cdb7eaaf
No related branches found
No related tags found
No related merge requests found
......@@ -43,6 +43,7 @@
#include "TFile.h"
#include "TDatime.h"
#include "TSystem.h"
#include <cstdlib>
std::vector<TCanvas *> DrawHelper::m_registered_canvases =
std::vector<TCanvas *>();
......@@ -66,7 +67,7 @@ void DrawHelper::ExecuteMagnifier(int event, int px, int py, TObject *sel)
if ( event == kButton1Double ) {
TCanvas *c = (TCanvas *)gTQSender;
char cname[256];
sprintf(cname,"%s_%d",c->GetTitle(),(int)time(0));
sprintf(cname,"%s_%d",c->GetTitle(),std::rand());
TPad *pad = c->Pick(px, py, 0);
TPad *pad_new = dynamic_cast<TPad *>(pad->Clone());
pad_new->SetPad(0.0, 0.0, 1.0, 1.0);
......
......@@ -5,24 +5,12 @@ include($$PWD/shared.pri)
SUBDIRS += Core
SUBDIRS += ThirdParty/gtest
SUBDIRS += Tests/UnitTests/TestCore
#TestCore.depends = ThirdParty/gtest
SUBDIRS += Tests/FunctionalTests/TestCore
#isEmpty(ROOT_FRAMEWORK) {
# message("No ROOT installation found. Additional library libRootMinimizers.so will be compiled.")
SUBDIRS += ThirdParty/RootMinimizers
#}
#SUBDIRS += ThirdParty/RootMathMore
SUBDIRS += ThirdParty/RootMinimizers
SUBDIRS += Fit
SUBDIRS += Tests/FunctionalTests/TestFit
!isEmpty(ROOT_FRAMEWORK) {
SUBDIRS += App
}
#!isEmpty(ROOT_FRAMEWORK): SUBDIRS += App
# compilation in lister order
CONFIG += ordered
......
......@@ -129,15 +129,14 @@ std::string Utils::FileSystem::GetPathToExecutable(const std::string& argv0)
}
// TODO Remove this temporary ifdef
std::string Utils::FileSystem::GetPathToData(const std::string& rel_data_path, const std::string& argv0)
{
#ifdef _WIN32
// windows build place executable in additional sub-directory 'release'
std::string result = (boost::filesystem::canonical( argv0.c_str() ).parent_path() / boost::filesystem::path("../") / boost::filesystem::path(rel_data_path)).string();
#else
//#ifdef _WIN32
// // windows build place executable in additional sub-directory 'release'
// std::string result = (boost::filesystem::canonical( argv0.c_str() ).parent_path() / boost::filesystem::path("../") / boost::filesystem::path(rel_data_path)).string();
//#else
std::string result = (boost::filesystem::canonical( argv0.c_str() ).parent_path() / boost::filesystem::path(rel_data_path)).string();
#endif
//#endif
return result;
}
......
# IsGISAXS01 example: Mixture of cylinders and prisms without interference
import sys, os, numpy
import sys, os, numpy, pylab, matplotlib
sys.path.append(os.path.abspath(
os.path.join(os.path.split(__file__)[0], '..', '..', '..', 'lib')
......@@ -8,7 +8,7 @@ sys.path.append(os.path.abspath(
sys.path.append(os.path.abspath(os.path.join(os.path.split(__file__)[0],'..')))
from libBornAgainCore import *
from utils.show2d import PlotNumpyArray
#from utils.show2d import PlotNumpyArray
# ----------------------------------
......@@ -53,7 +53,11 @@ def RunSimulation():
# main()
#-------------------------------------------------------------
if __name__ == '__main__':
result = RunSimulation()
PlotNumpyArray(result)
result = RunSimulation() + 1 # for log scale
pylab.imshow(numpy.rot90(result, 1),
norm=matplotlib.colors.LogNorm(),
extent=[-1.0, 1.0, 0, 2.0])
pylab.show()
......@@ -4,6 +4,7 @@ import sys
import os
import subprocess
import time
import platform
Tests = [
......@@ -25,7 +26,8 @@ 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)
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'')
......@@ -56,8 +58,9 @@ 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 = path + "/" + command
if path: command = os.path.join(path, command)
print "Running test ", testName
start_time = time.time()
stdout, stderr = run_command(command)
......
......@@ -5,6 +5,7 @@ import sys
import os
import subprocess
import time
import platform
Tests = [
"TestFit01",
......@@ -44,8 +45,9 @@ def runTests():
print ">>> Running TestFit, {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 = path + "/" + command
if path: command = os.path.join(path, command)
print "Running test ", testName
start_time = time.time()
stdout, stderr = run_command(command)
......
......@@ -194,7 +194,9 @@ QMAKE_CXXFLAGS_DEBUG += -fdiagnostics-show-option # to find out in gcc which opt
# Eigen alighnment under windows, warnings from boost
win32{
QMAKE_CXXFLAGS += -mincoming-stack-boundary=2 -Wno-unused-local-typedefs
QMAKE_CXXFLAGS += -mincoming-stack-boundary=2 -Wno-unused-local-typedefs -Wno-attributes -Wno-unknown-pragmas
# QMAKE_CXXFLAGS += -D_MSC_VER=1301
# QMAKE_CXXFLAGS += -DTYPENAME=typename
}
# Because of clang which knows nothing about unused_local_typedefs pragma
......@@ -222,7 +224,7 @@ macx|unix {
ROOT_FRAMEWORK = $$system(root-config --prefix)
}
win32 {
# ROOT_FRAMEWORK = "C:/root"
ROOT_FRAMEWORK = "C:/root"
}
# -----------------------------------------------------------------------------
......@@ -292,39 +294,23 @@ CONFIG(BORNAGAIN_PYTHON) {
# we do not have python
error("Can not find any sign of python")
} else {
#pythonsysincdir=$$system("$${WhichPython} -c \"import sys; sys.stdout.write(sys.prefix + \'/include/python\' + sys.version[:3])\" ")
#pythonsyslibdir=$$system("$${WhichPython} -c \"import sys; sys.stdout.write(sys.prefix + \'/libs\' )\" ")
pythonvers=$$system("$${WhichPython} -c \"import sys; sys.stdout.write(sys.version[:3])\" ")
pythonnumpy=$$system("$${WhichPython} -c \"import sys; import numpy; sys.stdout.write(numpy.get_include())\" ")
# we have python
macx|unix {
pythonsysincdir=$$system("$${WhichPython} -c \"import sys; sys.stdout.write(sys.prefix + \'/include/python\' + sys.version[:3])\" ")
pythonsyslibdir=$$system("$${WhichPython} -c \"import sys; sys.stdout.write(sys.prefix + \'/lib\' )\" ")
# pythonvers=$$system("python -c \"import sys; sys.stdout.write(sys.version[:3])\" ")
# pythonsysincdir=$$system("python -c 'import sys; sys.stdout.write(sys.prefix + \"/include/python\" + sys.version[:3])'")
# pythonsyslibdir=$$system("python -c 'import sys; sys.stdout.write(sys.prefix + \"/lib\" )'")
# pythonnumpy=$$system("python -c \"import sys; import numpy; sys.stdout.write(numpy.get_include())\" ")
}
win32 {
pythonsysincdir=$$system("$${WhichPython} -c \"import sys; sys.stdout.write(sys.prefix + \'/include')\" ")
pythonsyslibdir=$$system("$${WhichPython} -c \"import sys; sys.stdout.write(sys.prefix + \'/libs\' )\" ")
# pythonsysincdir=$${WhichPython}/include
# pythonsyslibdir=$${WhichPython}/libs
# pythonvers=$$system("$${WhichPython}/python.exe -c \"import sys; sys.stdout.write(sys.version[:3])\" ")
# pythonnumpy=$$system("$${WhichPython}/python.exe -c \"import sys; import numpy; sys.stdout.write(numpy.get_include())\" ")
}
# pythonsysincdir=$$system("$${WhichPython} -c \"import sys; sys.stdout.write(sys.prefix + \'/include/python\' + sys.version[:3])\" ")
# pythonsyslibdir=$$system("$${WhichPython} -c \"import sys; sys.stdout.write(sys.prefix + \'/libs\' )\" ")
# pythonvers=$$system("$${WhichPython} -c \"import sys; sys.stdout.write(sys.version[:3])\" ")
# pythonnumpy=$$system("$${WhichPython} -c \"import sys; import numpy; sys.stdout.write(numpy.get_include())\" ")
#message(pythonvers : $$pythonvers)
#message(pythoninc : $$pythonsysincdir)
#message(pythonlib : $$pythonsyslibdir)
#message(pythonnumpy: $$pythonnumpy)
lessThan(pythonvers, 2.6): error("BornAgain requires python 2.6 or greater")
INCLUDEPATH += $$pythonsysincdir
#LIBS += -L$$pythonsyslibdir -lpython$$pythonvers -lboost_python
macx|unix {
PYTHON_LIB_DIRECTIVE=-lpython$$pythonvers
}
......@@ -333,7 +319,7 @@ CONFIG(BORNAGAIN_PYTHON) {
}
LIBS += -lboost_python$${BOOST_LIB_SUFFIX} -L$$pythonsyslibdir $$PYTHON_LIB_DIRECTIVE
# we need to know the location of numpy
# location of numpy
!exists($$pythonnumpy/numpy/arrayobject.h): error("Can't find numpy/arrayobject.h in $$pythonnumpy, you have to install python-numpy-devel")
INCLUDEPATH += $$pythonnumpy
}
......@@ -350,3 +336,10 @@ unix {
RCC_DIR = $${OUT_PWD}/.rcc
UI_DIR = $${OUT_PWD}/.uic
}
win32 {
Release:DESTDIR = $${OUT_PWD}
Debug:DESTDIR = $${OUT_PWD}
}
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