Changeset f89b45 for tests/regression


Ignore:
Timestamp:
Nov 7, 2011, 4:13:18 PM (13 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
f894fe
Parents:
55f299
git-author:
Frederik Heber <heber@…> (11/02/11 01:13:59)
git-committer:
Frederik Heber <heber@…> (11/07/11 16:13:18)
Message:

Added Reaction CalculateBoundingBoxAction.

exporting std::vector<double> as return value.

  • had to add trick with exporting std::vector<double> to python with help from stackoverflow("does boost python support a function returning a vector, by ref or value?") answer. We construct a vec_item template class which exports getter/setter, append, ... functionality to python.
  • This ends in typedef doubleVec in namespace MoleCuilder::PythonTypes, while within the Reaction its just a typedef defined in the .def file.
  • this type had to be prefix with PythonType_ to make it distinguishable from the functions in dir(mol) for Python/AllActions regression test.
  • TESTFIX: Also we modified Python/AllActions regression test to go in a loop over each command, thus stdout and stderr can be uniquely associated to the very command that caused them. This makes debugging a lot easier ... for this purpose the dir(mol) and filtering was placed into new listcmds.py.
Location:
tests/regression
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • tests/regression/Analysis/testsuite-analysis.at

    r55f299 rf89b45  
    3030# calculates molar mass
    3131m4_include([Analysis/CalculateMolarMass/testsuite-analysis-calculate-molar-mass.at])
     32
     33# calculates bounding box
     34m4_include([Analysis/CalculateBoundingBox/testsuite-analysis-calculate-bounding-box.at])
  • tests/regression/Makefile.am

    r55f299 rf89b45  
    3434        $(srcdir)/Atoms/Translation/testsuite-atoms-translation.at \
    3535        $(srcdir)/Analysis/testsuite-analysis.at \
     36        $(srcdir)/Analysis/CalculateBoundingBox/testsuite-analysis-calculate-bounding-box.at \
    3637        $(srcdir)/Analysis/CalculateCellVolume/testsuite-analysis-calculate-cell-volume.at \
    3738        $(srcdir)/Analysis/CalculateMolarMass/testsuite-analysis-calculate-molar-mass.at \
  • tests/regression/Python/AllActions/moltest.py

    r55f299 rf89b45  
    1010import sys, re, subprocess
    1111
    12 cmds =  filter(lambda s: s[0] != '_', dir(mol))
     12# cmd given?
     13if len(sys.argv) < 1:
     14  sys.stderr.write("Usage: "+sys.argv[0]+" <cmd>\n")
     15  sys.exit(255)
     16
     17cmd = sys.argv[1]
    1318
    1419# options.dat einlesen
     
    4752    return result
    4853
    49 for cmd in cmds:
    50     doc = eval('mol.%s.__doc__' % cmd)
    51     params = ParseParameters(doc)
    52    
    53     print '--BEGIN-- %s mit %s --------' % (cmd, params)
     54doc = eval('mol.%s.__doc__' % cmd)
     55params = ParseParameters(doc)
     56
     57print '--BEGIN-- %s mit %s --------' % (cmd, params)
    5458   
    55     # write command to file
    56     output=open("test.py", "w")
    57     output.write('import pyMoleCuilder as mol\nparams = %s\nmol.%s(*params)\n' % (params, cmd))
    58     output.close()
    59     # call python externally on this file and catch retcode
    60     p = subprocess.Popen(["python", "test.py"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    61     stdout, stderr = p.communicate()
    62     print ' --- STDOUT ---'
    63     print ' %s ' % (stdout)
    64     print ' --- STDERR ---'
    65     print ' %s ' % (stderr)
    66     retcode = p.returncode
    67     if retcode == 134 or retcode == 0:
    68       print ' ---- ok ----'
    69     else:
    70       print ' -- FAILED with %s --' % (retcode)
    71     #exec('mol.%s(*params)' % cmd)
    72    
    73     print '---END--- %s mit %s --------' % (cmd, params)
     59# write command to file
     60output=open("test.py", "w")
     61output.write('import pyMoleCuilder as mol\nparams = %s\nmol.%s(*params)\n' % (params, cmd))
     62output.close()
     63# call python externally on this file and catch retcode
     64p = subprocess.Popen(["python", "test.py"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     65stdout, stderr = p.communicate()
     66print ' --- STDOUT ---'
     67print ' %s ' % (stdout)
     68print ' --- STDERR ---'
     69print ' %s ' % (stderr)
     70retcode = p.returncode
     71if retcode == 134 or retcode == 0:
     72  print ' ---- ok ----'
     73else:
     74  print ' -- FAILED with %s --' % (retcode)
     75#  if retcode == 1:
     76#    sys.exit(1)
     77#exec('mol.%s(*params)' % cmd)
     78
     79print '---END--- %s mit %s --------' % (cmd, params)
    7480
    7581sys.exit(0)
  • tests/regression/Python/AllActions/options.dat

    r55f299 rf89b45  
    3333bond-file       "bond.dat"
    3434bond-table      "table.dat"
     35calculate-bounding-box  ""
    3536calculate-molar-mass    ""
    3637center-in-box   "10 0 0 10 0 10"
  • tests/regression/Python/AllActions/testsuite-python-allactions.at

    r55f299 rf89b45  
    99AT_CHECK([../../Python/run test.py], 1, [ignore], [stderr])
    1010AT_CHECK([fgrep "object has no attribute" stderr], 0, [ignore], [ignore])
     11AT_CHECK([../../Python/run ${abs_top_srcdir}/tests/regression/Python/AllActions/listcmds.py], 0, [stdout], [ignore])
    1112AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/regression/Python/AllActions/options.dat .],  0, [ignore], [ignore])
    12 AT_CHECK([../../Python/run ${abs_top_srcdir}/tests/regression/Python/AllActions/moltest.py], 0, [stdout], [ignore])
     13for cmd in `head -n 1 stdout`
     14do
     15        AT_CHECK([echo "Checking presence of $cmd ..."], 0, [ignore], [ignore])
     16        AT_CHECK([../../Python/run ${abs_top_srcdir}/tests/regression/Python/AllActions/moltest.py $cmd], 0, [stdout], [ignore])
     17done
    1318AT_CLEANUP
Note: See TracChangeset for help on using the changeset viewer.