Skip to content

[roottest] use cmake for root/io tests [part5] #19287

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
1 change: 0 additions & 1 deletion roottest/root/io/tree/.rootrc

This file was deleted.

68 changes: 61 additions & 7 deletions roottest/root/io/tree/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,61 @@
#-------------------------------------------------------------------------------
#
# 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_COMPILE_MACRO(classes.C
FIXTURES_SETUP root-io-tree-classes-fixture)

ROOTTEST_ADD_TEST(write
MACRO write.C
ROOTEXE_OPTS -e "(void)gROOT->ProcessLine(\".L classes.C+\")"
FIXTURES_REQUIRED root-io-tree-classes-fixture
FIXTURES_SETUP root-io-tree-write-fixture)

ROOTTEST_ADD_TEST(copy
MACRO copy.C
ROOTEXE_OPTS -e "(void)gROOT->ProcessLine(\".L classes.C+\")"
FIXTURES_REQUIRED root-io-tree-classes-fixture
root-io-tree-write-fixture
FIXTURES_SETUP root-io-tree-copy-fixture)

ROOTTEST_ADD_TEST(read
MACRO read.C
OUTREF missingClass.ref
FIXTURES_REQUIRED root-io-tree-copy-fixture)

ROOTTEST_ADD_TEST(tref-write
MACRO tref_test.C
FIXTURES_SETUP root-io-tree-tref-write-fixture)

ROOTTEST_ADD_TEST(tref-read
MACRO tref_test_rd.C
OUTREF reftest.ref
FIXTURES_REQUIRED root-io-tree-tref-write-fixture)

ROOTTEST_COMPILE_MACRO(tref_test_pid.C
FIXTURES_SETUP root-io-tree-macro-fixture)

function(ROOTTEST_IO_TREE_TEST name require outref)
if(require)
set(_fixture root-io-tree-${require}-fixture)
endif()

ROOTTEST_ADD_TEST(${name}
ROOTEXE_OPTS -e "(void)gROOT->ProcessLine(\".L tref_test_pid.C+\")"
-e "#define STAGE \"${name}\""
MACRO run.C
OUTREF ${outref}
FIXTURES_REQUIRED root-io-tree-macro-fixture ${_fixture}
FIXTURES_SETUP root-io-tree-${name}-fixture)
endfunction(ROOTTEST_IO_TREE_TEST)


ROOTTEST_IO_TREE_TEST(first "" "")
ROOTTEST_IO_TREE_TEST(create-r first "")
ROOTTEST_IO_TREE_TEST(test-r create-r test-r.ref)
ROOTTEST_IO_TREE_TEST(create-rc create-r "")
ROOTTEST_IO_TREE_TEST(test-rc create-rc test-rc.ref)
ROOTTEST_IO_TREE_TEST(create-rcr create-rc "")
ROOTTEST_IO_TREE_TEST(test-rcr create-rcr test-rcr.ref)
ROOTTEST_IO_TREE_TEST(test-rcr2 create-rcr test-rcr2.ref)
ROOTTEST_IO_TREE_TEST(create-rcrr create-rcr "")
ROOTTEST_IO_TREE_TEST(test-rcrr create-rcrr test-rcrr.ref)
ROOTTEST_IO_TREE_TEST(test-rcrr2 create-rcrr test-rcrr2.ref)
ROOTTEST_IO_TREE_TEST(test-rcrr3 create-rcrr test-rcrr3.ref)
ROOTTEST_IO_TREE_TEST(test-rcrr123 create-rcrr test-rcrr123.ref)
102 changes: 0 additions & 102 deletions roottest/root/io/tree/Makefile

This file was deleted.

8 changes: 4 additions & 4 deletions roottest/root/io/tree/classes.C
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@

class TPhysObj : public TObject {
public:
ClassDef(TPhysObj,1)
ClassDefOverride(TPhysObj,1)
};

class TEmcl : public TPhysObj {
public:
int e;
ClassDef(TEmcl,1)
ClassDefOverride(TEmcl,1)
};

class TNonPhysObj : public TObject {
public:
ClassDef(TNonPhysObj,0)
ClassDefOverride(TNonPhysObj,0)
};

class TNonEmcl : public TNonPhysObj {
public:
int e;
ClassDef(TNonEmcl,1)
ClassDefOverride(TNonEmcl,1)
};


26 changes: 3 additions & 23 deletions roottest/root/io/tree/copy.C
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
{
#ifndef SECOND_RUN
gROOT->ProcessLine(".L classes.C+");

#ifdef ClingWorkAroundMissingAutoLoading
gSystem->Load("libTree");
#endif
#endif

#if defined(ClingWorkAroundMissingDynamicScope) && !defined(SECOND_RUN)
#define SECOND_RUN
gROOT->ProcessLine(".x copy.C");
#else

TEmcl *e = 0;
TNonEmcl *ne = 0;

TEmcl *e = nullptr;
TNonEmcl *ne = nullptr;

TFile *oldfile = new TFile("test.root");
TTree *oldtree = (TTree*)oldfile->Get("T");
Expand All @@ -29,12 +15,6 @@ oldtree->GetEntry(0);
tree->Fill();

file->Write();
#endif

#ifdef ClingWorkAroundBrokenUnnamedReturn
gApplication->Terminate(0);
#else
return 0;
#endif
file->Close();
}

4 changes: 0 additions & 4 deletions roottest/root/io/tree/doit

This file was deleted.

46 changes: 46 additions & 0 deletions roottest/root/io/tree/run.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
const char *file = "tref_test_pid.root";
const char *file_r = "tref_test_pid_r.root";
const char *file_rc = "tref_test_pid_rc.root";
const char *file_rcr = "tref_test_pid_rcr.root";
const char *file_rcrr = "tref_test_pid_rcrr.root";

std::string s = STAGE;

if(s == "first") {
create(file);
} else if (s == "create-r") {
addref(file, file_r, "r1", "N");
} else if (s == "test-r") {
readauto(file_r, "r1");
} else if (s == "create-rc") {
clone(file_r, file_rc);
} else if (s == "test-rc") {
readauto(file_rc, "r1");
readall(file_rc);
} else if (s == "create-rcr") {
addref(file_rc, file_rcr, "r2", "r1");
} else if (s == "test-rcr") {
readauto(file_rcr, "r1");
readall(file_rcr);
} else if (s == "test-rcr2") {
readauto(file_rcr, "r2");
readall(file_rcr);
} else if (s == "create-rcrr") {
addref(file_rcr, file_rcrr, "r3", "N");
} else if (s == "test-rcrr") {
readauto(file_rcrr, "r1");
readall(file_rcrr);
} else if (s == "test-rcrr2") {
readauto(file_rcrr, "r2");
readall(file_rcrr);
} else if (s == "test-rcrr3") {
readauto(file_rcrr, "r3");
readall(file_rcrr);
} else if (s == "test-rcrr123") {
readauto(file_rcrr, "r1:r2:r3");
}



}
Loading
Loading