From 1b94783779842e7da79923b7b04434994796e4cc Mon Sep 17 00:00:00 2001 From: Jonas Rembser Date: Thu, 8 Jan 2026 10:34:47 +0100 Subject: [PATCH 1/3] [roottest] Remove Makefiles and `.rootrc` files from Python tests These files are unused. --- roottest/python/.rootrc | 1 - roottest/python/Makefile | 25 ---------- roottest/python/basic/.rootrc | 1 - roottest/python/basic/Makefile | 53 --------------------- roottest/python/cling/.rootrc | 1 - roottest/python/cling/Makefile | 36 -------------- roottest/python/cpp/.rootrc | 1 - roottest/python/cpp/Makefile | 56 ---------------------- roottest/python/function/.rootrc | 1 - roottest/python/function/Makefile | 30 ------------ roottest/python/memory/.rootrc | 1 - roottest/python/memory/Makefile | 29 ------------ roottest/python/pickle/.rootrc | 1 - roottest/python/pickle/Makefile | 34 -------------- roottest/python/pythonizations/Makefile | 39 ---------------- roottest/python/regression/.rootrc | 1 - roottest/python/regression/Makefile | 62 ------------------------- roottest/python/stl/.rootrc | 1 - roottest/python/stl/Makefile | 29 ------------ roottest/python/ttree/.rootrc | 1 - roottest/python/ttree/Makefile | 29 ------------ 21 files changed, 432 deletions(-) delete mode 100644 roottest/python/.rootrc delete mode 100644 roottest/python/Makefile delete mode 100644 roottest/python/basic/.rootrc delete mode 100644 roottest/python/basic/Makefile delete mode 100644 roottest/python/cling/.rootrc delete mode 100644 roottest/python/cling/Makefile delete mode 100644 roottest/python/cpp/.rootrc delete mode 100644 roottest/python/cpp/Makefile delete mode 100644 roottest/python/function/.rootrc delete mode 100644 roottest/python/function/Makefile delete mode 100644 roottest/python/memory/.rootrc delete mode 100644 roottest/python/memory/Makefile delete mode 100644 roottest/python/pickle/.rootrc delete mode 100644 roottest/python/pickle/Makefile delete mode 100644 roottest/python/pythonizations/Makefile delete mode 100644 roottest/python/regression/.rootrc delete mode 100644 roottest/python/regression/Makefile delete mode 100644 roottest/python/stl/.rootrc delete mode 100644 roottest/python/stl/Makefile delete mode 100644 roottest/python/ttree/.rootrc delete mode 100644 roottest/python/ttree/Makefile diff --git a/roottest/python/.rootrc b/roottest/python/.rootrc deleted file mode 100644 index 6ebe75fd4ec5a..0000000000000 --- a/roottest/python/.rootrc +++ /dev/null @@ -1 +0,0 @@ -Rint.History: .root_hist diff --git a/roottest/python/Makefile b/roottest/python/Makefile deleted file mode 100644 index cea6ae64d1164..0000000000000 --- a/roottest/python/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -# %ROOTTEST-duration%:1 -CLEAN_TARGETS += *.pyc - -ifeq ($(strip $(ROOTTEST_HOME)),) - export ROOTTEST_HOME := $(shell git rev-parse --show-toplevel)/roottest/ - ifeq ($(strip $(ROOTTEST_HOME)),) - export ROOTTEST_HOME := $(shell expr $(CURDIR) : '\(.*/roottest/\)') - endif - ifeq ($(strip $(ROOTTEST_HOME)),) - $(error The head of roottest was not found. Set ROOTTEST_HOME) - endif -endif - -ifeq ($(HAS_PYTHON),) - export HAS_PYTHON := $(shell root-config --has-python) -endif - -ifeq ($(HAS_PYTHON),yes) -include $(ROOTTEST_HOME)/scripts/Rules.mk -# prevent spurious printout of control characters that occur with certain -# combinations of readline and ncurses (e.g. 5.2 and 5.6, respectively) -export TERM=vt100 -else -include $(ROOTTEST_HOME)/scripts/Disable.mk -endif diff --git a/roottest/python/basic/.rootrc b/roottest/python/basic/.rootrc deleted file mode 100644 index 6ebe75fd4ec5a..0000000000000 --- a/roottest/python/basic/.rootrc +++ /dev/null @@ -1 +0,0 @@ -Rint.History: .root_hist diff --git a/roottest/python/basic/Makefile b/roottest/python/basic/Makefile deleted file mode 100644 index 18bfd2b172276..0000000000000 --- a/roottest/python/basic/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -# This is a template for all makefile. - -.PHONY: DataTypes_C Overloads_C - -#Set the list of files to be delete by clean: -CLEAN_TARGETS += $(ALL_LIBRARIES) *.log *.clog __pycache__ - -#Set the list of target to make while testing -TEST_TARGETS += PyROOT_basictests PyROOT_overloadtests PyROOT_datatypetest PyROOT_operatortests - -ifeq ($(strip $(ROOTTEST_HOME)),) - export ROOTTEST_HOME := $(shell git rev-parse --show-toplevel)/roottest/ - ifeq ($(strip $(ROOTTEST_HOME)),) - export ROOTTEST_HOME := $(shell expr $(CURDIR) : '\(.*/roottest/\)') - endif - ifeq ($(strip $(ROOTTEST_HOME)),) - $(error The head of roottest was not found. Set ROOTTEST_HOME) - endif -endif -include $(ROOTTEST_HOME)/scripts/Rules.mk - - -testWithFailure: -ifeq ($(FAIL),) - $(WarnFailTest) -endif - - -PyROOT_basictests.log: ArgumentPassingCompiled_C.$(DllSuf) - -PyROOT_basictests: PyROOT_basictests.log - $(TestDiff) - -#----- -Overloads_C: Overloads_C.$(DllSuf) -PyROOT_overloadtest.log: Overloads_C - -PyROOT_overloadtests: PyROOT_overloadtests.log - $(TestDiff) - - -#----- -DataTypes_C: DataTypes_C.$(DllSuf) -PyROOT_datatypetest.log: DataTypes_C - -PyROOT_datatypetest: PyROOT_datatypetest.log - $(TestDiff) - -PyROOT_operatortests.log: Operators_C.$(DllSuf) - -PyROOT_operatortests: PyROOT_operatortests.log - $(TestDiff) - diff --git a/roottest/python/cling/.rootrc b/roottest/python/cling/.rootrc deleted file mode 100644 index 6ebe75fd4ec5a..0000000000000 --- a/roottest/python/cling/.rootrc +++ /dev/null @@ -1 +0,0 @@ -Rint.History: .root_hist diff --git a/roottest/python/cling/Makefile b/roottest/python/cling/Makefile deleted file mode 100644 index 3ab52e118f6c4..0000000000000 --- a/roottest/python/cling/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# This is a template for all makefile. - -#Set the list of files to be delete by clean: -CLEAN_TARGETS += $(ALL_LIBRARIES) *.log *.clog - -#Set the list of target to make while testing -TEST_TARGETS += PyClassTest PyAPITest PyROOT_clingtests - -ifeq ($(strip $(ROOTTEST_HOME)),) - export ROOTTEST_HOME := $(shell git rev-parse --show-toplevel)/roottest/ - ifeq ($(strip $(ROOTTEST_HOME)),) - export ROOTTEST_HOME := $(shell expr $(CURDIR) : '\(.*/roottest/\)') - endif - ifeq ($(strip $(ROOTTEST_HOME)),) - $(error The head of roottest was not found. Set ROOTTEST_HOME) - endif -endif -include $(ROOTTEST_HOME)/scripts/Rules.mk - - -testWithFailure: -ifeq ($(FAIL),) - $(WarnFailTest) -endif - - -PyClassTest.log: runPyClassTest.C runPyAPITest.C - -PyClassTest: PyClassTest.log - $(TestDiff) - -PyAPITest: PyAPITest.log - $(TestDiff) - -PyROOT_clingtests: PyROOT_clingtests.log - $(TestDiff) diff --git a/roottest/python/cpp/.rootrc b/roottest/python/cpp/.rootrc deleted file mode 100644 index 6ebe75fd4ec5a..0000000000000 --- a/roottest/python/cpp/.rootrc +++ /dev/null @@ -1 +0,0 @@ -Rint.History: .root_hist diff --git a/roottest/python/cpp/Makefile b/roottest/python/cpp/Makefile deleted file mode 100644 index d78a6638892ac..0000000000000 --- a/roottest/python/cpp/Makefile +++ /dev/null @@ -1,56 +0,0 @@ -# This is a template for all makefile. - -#Set the list of files to be delete by clean: -CLEAN_TARGETS += $(ALL_LIBRARIES) *.log *.clog - -#Set the list of target to make while testing -TEST_TARGETS += PyROOT_cpptests PyROOT_advancedtests PyROOT_cpp11tests - -ifeq ($(strip $(ROOTTEST_HOME)),) - export ROOTTEST_HOME := $(shell git rev-parse --show-toplevel)/roottest/ - ifeq ($(strip $(ROOTTEST_HOME)),) - export ROOTTEST_HOME := $(shell expr $(CURDIR) : '\(.*/roottest/\)') - endif - ifeq ($(strip $(ROOTTEST_HOME)),) - $(error The head of roottest was not found. Set ROOTTEST_HOME) - endif -endif -include $(ROOTTEST_HOME)/scripts/Rules.mk - - -testWithFailure: -ifeq ($(FAIL),) - $(WarnFailTest) -endif - -ifeq ($(PLATFORM),win32) -# The creation of shadow classes in rootcint does not support -# Microsoft's implementation of virtual function overriding -# when coming from a virtual base class (It would require the -# Shadow class to also override that virtual function). -PyROOT_cpptests: - $(WarnFailTest) - -PyROOT_advancedtests: - $(WarnFailTest) - -PyROOT_cpp11tests: - $(WarnFailTest) - -else -PyROOT_cpptests.log: Namespace_C.$(DllSuf) Namespace2_C.$(DllSuf) PointerPassing_C.$(DllSuf) - -PyROOT_advancedtests.log: AdvancedCpp_C.$(DllSuf) Template_C.$(DllSuf) - -PyROOT_cpp11tests.log: Cpp11Features_C.$(DllSuf) - -PyROOT_cpptests: PyROOT_cpptests.log - $(TestDiffW) - -PyROOT_advancedtests: PyROOT_advancedtests.log - $(TestDiffW) - -PyROOT_cpp11tests: PyROOT_cpp11tests.log - $(TestDiffW) - -endif diff --git a/roottest/python/function/.rootrc b/roottest/python/function/.rootrc deleted file mode 100644 index 6ebe75fd4ec5a..0000000000000 --- a/roottest/python/function/.rootrc +++ /dev/null @@ -1 +0,0 @@ -Rint.History: .root_hist diff --git a/roottest/python/function/Makefile b/roottest/python/function/Makefile deleted file mode 100644 index 33e4aa8582f4c..0000000000000 --- a/roottest/python/function/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# This is a template for all makefile. - -#Set the list of files to be delete by clean: -CLEAN_TARGETS += $(ALL_LIBRARIES) *.log *.clog - -#Set the list of target to make while testing -TEST_TARGETS += PyROOT_functiontests - -ifeq ($(strip $(ROOTTEST_HOME)),) - export ROOTTEST_HOME := $(shell git rev-parse --show-toplevel)/roottest/ - ifeq ($(strip $(ROOTTEST_HOME)),) - export ROOTTEST_HOME := $(shell expr $(CURDIR) : '\(.*/roottest/\)') - endif - ifeq ($(strip $(ROOTTEST_HOME)),) - $(error The head of roottest was not found. Set ROOTTEST_HOME) - endif -endif -include $(ROOTTEST_HOME)/scripts/Rules.mk - - -testWithFailure: -ifeq ($(FAIL),) - $(WarnFailTest) -endif - - -PyROOT_functiontests.log: InstallableFunction_C.$(DllSuf) GlobalFunction2_C.$(DllSuf) GlobalFunction3_C.$(DllSuf) - -PyROOT_functiontests: PyROOT_functiontests.log - $(TestDiff) diff --git a/roottest/python/memory/.rootrc b/roottest/python/memory/.rootrc deleted file mode 100644 index 6ebe75fd4ec5a..0000000000000 --- a/roottest/python/memory/.rootrc +++ /dev/null @@ -1 +0,0 @@ -Rint.History: .root_hist diff --git a/roottest/python/memory/Makefile b/roottest/python/memory/Makefile deleted file mode 100644 index db39b030ccdb4..0000000000000 --- a/roottest/python/memory/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# This is a template for all makefile. - -#Set the list of files to be delete by clean: -CLEAN_TARGETS += $(ALL_LIBRARIES) *.log *.clog - -#Set the list of target to make while testing -TEST_TARGETS += PyROOT_memorytests - -ifeq ($(strip $(ROOTTEST_HOME)),) - export ROOTTEST_HOME := $(shell git rev-parse --show-toplevel)/roottest/ - ifeq ($(strip $(ROOTTEST_HOME)),) - export ROOTTEST_HOME := $(shell expr $(CURDIR) : '\(.*/roottest/\)') - endif - ifeq ($(strip $(ROOTTEST_HOME)),) - $(error The head of roottest was not found. Set ROOTTEST_HOME) - endif -endif -include $(ROOTTEST_HOME)/scripts/Rules.mk - - -testWithFailure: -ifeq ($(FAIL),) - $(WarnFailTest) -endif - -PyROOT_memorytests.log: MemTester_C.$(DllSuf) - -PyROOT_memorytests: PyROOT_memorytests.log - $(TestDiff) diff --git a/roottest/python/pickle/.rootrc b/roottest/python/pickle/.rootrc deleted file mode 100644 index 6ebe75fd4ec5a..0000000000000 --- a/roottest/python/pickle/.rootrc +++ /dev/null @@ -1 +0,0 @@ -Rint.History: .root_hist diff --git a/roottest/python/pickle/Makefile b/roottest/python/pickle/Makefile deleted file mode 100644 index 2c681cfe20c57..0000000000000 --- a/roottest/python/pickle/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -# This is a template for all makefile. - -#Set the list of files to be delete by clean: -CLEAN_TARGETS += $(ALL_LIBRARIES) *.log *.clog *.root *.pcl *.cpcl *.pyc - -#Set the list of target to make while testing -TEST_TARGETS += PyROOT_readtests PyROOT_writetests - -ifeq ($(strip $(ROOTTEST_HOME)),) - export ROOTTEST_HOME := $(shell git rev-parse --show-toplevel)/roottest/ - ifeq ($(strip $(ROOTTEST_HOME)),) - export ROOTTEST_HOME := $(shell expr $(CURDIR) : '\(.*/roottest/\)') - endif - ifeq ($(strip $(ROOTTEST_HOME)),) - $(error The head of roottest was not found. Set ROOTTEST_HOME) - endif -endif -include $(ROOTTEST_HOME)/scripts/Rules.mk - - -testWithFailure: -ifeq ($(FAIL),) - $(WarnFailTest) -endif - -PyROOT_writetests.log: PickleTypes_C.$(DllSuf) - -PyROOT_writetests: PyROOT_writetests.log - $(TestDiff) - -PyROOT_readtests.log: PickleTypes_C.$(DllSuf) PyROOT_writetests - -PyROOT_readtests: PyROOT_readtests.log - $(TestDiff) diff --git a/roottest/python/pythonizations/Makefile b/roottest/python/pythonizations/Makefile deleted file mode 100644 index ba5f43a1b4074..0000000000000 --- a/roottest/python/pythonizations/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -# This is a template for all makefile. - -.PHONY: Pythonizables_C - -#Set the list of files to be delete by clean: -CLEAN_TARGETS += $(ALL_LIBRARIES) *.log *.clog __pycache__ foo.root - -#Set the list of target to make while testing -TEST_TARGETS += PyROOT_pythonizationtest PyROOT_smartptrtest - -ifeq ($(strip $(ROOTTEST_HOME)),) - export ROOTTEST_HOME := $(shell git rev-parse --show-toplevel)/roottest/ - ifeq ($(strip $(ROOTTEST_HOME)),) - export ROOTTEST_HOME := $(shell expr $(CURDIR) : '\(.*/roottest/\)') - endif - ifeq ($(strip $(ROOTTEST_HOME)),) - $(error The head of roottest was not found. Set ROOTTEST_HOME) - endif -endif -include $(ROOTTEST_HOME)/scripts/Rules.mk - - -testWithFailure: -ifeq ($(FAIL),) - $(WarnFailTest) -endif - - -Pythonizables_C: Pythonizables_C.$(DllSuf) -PyROOT_pythonizationtest.log: Pythonizables_C.$(DllSuf) - -PyROOT_pythonizationtest: PyROOT_pythonizationtest.log - $(TestDiff) - -SmartPtr_C: SmartPtr_C.$(DllSuf) -PyROOT_smartptrtest.log: SmartPtr_C.$(DllSuf) - -PyROOT_smartptrtest: PyROOT_smartptrtest.log - $(TestDiff) diff --git a/roottest/python/regression/.rootrc b/roottest/python/regression/.rootrc deleted file mode 100644 index 6ebe75fd4ec5a..0000000000000 --- a/roottest/python/regression/.rootrc +++ /dev/null @@ -1 +0,0 @@ -Rint.History: .root_hist diff --git a/roottest/python/regression/Makefile b/roottest/python/regression/Makefile deleted file mode 100644 index eb8756455fc8f..0000000000000 --- a/roottest/python/regression/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -# This is a template for all makefile. - -#Set the list of files to be delete by clean: -CLEAN_TARGETS += $(ALL_LIBRARIES) *.log *.clog *.pyc - -#Set the list of target to make while testing -TEST_TARGETS += PyROOT_regressiontests - -ifeq ($(strip $(ROOTTEST_HOME)),) - export ROOTTEST_HOME := $(shell git rev-parse --show-toplevel)/roottest/ - ifeq ($(strip $(ROOTTEST_HOME)),) - export ROOTTEST_HOME := $(shell expr $(CURDIR) : '\(.*/roottest/\)') - endif - ifeq ($(strip $(ROOTTEST_HOME)),) - $(error The head of roottest was not found. Set ROOTTEST_HOME) - endif -endif -include $(ROOTTEST_HOME)/scripts/Rules.mk - -pylib = $(strip $(shell $(PYTHON) pythonlib.py) ) -ifeq ($(PLATFORM),win32) -pylibpath = $(strip $(shell $(PYTHON) -c 'import os, sys; path = os.path.join(sys.prefix, "libs"); upath = path.replace("\\","/"); print upath; ' ) ) -export LIB:=$(pylibpath);$(LIB) -endif - -# special case for Scott.C: link with python library -#Scott_C.$(DllSuf): Scott.C $(ROOTCORELIBS) $(ROOTCINT) $(ROOTV) -# $(CMDECHO) $(CALLROOTEXEBUILD) -q -l -b $(ROOTTEST_HOME)/scripts/build.C\(\"$<\",\"$(pylib)\"\) > Scott_C.build.log 2>&1 || handleError.sh --cmd='Call to build.C' --result=$$? --log=Scott_C.build.log - - -testWithFailure: -ifeq ($(FAIL),) - $(WarnFailTest) -endif - -%_C.$(DllSuf): %.C $(ROOTCORELIBS) $(ROOTCINT) $(ROOTV) - $(CMDECHO) $(CALLROOTEXE) -q -l -b $(ROOTTEST_HOME)/scripts/build.C\(\"$<\",\"libPyROOT\"\) > $*_C.build.log 2>&1 || handleError.sh --result=$$? --log=Scott_C.build.log --test=$@ - -LoKiNamespace_C.clean.log: LoKiNamespace_C.$(DllSuf) - $(CMDECHO) rm -f LoKiNamespace_C.rootmap > LoKiNamespace_C.clean.log - -PyROOT_regressiontests.log: LoKiNamespace_C.clean.log Marco_C.$(DllSuf) MuonTileID_C.$(DllSuf) Scott3_C.$(DllSuf) Scott2_C.$(DllSuf) ULongLong_C.$(DllSuf) Till_C.$(DllSuf) CoralAttributeList_C.$(DllSuf) -# Scott_C.$(DllSuf) - -ifeq ($(shell root-config --arch),win32) -# don't run the python file; it doesn't work on Windows: -# WEXITSTATUS not known on windows -PyROOT_regressiontests.log: - $(CMDECHO) touch $@ - -PyROOT_regressiontests: PyROOT_regressiontests.log - $(WarnFailTest) - -else - -PyROOT_regressiontests: PyROOT_regressiontests.log - $(TestDiff) - -endif - -exec_root_6023.pylog: root_6023_h.$(DllSuf) - diff --git a/roottest/python/stl/.rootrc b/roottest/python/stl/.rootrc deleted file mode 100644 index 6ebe75fd4ec5a..0000000000000 --- a/roottest/python/stl/.rootrc +++ /dev/null @@ -1 +0,0 @@ -Rint.History: .root_hist diff --git a/roottest/python/stl/Makefile b/roottest/python/stl/Makefile deleted file mode 100644 index edc0685d2bb54..0000000000000 --- a/roottest/python/stl/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# This is a template for all makefile. - -#Set the list of files to be delete by clean: -CLEAN_TARGETS += $(ALL_LIBRARIES) *.log *.clog - -#Set the list of target to make while testing -TEST_TARGETS += PyROOT_stltests - -ifeq ($(strip $(ROOTTEST_HOME)),) - export ROOTTEST_HOME := $(shell git rev-parse --show-toplevel)/roottest/ - ifeq ($(strip $(ROOTTEST_HOME)),) - export ROOTTEST_HOME := $(shell expr $(CURDIR) : '\(.*/roottest/\)') - endif - ifeq ($(strip $(ROOTTEST_HOME)),) - $(error The head of roottest was not found. Set ROOTTEST_HOME) - endif -endif -include $(ROOTTEST_HOME)/scripts/Rules.mk - - -testWithFailure: -ifeq ($(FAIL),) - $(WarnFailTest) -endif - -PyROOT_stltests.log: StlTypes_C.$(DllSuf) - -PyROOT_stltests: PyROOT_stltests.log - $(TestDiff) diff --git a/roottest/python/ttree/.rootrc b/roottest/python/ttree/.rootrc deleted file mode 100644 index 6ebe75fd4ec5a..0000000000000 --- a/roottest/python/ttree/.rootrc +++ /dev/null @@ -1 +0,0 @@ -Rint.History: .root_hist diff --git a/roottest/python/ttree/Makefile b/roottest/python/ttree/Makefile deleted file mode 100644 index 274f174887a7d..0000000000000 --- a/roottest/python/ttree/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# This is a template for all makefile. - -#Set the list of files to be delete by clean: -CLEAN_TARGETS += $(ALL_LIBRARIES) *.log *.clog *.root - -#Set the list of target to make while testing -TEST_TARGETS += PyROOT_ttreetests - -ifeq ($(strip $(ROOTTEST_HOME)),) - export ROOTTEST_HOME := $(shell git rev-parse --show-toplevel)/roottest/ - ifeq ($(strip $(ROOTTEST_HOME)),) - export ROOTTEST_HOME := $(shell expr $(CURDIR) : '\(.*/roottest/\)') - endif - ifeq ($(strip $(ROOTTEST_HOME)),) - $(error The head of roottest was not found. Set ROOTTEST_HOME) - endif -endif -include $(ROOTTEST_HOME)/scripts/Rules.mk - - -testWithFailure: -ifeq ($(FAIL),) - $(WarnFailTest) -endif - -PyROOT_ttreetests.log: TTreeTypes_C.$(DllSuf) - -PyROOT_ttreetests: PyROOT_ttreetests.log - $(TestDiff) From 6d07e293510fa4de8f91445cbbcf77634c72f910 Mon Sep 17 00:00:00 2001 From: Jonas Rembser Date: Thu, 8 Jan 2026 13:24:38 +0100 Subject: [PATCH 2/3] [roottest] Delete Python operator tests They are now part of the cppyy tests that are run on all platforms. The only test that is kept is a ROOT-specific one, which is moved to a different file. --- roottest/python/basic/CMakeLists.txt | 7 - roottest/python/basic/Operators.C | 114 ------------- roottest/python/basic/PyROOT_operatortests.py | 161 ------------------ .../python/basic/PyROOT_operatortests.ref | 11 -- .../regression/PyROOT_regressiontests.py | 16 ++ 5 files changed, 16 insertions(+), 293 deletions(-) delete mode 100644 roottest/python/basic/Operators.C delete mode 100644 roottest/python/basic/PyROOT_operatortests.py delete mode 100644 roottest/python/basic/PyROOT_operatortests.ref diff --git a/roottest/python/basic/CMakeLists.txt b/roottest/python/basic/CMakeLists.txt index 89b9560c46f58..bb87251303835 100644 --- a/roottest/python/basic/CMakeLists.txt +++ b/roottest/python/basic/CMakeLists.txt @@ -15,14 +15,7 @@ if(NOT MSVC OR win_broken_tests) MACRO PyROOT_datatypetest_numpy.py FIXTURES_REQUIRED python-basic-datatype-fixture PYTHON_DEPS numpy) -endif() - - ROOTTEST_ADD_TEST(operator - MACRO PyROOT_operatortests.py - COPY_TO_BUILDDIR Operators.C - PRECMD ${ROOT_root_CMD} -b -q -l -e .L\ Operators.C+) -if(NOT MSVC OR win_broken_tests) ROOTTEST_ADD_TEST(overload MACRO PyROOT_overloadtests.py COPY_TO_BUILDDIR Overloads.C Overloads.h diff --git a/roottest/python/basic/Operators.C b/roottest/python/basic/Operators.C deleted file mode 100644 index 22b9eaf73f36b..0000000000000 --- a/roottest/python/basic/Operators.C +++ /dev/null @@ -1,114 +0,0 @@ -/* - File: roottest/python/basic/Operators.C - Author: WLavrijsen@lbl.gov - Created: 04/15/05 - Last: 05/20/10 -*/ - -class Number { -public: - Number() { m_int = 0; } - Number( int i ) { m_int = i; } - - int AsInt() { return m_int; } - - Number operator+( const Number& n ) const { return Number( m_int + n.m_int ); } - Number operator+( int n ) const { return Number( m_int + n ); } - Number operator-( const Number& n ) const { return Number( m_int - n.m_int ); } - Number operator-( int n ) const { return Number( m_int - n ); } - Number operator*( const Number& n ) const { return Number( m_int * n.m_int ); } - Number operator*( int n ) const { return Number( m_int * n ); } - Number operator/( const Number& n ) const { return Number( m_int / n.m_int ); } - Number operator/( int n ) const { return Number( m_int / n ); } - Number operator%( const Number& n ) const { return Number( m_int % n.m_int ); } - Number operator%( int n ) const { return Number( m_int % n ); } - - Number& operator+=( const Number& n ) { m_int += n.m_int; return *this; } - Number& operator-=( const Number& n ) { m_int -= n.m_int; return *this; } - Number& operator*=( const Number& n ) { m_int *= n.m_int; return *this; } - Number& operator/=( const Number& n ) { m_int /= n.m_int; return *this; } - Number& operator%=( const Number& n ) { m_int %= n.m_int; return *this; } - - Number operator-() { return Number( -m_int ); } - - bool operator<( const Number& n ) const { return m_int < n.m_int; } - bool operator>( const Number& n ) const { return m_int > n.m_int; } - bool operator<=( const Number& n ) const { return m_int <= n.m_int; } - bool operator>=( const Number& n ) const { return m_int >= n.m_int; } - bool operator!=( const Number& n ) const { return m_int != n.m_int; } - bool operator==( const Number& n ) const { return m_int == n.m_int; } - - operator bool() { return m_int != 0; } - - Number operator&( const Number& n ) const { return Number( m_int & n.m_int ); } - Number operator|( const Number& n ) const { return Number( m_int | n.m_int ); } - Number operator^( const Number& n ) const { return Number( m_int ^ n.m_int ); } - - Number& operator&=( const Number& n ) { m_int &= n.m_int; return *this; } - Number& operator|=( const Number& n ) { m_int |= n.m_int; return *this; } - Number& operator^=( const Number& n ) { m_int ^= n.m_int; return *this; } - - Number operator<<( int i ) const { return Number( m_int << i ); } - Number operator>>( int i ) const { return Number( m_int >> i ); } - -private: - int m_int; -}; - -//---------------------------------------------------------------------------- -struct OperatorCharStar { - OperatorCharStar() : m_str( (char*)"OperatorCharStar" ) {} - operator char*() { return m_str; } - char* m_str; -}; - -struct OperatorConstCharStar { - OperatorConstCharStar() : m_str( "OperatorConstCharStar" ) {} - operator const char*() { return m_str; } - const char* m_str; -}; - -struct OperatorInt { - operator int() { return m_int; } - int m_int; -}; - -struct OperatorLong { -#ifdef _WIN64 - operator int64_t() { return m_long; } - int64_t m_long; -#else - operator long() { return m_long; } - long m_long; -#endif -}; - -struct OperatorDouble { - operator double() { return m_double; } - double m_double; -}; - -struct OperatorShort { - operator short() { return m_short; } - unsigned short m_short; -}; - -struct OperatorUnsignedInt { - operator unsigned int() { return m_uint; } - unsigned int m_uint; -}; - -struct OperatorUnsignedLong { -#ifdef _WIN64 - operator uint64_t() { return m_ulong; } - uint64_t m_ulong; -#else - operator unsigned long() { return m_ulong; } - unsigned long m_ulong; -#endif -}; - -struct OperatorFloat { - operator float() { return m_float; } - float m_float; -}; diff --git a/roottest/python/basic/PyROOT_operatortests.py b/roottest/python/basic/PyROOT_operatortests.py deleted file mode 100644 index ed6197cc15e6c..0000000000000 --- a/roottest/python/basic/PyROOT_operatortests.py +++ /dev/null @@ -1,161 +0,0 @@ -# File: roottest/python/basic/PyROOT_operatortests.py -# Author: Wim Lavrijsen (LBNL, WLavrijsen@lbl.gov) -# Created: 06/04/05 -# Last: 05/05/15 - -"""C++ operators interface unit tests for PyROOT package.""" - -import sys, os, unittest -sys.path.append(os.path.dirname( os.path.dirname(__file__))) - -if not os.path.exists('Operators.C'): - os.chdir(os.path.dirname(__file__)) - -import ROOT -from ROOT import gROOT -from common import * - -__all__ = [ - 'Cpp1OperatorsTestCase', - 'Cpp2ConverterOperatorsTestCase', - 'Cpp3TemplatedMathOperatorsTestCase' -] - -gROOT.LoadMacro( "Operators.C+" ) -Number = ROOT.Number -OperatorCharStar = ROOT.OperatorCharStar -OperatorShort = ROOT.OperatorShort -OperatorConstCharStar = ROOT.OperatorConstCharStar -OperatorUnsignedInt = ROOT.OperatorUnsignedInt -OperatorInt = ROOT.OperatorInt -OperatorUnsignedLong = ROOT.OperatorUnsignedLong -OperatorLong = ROOT.OperatorLong -OperatorFloat = ROOT.OperatorFloat -OperatorDouble = ROOT.OperatorDouble - - -### C++ operators overloading test cases ===================================== -class Cpp1OperatorsTestCase( MyTestCase ): - def test1MathOperators( self ): - """Test overloading of math operators""" - - self.assertEqual( Number(20) + Number(10), Number(30) ) - self.assertEqual( Number(20) + 10 , Number(30) ) - self.assertEqual( Number(20) - Number(10), Number(10) ) - self.assertEqual( Number(20) - 10 , Number(10) ) - self.assertEqual( Number(20) / Number(10), Number(2) ) - self.assertEqual( Number(20) / 10 , Number(2) ) - self.assertEqual( Number(20) * Number(10), Number(200) ) - self.assertEqual( Number(20) * 10 , Number(200) ) - self.assertEqual( Number(20) % 10 , Number(0) ) - self.assertEqual( Number(20) % Number(10), Number(0) ) - self.assertEqual( Number(5) & Number(14), Number(4) ) - self.assertEqual( Number(5) | Number(14), Number(15) ) - self.assertEqual( Number(5) ^ Number(14), Number(11) ) - self.assertEqual( Number(5) << 2, Number(20) ) - self.assertEqual( Number(20) >> 2, Number(5) ) - - def test2UnaryMathOperators( self ): - """Test overloading of unary math operators""" - - n = Number(20) - n += Number(10) - n -= Number(10) - n *= Number(10) - n /= Number(2) - self.assertEqual( n, Number(100) ) - - nn = -n; - self.assertEqual( nn, Number( -100 ) ) - - def test3ComparisonOperators( self ): - """Test overloading of comparison operators""" - - self.assertEqual( Number(20) > Number(10), 1 ) - self.assertEqual( Number(20) < Number(10), 0 ) - self.assertEqual( Number(20) >= Number(20), 1 ) - self.assertEqual( Number(20) <= Number(10), 0 ) - self.assertEqual( Number(20) != Number(10), 1 ) - self.assertEqual( Number(20) == Number(10), 0 ) - - def test4BooleanOperator( self ): - """Test implementation of operator bool""" - - n = Number(20) - self.assertTrue( n ) - - n = Number( 0 ) - self.assertTrue( not n ) - - -### Instance to builtin type converters test cases =========================== -class Cpp2ConverterOperatorsTestCase( MyTestCase ): - def test1ExactTypes( self ): - """Test converter operators of exact types""" - - o = OperatorCharStar() - self.assertEqual( o.m_str, 'OperatorCharStar' ) - self.assertIn( 'OperatorCharStar', repr(o) ) - - o = OperatorConstCharStar() - self.assertEqual( o.m_str, 'OperatorConstCharStar' ) - self.assertIn( 'OperatorConstCharStar', repr(o) ) - - o = OperatorInt(); o.m_int = -13 - self.assertEqual( o.m_int, -13 ) - self.assertEqual( int( o ), -13 ) - - o = OperatorLong(); o.m_long = 42 - self.assertEqual( o.m_long, 42 ) - self.assertEqual( pylong( o ), 42 ) - - o = OperatorDouble(); o.m_double = 3.1415 - self.assertEqual( o.m_double, 3.1415 ) - self.assertEqual( float( o ), 3.1415 ) - - def test2ApproximateTypes( self ): - """Test converter operators of approximate types""" - - o = OperatorShort(); o.m_short = 256 - self.assertEqual( o.m_short, 256 ) - self.assertEqual( int( o ), 256 ) - - o = OperatorUnsignedInt(); o.m_uint = 2147483647 + 32 - self.assertEqual( o.m_uint, 2147483647 + 32 ) - self.assertEqual( pylong( o ), 2147483647 + 32 ) - - o = OperatorUnsignedLong(); o.m_ulong = maxvalue + 128 - self.assertEqual( o.m_ulong, maxvalue + 128 ) - self.assertEqual( pylong( o ), maxvalue + 128 ) - - o = OperatorFloat(); o.m_float = 3.14 - self.assertEqual( round( o.m_float - 3.14, 5 ), 0. ) - self.assertEqual( round( float( o ) - 3.14, 5 ), 0. ) - - -### Templated math operators ================================================= -class Cpp3TemplatedMathOperatorsTestCase( MyTestCase ): - def test01LorentzVector( self ): - """Templated method operator+/-""" - - v1 = ROOT.Math.LorentzVector('ROOT::Math::PxPyPzE4D')(1, 2, 3, 4) - v2 = ROOT.Math.LorentzVector('ROOT::Math::PxPyPzE4D')(4, 3, 2, 1) - - v3 = v1.__add__( v2 ) - self.assertEqual( v3.X(), v1.X() + v2.X() ) - v4 = v1 + v2 - self.assertEqual( v4.X(), v1.X() + v2.X() ) - self.assertEqual( v3, v4 ) - - -## actual test run -if __name__ == '__main__': - from MyTextTestRunner import MyTextTestRunner - - loader = unittest.TestLoader() - testSuite = loader.loadTestsFromModule( sys.modules[ __name__ ] ) - - runner = MyTextTestRunner( verbosity = 2 ) - result = not runner.run( testSuite ).wasSuccessful() - - sys.exit( result ) diff --git a/roottest/python/basic/PyROOT_operatortests.ref b/roottest/python/basic/PyROOT_operatortests.ref deleted file mode 100644 index 5a8c03073df69..0000000000000 --- a/roottest/python/basic/PyROOT_operatortests.ref +++ /dev/null @@ -1,11 +0,0 @@ -Test overloading of math operators ... ok -Test overloading of unary math operators ... ok -Test overloading of comparison operators ... ok -Test implementation of operator bool ... ok -Test converter operators of exact types ... ok -Test converter operators of approximate types ... ok -Templated method operator+/- ... ok - ----------------------------------------------------------------------- - -OK diff --git a/roottest/python/regression/PyROOT_regressiontests.py b/roottest/python/regression/PyROOT_regressiontests.py index 3b6762261a301..6e98713a7aa9a 100644 --- a/roottest/python/regression/PyROOT_regressiontests.py +++ b/roottest/python/regression/PyROOT_regressiontests.py @@ -51,6 +51,7 @@ def WEXITSTATUS(arg): return arg 'Regression16NestedNamespace', 'Regression17MatrixD', 'Regression18FailingDowncast', + "Cpp3TemplatedMathOperatorsTestCase", ] @@ -915,6 +916,21 @@ def test1CheckImplicitSmartPtrOverload(self): self.assertEqual(ROOT.regression27.foo(ROOT.std.move(c)), 2) # we expect the second overload +### Templated math operators ================================================= +class Cpp3TemplatedMathOperatorsTestCase(MyTestCase): + def test01LorentzVector(self): + """Templated method operator+/-""" + + v1 = ROOT.Math.LorentzVector("ROOT::Math::PxPyPzE4D")(1, 2, 3, 4) + v2 = ROOT.Math.LorentzVector("ROOT::Math::PxPyPzE4D")(4, 3, 2, 1) + + v3 = v1.__add__(v2) + self.assertEqual(v3.X(), v1.X() + v2.X()) + v4 = v1 + v2 + self.assertEqual(v4.X(), v1.X() + v2.X()) + self.assertEqual(v3, v4) + + ## actual test run if __name__ == '__main__': from MyTextTestRunner import MyTextTestRunner From 039091bd8a4701fcc417dbe2f8b17f13c6c9a96c Mon Sep 17 00:00:00 2001 From: Aaron Jomy Date: Mon, 26 May 2025 20:01:49 +0200 Subject: [PATCH 3/3] [cppyy] Enable tests on windows --- bindings/pyroot/cppyy/cppyy/CMakeLists.txt | 4 +- .../pyroot/cppyy/cppyy/test/CMakeLists.txt | 147 +++++++++++------- bindings/pyroot/cppyy/cppyy/test/templates.h | 3 +- .../cppyy/cppyy/test/test_aclassloader.py | 7 +- .../cppyy/cppyy/test/test_advancedcpp.py | 7 +- .../cppyy/cppyy/test/test_concurrent.py | 3 +- .../cppyy/cppyy/test/test_conversions.py | 10 +- .../cppyy/cppyy/test/test_cpp11features.py | 5 +- .../cppyy/cppyy/test/test_crossinheritance.py | 13 +- .../pyroot/cppyy/cppyy/test/test_datatypes.py | 8 +- .../cppyy/cppyy/test/test_doc_features.py | 10 +- .../pyroot/cppyy/cppyy/test/test_fragile.py | 23 ++- .../pyroot/cppyy/cppyy/test/test_lowlevel.py | 6 +- .../pyroot/cppyy/cppyy/test/test_numba.py | 9 +- .../pyroot/cppyy/cppyy/test/test_operators.py | 5 +- .../pyroot/cppyy/cppyy/test/test_overloads.py | 5 +- .../pyroot/cppyy/cppyy/test/test_pythonify.py | 5 +- .../cppyy/cppyy/test/test_pythonization.py | 6 +- .../cppyy/cppyy/test/test_regression.py | 1 + .../pyroot/cppyy/cppyy/test/test_stltypes.py | 10 +- .../pyroot/cppyy/cppyy/test/test_streams.py | 5 +- .../pyroot/cppyy/cppyy/test/test_templates.py | 5 +- 22 files changed, 168 insertions(+), 129 deletions(-) diff --git a/bindings/pyroot/cppyy/cppyy/CMakeLists.txt b/bindings/pyroot/cppyy/cppyy/CMakeLists.txt index 842ad12df97ed..d5be83297fcd3 100644 --- a/bindings/pyroot/cppyy/cppyy/CMakeLists.txt +++ b/bindings/pyroot/cppyy/cppyy/CMakeLists.txt @@ -34,6 +34,4 @@ install(DIRECTORY ${localruntimedir}/cppyy COMPONENT libraries PATTERN *.so EXCLUDE) -if(NOT MSVC) - ROOT_ADD_TEST_SUBDIRECTORY(test) -endif() +ROOT_ADD_TEST_SUBDIRECTORY(test) diff --git a/bindings/pyroot/cppyy/cppyy/test/CMakeLists.txt b/bindings/pyroot/cppyy/cppyy/test/CMakeLists.txt index ce6cadae0f412..05882b6711236 100644 --- a/bindings/pyroot/cppyy/cppyy/test/CMakeLists.txt +++ b/bindings/pyroot/cppyy/cppyy/test/CMakeLists.txt @@ -6,30 +6,22 @@ # Dictionary list set(CPPYY_TEST_DICTS -advancedcpp -advancedcpp2 -conversions -cpp11features -crossinheritance -datatypes -doc_helper -example01 -fragile -operators -overloads pythonizables -std_streams -templates -stltypes) +) foreach(DICT ${CPPYY_TEST_DICTS}) - set(CMAKE_ROOTTEST_NOROOTMAP OFF) - # only disable rootmap for all but example01 and stltypes which require them - if(NOT DICT STREQUAL "example01" AND NOT DICT STREQUAL "stltypes") - set(CMAKE_ROOTTEST_NOROOTMAP ON) - endif() - # Generate dictionary for the tests - ROOT_GENERATE_DICTIONARY(G__${DICT}Dict ${CMAKE_CURRENT_SOURCE_DIR}/${DICT}.h LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/${DICT}.xml) + set(CMAKE_ROOTTEST_NOROOTMAP ON) + + set(dictname ${DICT}Dict) + + # Generate dictionary WITH PCM/module + ROOT_GENERATE_DICTIONARY( + G__${dictname} + ${CMAKE_CURRENT_SOURCE_DIR}/${DICT}.h + LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/${DICT}.xml + MODULE ${dictname} + ) + # Create necessary shared libraries for the tests add_library(${DICT}Dict SHARED ${CMAKE_CURRENT_SOURCE_DIR}/${DICT}.cxx G__${DICT}Dict.cxx) target_include_directories(${DICT}Dict PUBLIC ${Python3_INCLUDE_DIRS} ${CMAKE_BINARY_DIR}/include) @@ -37,39 +29,22 @@ foreach(DICT ${CPPYY_TEST_DICTS}) target_compile_options(${DICT}Dict PRIVATE "-w") if(MSVC) target_link_libraries(${DICT}Dict PUBLIC Python3::Python) + set_target_properties(${DICT}Dict PROPERTIES + PREFIX "lib" + IMPORT_PREFIX "lib" + ) + #set_target_properties(${DICT}Dict PROPERTIES PREFIX "") + set_target_properties(${DICT}Dict PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) elseif(APPLE) target_link_libraries(${DICT}Dict PUBLIC -Wl,-bind_at_load -Wl,-w -Wl,-undefined -Wl,dynamic_lookup) else() target_link_libraries(${DICT}Dict PUBLIC -Wl,--unresolved-symbols=ignore-all) endif() + endforeach() unset(CMAKE_ROOTTEST_NOROOTMAP) -# Tests list -set(CPPYY_TESTS -test_aclassloader -test_advancedcpp -test_api -test_boost -test_conversions -test_crossinheritance -test_datatypes -test_doc_features -test_eigen -test_fragile -# The leakcheck test is disabled due to its sporadic nature, especially fragile on VMs -# test_leakcheck -test_lowlevel -test_numba -test_operators -test_overloads -test_pythonify -test_pythonization -test_regression -test_streams -test_templates -test_concurrent) - +set(enable_test_cpp11features FALSE) if(NOT CMAKE_CXX_STANDARD EQUAL 23) # test_cpp11features crashes when run with C++23 if(APPLE) @@ -79,21 +54,81 @@ if(NOT CMAKE_CXX_STANDARD EQUAL 23) OUTPUT_STRIP_TRAILING_WHITESPACE ) if(MACOS_VERSION VERSION_LESS "26.0") - # Parts of this test suite fail with std::make_unique - list(APPEND CPPYY_TEST_DICTS test_cpp11features) + # Parts of this test suite fail with std::make_unique + set(enable_test_cpp11features TRUE) endif() else() - list(APPEND CPPYY_TESTS test_cpp11features) + set(enable_test_cpp11features TRUE) endif() endif() +if(MSVC) + set(common_args GENERIC PYTHON_DEPS pytest) +else() + set(common_args GENERIC ENVIRONMENT ${ld_library_path}=${CMAKE_CURRENT_BINARY_DIR} PYTHON_DEPS pytest) +endif() + +set(root_cmd $ -b -q -l) + +function(ADD_PYUNITTEST_ACLIC TESTNAME) + set(options) + set(oneValueArgs) + set(multiValueArgs DICTNAME) + cmake_parse_arguments(ARG + "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} + ) + + ROOT_ADD_PYUNITTEST(${TESTNAME} ${TESTNAME}.py ${common_args} + COPY_TO_BUILDDIR ${ARG_DICTNAME}.cxx ${ARG_DICTNAME}.h + PRECMD ${root_cmd} -e ".L ${ARG_DICTNAME}.cxx++" + ) +endfunction() + +ADD_PYUNITTEST_ACLIC(test_conversions DICTNAME conversions) +ADD_PYUNITTEST_ACLIC(test_crossinheritance DICTNAME crossinheritance) +ADD_PYUNITTEST_ACLIC(test_doc_features DICTNAME doc_helper) +ADD_PYUNITTEST_ACLIC(test_fragile DICTNAME fragile) +ADD_PYUNITTEST_ACLIC(test_operators DICTNAME operators) +ADD_PYUNITTEST_ACLIC(test_overloads DICTNAME overloads) +ADD_PYUNITTEST_ACLIC(test_streams DICTNAME std_streams) +ADD_PYUNITTEST_ACLIC(test_templates DICTNAME templates) + +ROOT_ADD_PYUNITTEST(test_pythonify test_pythonify.py ${common_args} + COPY_TO_BUILDDIR example01.cxx example01.h + PRECMD ${root_cmd} -e ".L example01.cxx++" + FIXTURES_SETUP example01_dict_fixture +) + +ROOT_ADD_PYUNITTEST(test_advancedcpp test_advancedcpp.py ${common_args} + COPY_TO_BUILDDIR advancedcpp.cxx advancedcpp.h advancedcpp2.cxx advancedcpp2.h + PRECMD ${root_cmd} -e ".L advancedcpp.cxx++" -e ".L advancedcpp2.cxx++" +) + +ROOT_ADD_PYUNITTEST(test_lowlevel test_lowlevel.py ${common_args} + COPY_TO_BUILDDIR datatypes.cxx datatypes.h + PRECMD ${root_cmd} -e ".L datatypes.cxx++" + FIXTURES_SETUP datatypes_dict_fixture +) + +ROOT_ADD_PYUNITTEST(test_aclassloader test_aclassloader.py ${common_args} FIXTURES_REQUIRED example01_dict_fixture) +ROOT_ADD_PYUNITTEST(test_api test_api.py ${common_args}) +ROOT_ADD_PYUNITTEST(test_boost test_boost.py ${common_args}) +ROOT_ADD_PYUNITTEST(test_concurrent test_concurrent.py ${common_args}) +ROOT_ADD_PYUNITTEST(test_datatypes test_datatypes.py ${common_args} FIXTURES_REQUIRED datatypes_dict_fixture) +ROOT_ADD_PYUNITTEST(test_eigen test_eigen.py ${common_args}) +ROOT_ADD_PYUNITTEST(test_numba test_numba.py ${common_args}) +ROOT_ADD_PYUNITTEST(test_pythonization test_pythonization.py ${common_args}) +ROOT_ADD_PYUNITTEST(test_regression test_regression.py ${common_args}) + if(NOT APPLE) - # test_stltypes completely fails on OSX - # because it is unable to load the necessary shared libraries - list(APPEND CPPYY_TESTS test_stltypes) + # test_stltypes completely fails on OSX + # because it is unable to load the necessary shared libraries + ADD_PYUNITTEST_ACLIC(test_stltypes DICTNAME stltypes) endif() -# Configure the tests -foreach(TEST ${CPPYY_TESTS}) - ROOT_ADD_PYUNITTEST(${TEST} ${TEST}.py GENERIC ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR} PYTHON_DEPS pytest) -endforeach() +if(enable_test_cpp11features) + ADD_PYUNITTEST_ACLIC(test_cpp11features DICTNAME cpp11features) +endif() + +# The leakcheck test is disabled due to its sporadic nature, especially fragile on VMs +# ROOT_ADD_PYUNITTEST(test_leakcheck test_leakcheck.py ${common_args}) diff --git a/bindings/pyroot/cppyy/cppyy/test/templates.h b/bindings/pyroot/cppyy/cppyy/test/templates.h index addded9bda085..78d4c2fe32f0a 100644 --- a/bindings/pyroot/cppyy/cppyy/test/templates.h +++ b/bindings/pyroot/cppyy/cppyy/test/templates.h @@ -1,9 +1,10 @@ #ifndef CPPYY_TEST_TEMPLATES_H #define CPPYY_TEST_TEMPLATES_H +#include #include #include -#include +#include #include #ifndef _WIN32 diff --git a/bindings/pyroot/cppyy/cppyy/test/test_aclassloader.py b/bindings/pyroot/cppyy/cppyy/test/test_aclassloader.py index 528867dee4bf6..91ba571dc9e39 100644 --- a/bindings/pyroot/cppyy/cppyy/test/test_aclassloader.py +++ b/bindings/pyroot/cppyy/cppyy/test/test_aclassloader.py @@ -1,9 +1,8 @@ -import py, pytest, os +import pytest, os from pytest import raises, mark from support import setup_make, IS_MAC -currpath = os.getcwd() -test_dct = currpath + "/libexample01Dict" +test_dct = "libexample_cxx" class TestACLASSLOADER: @@ -11,7 +10,7 @@ class TestACLASSLOADER: def setup_class(cls): import cppyy - @mark.xfail(condition=IS_MAC, reason="Fails on OSX") + @mark.xfail(reason="rootmap files are a legacy feature") def test01_class_autoloading(self): """Test whether a class can be found through .rootmap.""" import cppyy diff --git a/bindings/pyroot/cppyy/cppyy/test/test_advancedcpp.py b/bindings/pyroot/cppyy/cppyy/test/test_advancedcpp.py index eb89c416baf92..39c1bec3374b9 100644 --- a/bindings/pyroot/cppyy/cppyy/test/test_advancedcpp.py +++ b/bindings/pyroot/cppyy/cppyy/test/test_advancedcpp.py @@ -1,9 +1,8 @@ -import py, pytest, os +import pytest, os from pytest import mark, raises, skip from support import setup_make, pylong, IS_WINDOWS, ispypy -currpath = os.getcwd() -test_dct = currpath + "/libadvancedcppDict" +test_dct = "advancedcpp_cxx" class TestADVANCEDCPP: @@ -156,7 +155,7 @@ def test03a_namespace_lookup_on_update(self): import cppyy gbl = cppyy.gbl - lib2 = cppyy.load_reflection_info("libadvancedcpp2Dict") + lib2 = cppyy.load_reflection_info("advancedcpp2_cxx") assert gbl.a_ns is gbl.a_ns assert gbl.a_ns.d_ns is gbl.a_ns.d_ns diff --git a/bindings/pyroot/cppyy/cppyy/test/test_concurrent.py b/bindings/pyroot/cppyy/cppyy/test/test_concurrent.py index e77f3aa530b7e..567aca0a6b8f3 100644 --- a/bindings/pyroot/cppyy/cppyy/test/test_concurrent.py +++ b/bindings/pyroot/cppyy/cppyy/test/test_concurrent.py @@ -1,6 +1,6 @@ import pytest from pytest import raises, skip, mark -from support import IS_MAC_ARM +from support import IS_MAC_ARM, IS_WINDOWS class TestCONCURRENT: @@ -91,6 +91,7 @@ def test03_timeout(self): if t.is_alive(): # was timed-out cppyy.gbl.test12_timeout.stopit[0] = True + @mark.xfail(condition=IS_WINDOWS, reason="Fails on Windows") def test04_cpp_threading_with_exceptions(self): """Threads and Python exceptions""" diff --git a/bindings/pyroot/cppyy/cppyy/test/test_conversions.py b/bindings/pyroot/cppyy/cppyy/test/test_conversions.py index 60703dae220c6..aa8b37442fd3c 100644 --- a/bindings/pyroot/cppyy/cppyy/test/test_conversions.py +++ b/bindings/pyroot/cppyy/cppyy/test/test_conversions.py @@ -1,9 +1,8 @@ -import py, pytest, os -from pytest import raises -from support import setup_make +import pytest, os +from pytest import raises, mark +from support import setup_make, IS_WINDOWS -currpath = os.getcwd() -test_dct = currpath + "/libconversionsDict" +test_dct = "conversions_cxx" class TestCONVERSIONS: @@ -84,6 +83,7 @@ def test03_error_handling(self): gc.collect() assert CC.s_count == 0 + @mark.xfail(condition=IS_WINDOWS, reason="Fails on Windows") def test04_implicit_conversion_from_tuple(self): """Allow implicit conversions from tuples as arguments {}-like""" diff --git a/bindings/pyroot/cppyy/cppyy/test/test_cpp11features.py b/bindings/pyroot/cppyy/cppyy/test/test_cpp11features.py index 99dd13c065e4c..1e214abbeb67d 100644 --- a/bindings/pyroot/cppyy/cppyy/test/test_cpp11features.py +++ b/bindings/pyroot/cppyy/cppyy/test/test_cpp11features.py @@ -1,10 +1,9 @@ -import py, sys, pytest, os +import sys, pytest, os from pytest import mark, raises from support import setup_make, ispypy, IS_MAC_ARM -currpath = os.getcwd() -test_dct = currpath + "/libcpp11featuresDict" +test_dct = "cpp11features_cxx" class TestCPP11FEATURES: diff --git a/bindings/pyroot/cppyy/cppyy/test/test_crossinheritance.py b/bindings/pyroot/cppyy/cppyy/test/test_crossinheritance.py index c9f8128b2e844..416382385b250 100644 --- a/bindings/pyroot/cppyy/cppyy/test/test_crossinheritance.py +++ b/bindings/pyroot/cppyy/cppyy/test/test_crossinheritance.py @@ -1,10 +1,8 @@ -import py, os, pytest +import os, pytest from pytest import raises, skip, mark -from support import setup_make, pylong, IS_MAC_ARM +from support import setup_make, pylong, IS_MAC_ARM, IS_WINDOWS - -currpath = os.getcwd() -test_dct = currpath + "/libcrossinheritanceDict" +test_dct = "crossinheritance_cxx" class TestCROSSINHERITANCE: @@ -227,7 +225,7 @@ def get_value(self): p1 = TPyDerived1() assert p1.get_value() == 13 - @mark.xfail(run=False, condition=IS_MAC_ARM, reason = "Crashes on OS X ARM with" \ + @mark.xfail(run=False, condition=IS_MAC_ARM | IS_WINDOWS, reason = "Crashes on OS X ARM with" \ "libc++abi: terminating due to uncaught exception") def test08_error_handling(self): """Python errors should propagate through wrapper""" @@ -290,6 +288,7 @@ def get_value(self): assert raises(TypeError, Base1.call_get_value, d) + @mark.xfail(condition=IS_WINDOWS, reason="TypeError: 'NoneType' object cannot be interpreted as an integer") def test10_python_in_templates(self): """Usage of Python derived objects in std::vector""" @@ -373,6 +372,7 @@ def some_imp(self): assert call_shared(v) == 13 assert v.some_imp() == 13 + @mark.xfail(condition=IS_WINDOWS, reason="assert 0 == (0 + 1)") def test12a_counter_test(self): """Test countable base counting""" @@ -993,6 +993,7 @@ def verify(a, n1, n2, n3): a = MyPyDerived(27, 55, nArgs=2) verify(a, 27, 55, 67) + @mark.xfail(run=False, condition=IS_WINDOWS, reason="TypeError: has no attribute 'npos'.") def test23_const_byvalue_return(self): """Const by-value return in overridden method""" diff --git a/bindings/pyroot/cppyy/cppyy/test/test_datatypes.py b/bindings/pyroot/cppyy/cppyy/test/test_datatypes.py index 09d0ed853337a..12774e43fde36 100644 --- a/bindings/pyroot/cppyy/cppyy/test/test_datatypes.py +++ b/bindings/pyroot/cppyy/cppyy/test/test_datatypes.py @@ -1,9 +1,8 @@ -import py, sys, pytest, os +import sys, pytest, os from pytest import mark, raises, skip -from support import setup_make, pylong, pyunicode, IS_MAC, IS_MAC_ARM +from support import setup_make, pylong, pyunicode, IS_MAC, IS_MAC_ARM, IS_WINDOWS -currpath = os.getcwd() -test_dct = currpath + "/libdatatypesDict" +test_dct = "datatypes_cxx" class TestDATATYPES: @@ -1949,6 +1948,7 @@ def test38_plain_old_data(self): assert len(f1.fPtrArr) == 3 assert list(f1.fPtrArr) == [1., 2., 3] + @mark.xfail(condition=IS_WINDOWS, reason="Test doesn't work on Windows") def test39_aggregates(self): """Initializer construction of aggregates""" diff --git a/bindings/pyroot/cppyy/cppyy/test/test_doc_features.py b/bindings/pyroot/cppyy/cppyy/test/test_doc_features.py index fe070747209a8..b3c8b0f6b0ee5 100644 --- a/bindings/pyroot/cppyy/cppyy/test/test_doc_features.py +++ b/bindings/pyroot/cppyy/cppyy/test/test_doc_features.py @@ -1,10 +1,9 @@ -import py, sys, pytest, os +import sys, pytest, os from pytest import mark, raises, skip from support import setup_make, ispypy, IS_WINDOWS, IS_MAC_ARM -currpath = os.getcwd() -test_dct = currpath + "/libdoc_helperDict" +test_dct = "doc_helper_cxx" class TestDOCFEATURES: @@ -784,6 +783,7 @@ def test02_use_c_void_p(self): Advert02.Picam_OpenFirstCamera(cam) assert Advert02.Picam_CloseCamera(cam) + @mark.xfail(condition=IS_WINDOWS, reason="Fails on Windows") def test03_use_of_ctypes_and_enum(self): """Use of (opaque) enum through ctypes.c_void_p""" @@ -1223,8 +1223,8 @@ def test_autocast_and_identiy(self): assert type(b) == CC.Derived assert d is b - @mark.xfail(run=False, condition=IS_MAC_ARM, reason = "Crashes on OS X ARM with" \ - "libc++abi: terminating due to uncaught exception") + @mark.xfail(run=False, condition=IS_MAC_ARM | IS_WINDOWS, reason = "Crashes on OS X ARM with" \ + "libc++abi: terminating due to uncaught exception, and also on Windows") def test_exceptions(self): """Exceptions example""" diff --git a/bindings/pyroot/cppyy/cppyy/test/test_fragile.py b/bindings/pyroot/cppyy/cppyy/test/test_fragile.py index 25da1b5e5366f..fad7f785f1c48 100644 --- a/bindings/pyroot/cppyy/cppyy/test/test_fragile.py +++ b/bindings/pyroot/cppyy/cppyy/test/test_fragile.py @@ -1,11 +1,9 @@ -import py, os, sys, pytest +import os, sys, pytest from pytest import mark, raises, skip from support import setup_make, ispypy, IS_WINDOWS, IS_MAC_ARM -currpath = os.getcwd() -test_dct = currpath + "/libfragileDict" - +test_dct = "fragile_cxx" class TestFRAGILE: def setup_class(cls): @@ -35,7 +33,18 @@ def test02_missing_classes(self): assert cppyy.gbl.fragile == cppyy.gbl.fragile fragile = cppyy.gbl.fragile - raises(AttributeError, getattr, fragile, "no_such_class") + runtime_cxxmodules = "runtime_cxxmodules" in cppyy.gbl.gROOT.GetConfigFeatures() + + if True: + # When using modules, Clang records forward declarations as proper + # AST entities (incomplete types that can't be instantiated). + no_such_class = fragile.no_such_class + raises(TypeError, no_such_class) # cannot instantiate incomplete type + else: + # Without a PCM module, the incomplete type doesn't exist, because + # incomplete types are not existing in the rootmap + dictionary + # metadata. + raises(AttributeError, getattr, fragile, "no_such_class") assert fragile.C is fragile.C assert fragile.C == fragile.C @@ -573,7 +582,7 @@ def test24_asan(self): cppyy.include('sanitizer/asan_interface.h') - @mark.xfail() + @mark.xfail(run=False) def test25_cppdef_error_reporting(self): """Check error reporting of cppyy.cppdef""" @@ -692,7 +701,7 @@ def test30_two_nested_ambiguity(self): p = Test.Family1.Parent() p.children # used to crash - @mark.xfail() + @mark.xfail(run=False) def test31_template_with_class_enum(self): """Template instantiated with class enum""" diff --git a/bindings/pyroot/cppyy/cppyy/test/test_lowlevel.py b/bindings/pyroot/cppyy/cppyy/test/test_lowlevel.py index be0c99be74119..7f1d508e2b878 100644 --- a/bindings/pyroot/cppyy/cppyy/test/test_lowlevel.py +++ b/bindings/pyroot/cppyy/cppyy/test/test_lowlevel.py @@ -1,10 +1,9 @@ -import py, sys, pytest, os +import sys, pytest, os from pytest import mark, raises, skip from support import setup_make, pylong, pyunicode, IS_WINDOWS, ispypy -currpath = os.getcwd() -test_dct = currpath + "/libdatatypesDict" +test_dct = "datatypes_cxx" class TestLOWLEVEL: @@ -376,6 +375,7 @@ def py2c(pyargs): with raises(TypeError): cppyy.gbl.ArrayOfCStrings.takes_array_of_cstrings(pyargs, len(pyargs)) + @mark.xfail(run=False, condition=IS_WINDOWS, reason="Windows fatal exception: access violation") def test11_array_of_const_char_ref(self): """Test passting of const char**&""" diff --git a/bindings/pyroot/cppyy/cppyy/test/test_numba.py b/bindings/pyroot/cppyy/cppyy/test/test_numba.py index 13a678bfc04e1..6066def044dc6 100644 --- a/bindings/pyroot/cppyy/cppyy/test/test_numba.py +++ b/bindings/pyroot/cppyy/cppyy/test/test_numba.py @@ -1,7 +1,7 @@ import os, pytest import math, time from pytest import mark, raises -from support import setup_make, IS_MAC +from support import setup_make, IS_MAC, IS_WINDOWS try: import numba @@ -222,6 +222,7 @@ def go_fast(a, d): assert((go_fast(x, d) == go_slow(x, d)).all()) assert self.compare(go_slow, go_fast, 10000, x, d) + @mark.xfail(condition=IS_WINDOWS, reason="Fails on Windows") def test05_multiple_arguments_function(self): """Numba-JITing of functions with multiple arguments""" @@ -248,6 +249,7 @@ def loop_add(x): assert sum == loop_add(x) + @mark.xfail(condition=IS_WINDOWS, reason="Fails on Windows") def test06_multiple_arguments_template_freefunction(self): """Numba-JITing of a free template function that recieves more than one template arg""" @@ -342,6 +344,7 @@ def go_fast(a): assert((go_fast(x) == go_slow(x)).all()) assert self.compare(go_slow, go_fast, 100000, x) + @mark.xfail(condition=IS_WINDOWS, reason="Fails on Windows") def test09_non_typed_templates(self): """Numba-JITing of a free template function that recieves multiple template args with non types""" @@ -367,7 +370,7 @@ def tma(x): assert sum == tma(x) - @mark.xfail(condition=IS_MAC, reason="Fails on OSX") + @mark.xfail(condition=IS_MAC | IS_WINDOWS, reason="Fails on macOS and Windows") def test10_returning_a_reference(self): import cppyy import numpy as np @@ -567,6 +570,7 @@ def square_vec_slow(x): assert (np.array(y) == np_square_res).all() assert (np.array(x) == np_add_res).all() + @mark.xfail(condition=IS_WINDOWS, reason="Fails on Windows") def test13_std_vector_dot_product(self): """Numba-JITing of a dot_product method of a class that stores pointers to std::vectors on the python side""" import cppyy, cppyy.ll @@ -763,6 +767,7 @@ def tsa(a): assert type(tsa(a)) == int assert tsa(a) == 285 + @mark.xfail(condition=IS_WINDOWS, reason="Fails on Windows") def test02_class_features(self): """Numba support documentation example: class features""" diff --git a/bindings/pyroot/cppyy/cppyy/test/test_operators.py b/bindings/pyroot/cppyy/cppyy/test/test_operators.py index ca6cc3e58de73..85f37989032ba 100644 --- a/bindings/pyroot/cppyy/cppyy/test/test_operators.py +++ b/bindings/pyroot/cppyy/cppyy/test/test_operators.py @@ -1,10 +1,9 @@ -import py, pytest, os +import pytest, os from pytest import raises, skip, mark from support import setup_make, pylong, maxvalue, IS_WINDOWS, IS_MAC, no_root_errors -currpath = os.getcwd() -test_dct = currpath + "/liboperatorsDict" +test_dct = "operators_cxx" class TestOPERATORS: diff --git a/bindings/pyroot/cppyy/cppyy/test/test_overloads.py b/bindings/pyroot/cppyy/cppyy/test/test_overloads.py index 8635fe2e4272c..ff9a98a343746 100644 --- a/bindings/pyroot/cppyy/cppyy/test/test_overloads.py +++ b/bindings/pyroot/cppyy/cppyy/test/test_overloads.py @@ -1,10 +1,9 @@ -import py, pytest, os +import pytest, os from pytest import raises, skip, mark from support import setup_make, ispypy, IS_WINDOWS, IS_MAC_ARM -currpath = os.getcwd() -test_dct = currpath + "/liboverloadsDict" +test_dct = "overloads_cxx" class TestOVERLOADS: diff --git a/bindings/pyroot/cppyy/cppyy/test/test_pythonify.py b/bindings/pyroot/cppyy/cppyy/test/test_pythonify.py index 353e5612c348b..f967265d7626f 100644 --- a/bindings/pyroot/cppyy/cppyy/test/test_pythonify.py +++ b/bindings/pyroot/cppyy/cppyy/test/test_pythonify.py @@ -1,10 +1,9 @@ -import py, pytest, os +import pytest, os from pytest import raises, skip from support import setup_make, pylong, ispypy -currpath = os.getcwd() -test_dct = currpath + "/libexample01Dict" +test_dct = "example01_cxx" class TestPYTHONIFY: diff --git a/bindings/pyroot/cppyy/cppyy/test/test_pythonization.py b/bindings/pyroot/cppyy/cppyy/test/test_pythonization.py index 31e68063f85af..e4026b5ade323 100644 --- a/bindings/pyroot/cppyy/cppyy/test/test_pythonization.py +++ b/bindings/pyroot/cppyy/cppyy/test/test_pythonization.py @@ -1,10 +1,8 @@ -import py, sys, pytest, os +import sys, pytest, os from pytest import mark, raises from support import setup_make, pylong - -currpath = os.getcwd() -test_dct = currpath + "/libpythonizablesDict" +test_dct = "libpythonizablesDict" class TestClassPYTHONIZATION: diff --git a/bindings/pyroot/cppyy/cppyy/test/test_regression.py b/bindings/pyroot/cppyy/cppyy/test/test_regression.py index eae00fa47b1c0..f3e9aed59d23e 100644 --- a/bindings/pyroot/cppyy/cppyy/test/test_regression.py +++ b/bindings/pyroot/cppyy/cppyy/test/test_regression.py @@ -349,6 +349,7 @@ class Bar { f = sds.Foo() assert f.bar.x == 5 + @mark.xfail(run=False, condition=IS_WINDOWS, reason="Fails on Windows") def test15_vector_vs_initializer_list(self): """Prefer vector in template and initializer_list in formal arguments""" diff --git a/bindings/pyroot/cppyy/cppyy/test/test_stltypes.py b/bindings/pyroot/cppyy/cppyy/test/test_stltypes.py index c10a1a0103b76..4be6524c5cee2 100644 --- a/bindings/pyroot/cppyy/cppyy/test/test_stltypes.py +++ b/bindings/pyroot/cppyy/cppyy/test/test_stltypes.py @@ -1,10 +1,9 @@ # -*- coding: UTF-8 -*- -import py, sys, pytest, os +import sys, pytest, os from pytest import mark, raises, skip -from support import setup_make, pylong, pyunicode, maxvalue, ispypy, no_root_errors +from support import setup_make, pylong, pyunicode, maxvalue, ispypy, no_root_errors, IS_WINDOWS -currpath = os.getcwd() -test_dct = currpath + "/libstltypesDict" +test_dct = "stltypes_cxx" global_n = 5 @@ -197,6 +196,7 @@ def setup_class(cls): cls.stltypes = cppyy.load_reflection_info(cls.test_dct) cls.N = global_n + @mark.xfail(run=False, condition=IS_WINDOWS, reason="Fails on Windows") def test01_builtin_type_vector_types(self): """Test access to std::vector/std::vector""" @@ -933,8 +933,6 @@ def test04_array_of_strings(self): assert tuple(cppyy.gbl.str_array_1) == ('a', 'b', 'c') str_array_2 = cppyy.gbl.str_array_2 - # fix up the size - str_array_2.size = 4 assert tuple(str_array_2) == ('d', 'e', 'f', 'g') assert tuple(str_array_2) == ('d', 'e', 'f', 'g') diff --git a/bindings/pyroot/cppyy/cppyy/test/test_streams.py b/bindings/pyroot/cppyy/cppyy/test/test_streams.py index d55de2d55ebc3..abf717948d5d7 100644 --- a/bindings/pyroot/cppyy/cppyy/test/test_streams.py +++ b/bindings/pyroot/cppyy/cppyy/test/test_streams.py @@ -1,10 +1,9 @@ -import py, pytest, os +import pytest, os from pytest import mark, raises from support import setup_make -currpath = os.getcwd() -test_dct = currpath + "/libstd_streamsDict" +test_dct = "std_streams_cxx" class TestSTDStreams: diff --git a/bindings/pyroot/cppyy/cppyy/test/test_templates.py b/bindings/pyroot/cppyy/cppyy/test/test_templates.py index 8dddc7461d00c..3afb1798f51a5 100644 --- a/bindings/pyroot/cppyy/cppyy/test/test_templates.py +++ b/bindings/pyroot/cppyy/cppyy/test/test_templates.py @@ -1,10 +1,9 @@ -import py, pytest, os +import pytest, os from pytest import mark, raises from support import setup_make, pylong -currpath = os.getcwd() -test_dct = currpath + "/libtemplatesDict" +test_dct = "templates_cxx" class TestTEMPLATES: