From 908acd7da5442636ae23df5ef924c8e4559c9357 Mon Sep 17 00:00:00 2001 From: JohannesGaessler <johannesg@5d6.de> Date: Mon, 3 Jul 2023 14:17:43 +0200 Subject: [PATCH] Moved test files to v2.5/generators/NLOJet++/ --- test/.gitignore | 7 ------- .../generators/nlojet++/interface/check/.gitignore | 2 ++ .../check}/InclusiveNJets_InclusiveJets_fix.wrm | 0 .../check}/InclusiveNJets_InclusiveJets_flex.wrm | 0 .../nlojet++/interface/check/Makefile.am | 3 ++- .../interface/check/compare-table-helper.py | 14 ++++++++++++++ .../nlojet++/interface/check}/fix_NodeDensity.str | 0 .../nlojet++/interface/check}/fix_NodesPerBin.str | 0 .../nlojet++/interface/check}/flex_NodeDensity.str | 0 .../nlojet++/interface/check}/flex_NodesPerBin.str | 0 .../interface/check/fnlo-compare-tables.py | 8 +++++--- .../nlojet++/interface/check/fnlo-nj-lotest.pl.in | 13 ++----------- .../nlojet++/interface/check/fnlo-nj-nlotest.pl.in | 13 ++----------- 13 files changed, 27 insertions(+), 33 deletions(-) delete mode 100644 test/.gitignore rename {test => v2.5/generators/nlojet++/interface/check}/InclusiveNJets_InclusiveJets_fix.wrm (100%) rename {test => v2.5/generators/nlojet++/interface/check}/InclusiveNJets_InclusiveJets_flex.wrm (100%) create mode 100755 v2.5/generators/nlojet++/interface/check/compare-table-helper.py rename {test => v2.5/generators/nlojet++/interface/check}/fix_NodeDensity.str (100%) rename {test => v2.5/generators/nlojet++/interface/check}/fix_NodesPerBin.str (100%) rename {test => v2.5/generators/nlojet++/interface/check}/flex_NodeDensity.str (100%) rename {test => v2.5/generators/nlojet++/interface/check}/flex_NodesPerBin.str (100%) rename test/compare_tables.py => v2.5/generators/nlojet++/interface/check/fnlo-compare-tables.py (90%) mode change 100644 => 100755 diff --git a/test/.gitignore b/test/.gitignore deleted file mode 100644 index 5b8cd369..00000000 --- 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 43baae7b..e10473f0 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 2efe548b..a4514907 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 00000000..095ab0dd --- /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 b88e1958..946e8ad0 --- 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 c7a38253..98119c88 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 4960ed93..3d6a1304 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"; -- GitLab