diff --git a/test/.gitignore b/test/.gitignore deleted file mode 100644 index 5b8cd369cc6ea006e0abca96812c1da53e007b4c..0000000000000000000000000000000000000000 --- a/test/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -.DS_Store -.idea -*.log -tmp/ - -output -InclusiveNJets.str diff --git a/v2.5/generators/nlojet++/interface/check/.gitignore b/v2.5/generators/nlojet++/interface/check/.gitignore index 43baae7b81e9e4865539e02eda087f135f5fb0a6..e10473f033b235a317855e09550eb01b2777b655 100644 --- a/v2.5/generators/nlojet++/interface/check/.gitignore +++ b/v2.5/generators/nlojet++/interface/check/.gitignore @@ -3,3 +3,5 @@ fnlo-nj-*.pl fnlo-nj-*.trs *.tab *.tab.gz +output +InclusiveNJets.str diff --git a/test/InclusiveNJets_InclusiveJets_fix.wrm b/v2.5/generators/nlojet++/interface/check/InclusiveNJets_InclusiveJets_fix.wrm similarity index 100% rename from test/InclusiveNJets_InclusiveJets_fix.wrm rename to v2.5/generators/nlojet++/interface/check/InclusiveNJets_InclusiveJets_fix.wrm diff --git a/test/InclusiveNJets_InclusiveJets_flex.wrm b/v2.5/generators/nlojet++/interface/check/InclusiveNJets_InclusiveJets_flex.wrm similarity index 100% rename from test/InclusiveNJets_InclusiveJets_flex.wrm rename to v2.5/generators/nlojet++/interface/check/InclusiveNJets_InclusiveJets_flex.wrm diff --git a/v2.5/generators/nlojet++/interface/check/Makefile.am b/v2.5/generators/nlojet++/interface/check/Makefile.am index 2efe548b0ab672fb9d6c0d0bb55418d113eb8dd6..a451490702dbe862b972920e439ed378145b6c4e 100644 --- a/v2.5/generators/nlojet++/interface/check/Makefile.am +++ b/v2.5/generators/nlojet++/interface/check/Makefile.am @@ -14,7 +14,8 @@ AUTOMAKE_OPTIONS = gnu # # perl script targets to check the package (distributed, but not installed) # -dist_check_SCRIPTS = fnlo-nj-wrmtest.pl fnlo-nj-lotest.pl fnlo-nj-nlotest.pl +dist_check_SCRIPTS = fnlo-nj-wrmtest.pl fnlo-nj-lotest.pl fnlo-nj-nlotest.pl fnlo-compare-tables.py +TESTS_ENVIRONMENT = LIBDIR=$(libdir) TESTS = $(dist_check_SCRIPTS) # Additional clean up for check targets diff --git a/v2.5/generators/nlojet++/interface/check/compare-table-helper.py b/v2.5/generators/nlojet++/interface/check/compare-table-helper.py new file mode 100755 index 0000000000000000000000000000000000000000..095ab0ddefc2caf2e42609b0515772fecd9a906b --- /dev/null +++ b/v2.5/generators/nlojet++/interface/check/compare-table-helper.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 + +import os +import sys + +import fastnlo as fnlo + +LIBDIR = os.environ["LIBDIR"] + +fnlo.SetGlobalVerbosity(fnlo.DEBUG) + +table_1 = fnlo.fastNLOTable(sys.argv[1]) +table_2 = fnlo.fastNLOTable(sys.argv[2]) +assert table_1.IsEquivalent(table_2, 1e-8) diff --git a/test/fix_NodeDensity.str b/v2.5/generators/nlojet++/interface/check/fix_NodeDensity.str similarity index 100% rename from test/fix_NodeDensity.str rename to v2.5/generators/nlojet++/interface/check/fix_NodeDensity.str diff --git a/test/fix_NodesPerBin.str b/v2.5/generators/nlojet++/interface/check/fix_NodesPerBin.str similarity index 100% rename from test/fix_NodesPerBin.str rename to v2.5/generators/nlojet++/interface/check/fix_NodesPerBin.str diff --git a/test/flex_NodeDensity.str b/v2.5/generators/nlojet++/interface/check/flex_NodeDensity.str similarity index 100% rename from test/flex_NodeDensity.str rename to v2.5/generators/nlojet++/interface/check/flex_NodeDensity.str diff --git a/test/flex_NodesPerBin.str b/v2.5/generators/nlojet++/interface/check/flex_NodesPerBin.str similarity index 100% rename from test/flex_NodesPerBin.str rename to v2.5/generators/nlojet++/interface/check/flex_NodesPerBin.str diff --git a/test/compare_tables.py b/v2.5/generators/nlojet++/interface/check/fnlo-compare-tables.py old mode 100644 new mode 100755 similarity index 90% rename from test/compare_tables.py rename to v2.5/generators/nlojet++/interface/check/fnlo-compare-tables.py index b88e19588cfffe2d2bc8ab0fc28cc01465e94886..946e8ad06b401102149fc64e2960df588da850ea --- a/test/compare_tables.py +++ b/v2.5/generators/nlojet++/interface/check/fnlo-compare-tables.py @@ -4,6 +4,8 @@ import os import fastnlo as fnlo +LIBDIR = os.environ["LIBDIR"] + TYPES = ["fix", "flex"] NAMES = ["NodesPerBin", "NodeDensity"] SEEDS = [1000, 2000] @@ -21,9 +23,9 @@ def generate_table(vartype: str, name: str, seed: int): "-c born " f"-s {seed} " f"--name {vartype}_{name}_{seed:06d} " - " -u /usr/lib/fastnlo_interface_nlojet/libInclusiveNJets.la " - "--max-event 100000 " - "--save-after 100000 " + f" -u {LIBDIR}/fastnlo_interface_nlojet/libInclusiveNJets.la " + "--max-event 10000 " + "--save-after 10000 " ) os.system(f"mv output/run-hhc-born-2jet.tab.gz output/{vartype}_{name}_{seed:06d}.tab.gz") diff --git a/v2.5/generators/nlojet++/interface/check/fnlo-nj-lotest.pl.in b/v2.5/generators/nlojet++/interface/check/fnlo-nj-lotest.pl.in index c7a382536355f2b548b5c1ef3503bce1c048597e..98119c888117bc8d2657e9240cea521050070d1e 100755 --- a/v2.5/generators/nlojet++/interface/check/fnlo-nj-lotest.pl.in +++ b/v2.5/generators/nlojet++/interface/check/fnlo-nj-lotest.pl.in @@ -69,19 +69,10 @@ $ret = system("$cmd"); if ( $ret ) {die "fnlo-tk-nlotest: Ungzipping test table ${tabgz} failed: $ret, aborted!\n";} # Determine difference to default LO table -$cmd = "diff ./${tabl} output/${tabl} > lodiff.log"; +$cmd = "./compare-table-helper.py ./${tabl} output/${tabl} > lodiff.log"; print "Executing command: $cmd\n"; $ret = system("$cmd"); -if ( $ret ) {die "fnlo-nj-lotest: Result comparison with 'diff' failed: $ret, aborted!\n";} - -# The diff.log must be empty -if ( ! -z "lodiff.log" ) { - print "fnlo-nj-lotest: LO test table differs from default:\n"; - $cmd = "cat lodiff.log"; - print "Executing command: $cmd\n"; - $ret = system("$cmd"); - die "fnlo-nj-lotest: LO table production unit test failed, please fix!\n"; -} +if ( $ret ) {die "fnlo-nj-lotest: LO table production unit test failed, results are different!\n";} print "fnlo-nj-lotest: LO table production unit test passed.\n"; diff --git a/v2.5/generators/nlojet++/interface/check/fnlo-nj-nlotest.pl.in b/v2.5/generators/nlojet++/interface/check/fnlo-nj-nlotest.pl.in index 4960ed932c4b0b6032abe3182982746a858e0ce6..3d6a1304c2d8fd8047497f5fc3b2119ce8051152 100755 --- a/v2.5/generators/nlojet++/interface/check/fnlo-nj-nlotest.pl.in +++ b/v2.5/generators/nlojet++/interface/check/fnlo-nj-nlotest.pl.in @@ -69,19 +69,10 @@ $ret = system("$cmd"); if ( $ret ) {die "fnlo-tk-nlotest: Ungzipping test table ${tabgz} failed: $ret, aborted!\n";} # Determine difference to default NLO table -$cmd = "diff ./${tabn} output/${tabn} > nlodiff.log"; +$cmd = "./compare-table-helper.py ./${tabn} output/${tabn} > lodiff.log"; print "Executing command: $cmd\n"; $ret = system("$cmd"); -if ( $ret ) {die "fnlo-nj-nlotest: Result comparison with 'diff' failed: $ret, aborted!\n";} - -# The diff.log must be empty -if ( ! -z "nlodiff.log" ) { - print "fnlo-nj-nlotest: NLO test table differs from default:\n"; - $cmd = "cat nlodiff.log"; - print "Executing command: $cmd\n"; - $ret = system("$cmd"); - die "fnlo-nj-nlotest: NLO table production unit test failed, please fix!\n"; -} +if ( $ret ) {die "fnlo-nj-lotest: NLO table production unit test failed, results are different!\n";} print "fnlo-nj-nlotest: NLO table production unit test passed.\n";