Skip to content

[roottest] Migrate Make to CMake #18596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions roottest/oldMakefile
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From root-project/roottest#726 (comment):

Please remove this only as the very last step. It is still used(/useable) to clean all the by-product of the 'make' runs that are executed by ctest.

This file was deleted.

54 changes: 47 additions & 7 deletions roottest/root/io/compression/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,47 @@
#-------------------------------------------------------------------------------
#
# Placeholder file to translate the tests to the new CTest system. Meanwhile we
# define a CTest test that calls 'make' in ${CMAKE_CURRENT_SOURCE_DIR}
#
#-------------------------------------------------------------------------------
ROOTTEST_ADD_OLDTEST()
ROOT_GENERATE_DICTIONARY(G__IoCompressionGeneration
${CMAKE_CURRENT_SOURCE_DIR}/Event.h
LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/EventLinkDef.h)

ROOT_LINKER_LIBRARY(IoCompressionGeneration
${CMAKE_CURRENT_SOURCE_DIR}/IoCompressionGeneration.cxx
G__IoCompressionGeneration.cxx
LIBRARIES Core Tree Hist MathCore Physics Graf Matrix)

Comment on lines +5 to +8
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From root-project/roottest#774 (comment):

I recommend adding the ROOT_GENERATE_DICTIONARY as a FIXTURES_REQUIRED

if(MSVC)
add_custom_command(TARGET IoCompressionGeneration POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/libIoCompressionGeneration.dll
${CMAKE_CURRENT_BINARY_DIR}/libIoCompressionGeneration.dll
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/libIoCompressionGeneration.lib
${CMAKE_CURRENT_BINARY_DIR}/libIoCompressionGeneration.lib)
endif()

Comment on lines +10 to +16
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From root-project/roottest#774 (comment):

@bellenot Is that an okay solution?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From root-project/roottest#774 (comment):

@bellenot Is that an okay solution?

Almost. It should be:

if(MSVC AND NOT CMAKE_GENERATOR MATCHES Ninja)

ROOTTEST_GENERATE_EXECUTABLE(IoCompressionGenerator
${CMAKE_CURRENT_SOURCE_DIR}/IoCompressionGenerator.cxx
LIBRARIES Core RIO Net Tree Hist MathCore IoCompressionGeneration
DEPENDS IoCompressionGeneration
FIXTURES_SETUP io-compression-generator)
Comment on lines +18 to +21
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From root-project/roottest#774 (comment):

This actually needs to be a FIXTURES_REQUIRED rather than a DEPENDS.


set(size 20)
set(opt 1)

function(IO_COMPRESSION_GENERATION comp action)
ROOTTEST_ADD_TEST("${comp}-${action}"
COMMAND ./IoCompressionGenerator ${size} "${comp}" ${opt} "${action}"
FIXTURES_REQUIRED io-compression-generator
RESOURCE_LOCK io-compression-file)
endfunction()

IO_COMPRESSION_GENERATION(0 1)
IO_COMPRESSION_GENERATION(0 20)
IO_COMPRESSION_GENERATION(5 1)
IO_COMPRESSION_GENERATION(5 20)
IO_COMPRESSION_GENERATION(101 1)
IO_COMPRESSION_GENERATION(101 20)
IO_COMPRESSION_GENERATION(208 1)
IO_COMPRESSION_GENERATION(208 20)
IO_COMPRESSION_GENERATION(301 1)
IO_COMPRESSION_GENERATION(301 20)
IO_COMPRESSION_GENERATION(404 1)
IO_COMPRESSION_GENERATION(404 20)
IO_COMPRESSION_GENERATION(505 1)
IO_COMPRESSION_GENERATION(505 20)
2 changes: 1 addition & 1 deletion roottest/root/io/compression/Event.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ friend Bool_t operator<=(const EventHeader& h1, const EventHeader& h2);

ClassDef(EventHeader,1) //Event Header
};
inline Bool_t operator<=(const EventHeader& s1, const EventHeader& s2)
inline Bool_t operator<=(const EventHeader& /*s1*/, const EventHeader& /*s2*/)
{ return 0; }

template <class T> struct template1 {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
}

//______________________________________________________________________________
Event::Event(Int_t enumber)
Event::Event(Int_t /*enumber*/)
{
// Create an Event object.
// When the constructor is invoked for the first time, the class static
Expand Down Expand Up @@ -267,7 +267,7 @@
}

//______________________________________________________________________________
void Event::Reset(Option_t *option)
void Event::Reset(Option_t * /*option*/)
{
// Static function to reset all static objects for this event
// fgTracks->Delete(option);
Expand All @@ -285,7 +285,7 @@
if (i > 10000) nch += 3;
if (fEventName) delete [] fEventName;
fEventName = new char[nch];
sprintf(fEventName,"Event%d_Run%d",i,200);

Check warning on line 288 in roottest/root/io/compression/IoCompressionGeneration.cxx

View workflow job for this annotation

GitHub Actions / mac13 ARM64 builtin_zlib=ON

'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]

Check warning on line 288 in roottest/root/io/compression/IoCompressionGeneration.cxx

View workflow job for this annotation

GitHub Actions / mac-beta ARM64 CMAKE_CXX_STANDARD=20

'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]

Check warning on line 288 in roottest/root/io/compression/IoCompressionGeneration.cxx

View workflow job for this annotation

GitHub Actions / mac15 ARM64 CMAKE_CXX_STANDARD=20

'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]

Check warning on line 288 in roottest/root/io/compression/IoCompressionGeneration.cxx

View workflow job for this annotation

GitHub Actions / mac14 X64 CMAKE_CXX_STANDARD=20

'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
fNtrack = 0;
fEvtHdr.Set(i, run, date);
if (!fgHist) fgHist = new TH1F("hstat","Event Histogram",100,0,1);
Expand All @@ -298,7 +298,7 @@
char lachaud[64];
string lac;
for (Int_t j=0;j<nch;j++) {
sprintf(lachaud,"run%d event%d j%d",run,i,j);

Check warning on line 301 in roottest/root/io/compression/IoCompressionGeneration.cxx

View workflow job for this annotation

GitHub Actions / mac13 ARM64 builtin_zlib=ON

'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]

Check warning on line 301 in roottest/root/io/compression/IoCompressionGeneration.cxx

View workflow job for this annotation

GitHub Actions / mac-beta ARM64 CMAKE_CXX_STANDARD=20

'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]

Check warning on line 301 in roottest/root/io/compression/IoCompressionGeneration.cxx

View workflow job for this annotation

GitHub Actions / mac15 ARM64 CMAKE_CXX_STANDARD=20

'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]

Check warning on line 301 in roottest/root/io/compression/IoCompressionGeneration.cxx

View workflow job for this annotation

GitHub Actions / mac14 X64 CMAKE_CXX_STANDARD=20

'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
lac = lachaud;
fLachaud.push_back(lac);
}
Expand Down Expand Up @@ -439,7 +439,7 @@
if (trackNumber > 10000) nch += 3;
// if (fTrackName) delete [] fTrackName;
fTrackName = new char[nch];
sprintf(fTrackName,"Track%d",trackNumber);

Check warning on line 442 in roottest/root/io/compression/IoCompressionGeneration.cxx

View workflow job for this annotation

GitHub Actions / mac13 ARM64 builtin_zlib=ON

'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]

Check warning on line 442 in roottest/root/io/compression/IoCompressionGeneration.cxx

View workflow job for this annotation

GitHub Actions / mac-beta ARM64 CMAKE_CXX_STANDARD=20

'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]

Check warning on line 442 in roottest/root/io/compression/IoCompressionGeneration.cxx

View workflow job for this annotation

GitHub Actions / mac15 ARM64 CMAKE_CXX_STANDARD=20

'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]

Check warning on line 442 in roottest/root/io/compression/IoCompressionGeneration.cxx

View workflow job for this annotation

GitHub Actions / mac14 X64 CMAKE_CXX_STANDARD=20

'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
//Int_t i;
//fHits.clear();
//for (i=0;i<12;i++) fHits.push_back(i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ int main(int argc, char **argv)
filename << "Event" << comp << ".root";

TFile *hfile;
TTree *tree;
Event *event = 0;

// Fill event, header and tracks with some random numbers
Expand All @@ -300,7 +299,7 @@ int main(int argc, char **argv)
// Read case
if (read) {
hfile = new TFile(filename.str().c_str());
tree = (TTree*)hfile->Get("T");
TTree *tree = (TTree*)hfile->Get("T");
TBranch *branch = tree->GetBranch("event");
branch->SetAddress(&event);
Int_t nentries = (Int_t)tree->GetEntries();
Expand Down Expand Up @@ -372,7 +371,7 @@ int main(int argc, char **argv)
hfile = new TFile(filename.str().c_str(),"RECREATE","TTree benchmark ROOT file");

// Test get and set functions in TFile
int testValue = -2;
testValue = -2;
hfile->SetCompressionSettings(testValue);
if (hfile->GetCompressionSettings() != -1) exit(1);
if (hfile->GetCompressionAlgorithm() != -1) exit(2);
Expand Down
38 changes: 0 additions & 38 deletions roottest/root/io/compression/Makefile

This file was deleted.

36 changes: 31 additions & 5 deletions roottest/root/io/event/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,35 @@
# define a CTest test that calls 'make' in ${CMAKE_CURRENT_SOURCE_DIR}
#
#-------------------------------------------------------------------------------
if(NOT MSVC OR win_broken_tests)
ROOTTEST_ADD_TEST(roottest-root-io-event
COMMAND ${ROOT_GMAKE_PROGRAM} cleantest
WORKING_DIR ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS roottest-scripts-utils)
ROOT_GENERATE_DICTIONARY(G__IoEventGeneration
${CMAKE_CURRENT_SOURCE_DIR}/Event.h
LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/EventLinkDef.h)

ROOT_LINKER_LIBRARY(IoEventGeneration
${CMAKE_CURRENT_SOURCE_DIR}/IoEventGeneration.cxx
G__IoEventGeneration.cxx
LIBRARIES Core Tree Hist MathCore)

if(MSVC)
add_custom_command(TARGET IoEventGeneration POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/libIoEventGeneration.dll
${CMAKE_CURRENT_BINARY_DIR}/libIoEventGeneration.dll
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/libIoEventGeneration.lib
${CMAKE_CURRENT_BINARY_DIR}/libIoEventGeneration.lib)
endif()

ROOTTEST_GENERATE_EXECUTABLE(IoEventGenerator
${CMAKE_CURRENT_SOURCE_DIR}/IoEventGenerator.cxx
LIBRARIES Core RIO Net Tree Hist MathCore IoEventGeneration
DEPENDS IoEventGeneration
FIXTURES_SETUP io-event-generator)

ROOTTEST_ADD_TEST(write
COMMAND ./IoEventGenerator 10 1 1 1
FIXTURES_REQUIRED io-event-generator
RESOURCE_LOCK io-event-file)

ROOTTEST_ADD_TEST(read
COMMAND ./IoEventGenerator 10 1 1 20
FIXTURES_REQUIRED io-event-generator
RESOURCE_LOCK io-event-file)
File renamed without changes.
40 changes: 0 additions & 40 deletions roottest/root/io/event/Makefile

This file was deleted.

72 changes: 0 additions & 72 deletions roottest/root/io/event/dt_Makefile

This file was deleted.

10 changes: 3 additions & 7 deletions roottest/root/io/perf/CMakeLists.txt
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also consider this previous discussion on root/io/perf:

root-project/roottest#732 (comment)

Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#-------------------------------------------------------------------------------
#
# Placeholder file to translate the tests to the new CTest system. Meanwhile we
# define a CTest test that calls 'make' in ${CMAKE_CURRENT_SOURCE_DIR}
#
#-------------------------------------------------------------------------------
ROOTTEST_ADD_OLDTEST()
ROOTTEST_ADD_TEST(julius
COMMAND ${ROOT_root_CMD} -q -l -b "${CMAKE_CURRENT_SOURCE_DIR}/julius.C+"
)
34 changes: 0 additions & 34 deletions roottest/root/io/perf/Makefile

This file was deleted.

3 changes: 2 additions & 1 deletion roottest/root/io/perf/julius.C
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
// root > .x julius.C(5)
//By default the reader reads only 50% of the rows. This may be changed
//by changing the default value of fraction in the function jread.


#include "TAxis.h"
#include "TFile.h"
#include "TStopwatch.h"
#include "TTree.h"
Expand Down
18 changes: 0 additions & 18 deletions roottest/root/treeformula/Makefile

This file was deleted.

Loading
Loading