Skip to content

Commit

Permalink
[XrdEc] Create skeleton for unit test suite.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmichal committed Jan 12, 2021
1 parent e2f697b commit 9a100ba
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packaging/rhel/xrootd.spec.in
Expand Up @@ -1076,7 +1076,7 @@ fi
%if %{?_with_tests:1}%{!?_with_tests:0}
%files tests
%defattr(-,root,root,-)
%{_bindir}/text-runner
%{_bindir}/test-runner
%{_bindir}/xrdshmap
%{_libdir}/libXrdClTests.so
%{_libdir}/libXrdClTestsHelper.so
Expand Down
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
@@ -1,6 +1,7 @@

add_subdirectory( common )
add_subdirectory( XrdClTests )
add_subdirectory( XrdEcTests )
add_subdirectory( XrdSsiTests )

if( BUILD_CEPH )
Expand Down
20 changes: 20 additions & 0 deletions tests/XrdEcTests/CMakeLists.txt
@@ -0,0 +1,20 @@

include( XRootDCommon )
include_directories( ${CPPUNIT_INCLUDE_DIRS} ../common)

add_library(
XrdEcTests MODULE
StrmWriterTests.cc
ReaderTests.cc
)

target_link_libraries(
XrdEcTests
XrdEc )

#-------------------------------------------------------------------------------
# Install
#-------------------------------------------------------------------------------
install(
TARGETS XrdEcTests
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} )
48 changes: 48 additions & 0 deletions tests/XrdEcTests/ReaderTest.cc
@@ -0,0 +1,48 @@
//------------------------------------------------------------------------------
// Copyright (c) 2011-2014 by European Organization for Nuclear Research (CERN)
// Author: Michal Simon <michal.simon@cern.ch>
//------------------------------------------------------------------------------
// This file is part of the XRootD software suite.
//
// XRootD is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// XRootD is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with XRootD. If not, see <http://www.gnu.org/licenses/>.
//
// In applying this licence, CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
//------------------------------------------------------------------------------

#include <cppunit/extensions/HelperMacros.h>
#include "TestEnv.hh"
#include "CppUnitXrdHelpers.hh"

#include "XrdEc/XrdEcReader.hh"

//------------------------------------------------------------------------------
// Declaration
//------------------------------------------------------------------------------
class ReaderTest: public CppUnit::TestCase
{
public:
CPPUNIT_TEST_SUITE( ReaderTest );
CPPUNIT_TEST( Test );
CPPUNIT_TEST_SUITE_END();
void Test();
};

CPPUNIT_TEST_SUITE_REGISTRATION( ReaderTest );

void ReaderTest::Test()
{
// TODO
}
48 changes: 48 additions & 0 deletions tests/XrdEcTests/StrmWriterTest.cc
@@ -0,0 +1,48 @@
//------------------------------------------------------------------------------
// Copyright (c) 2011-2014 by European Organization for Nuclear Research (CERN)
// Author: Michal Simon <michal.simon@cern.ch>
//------------------------------------------------------------------------------
// This file is part of the XRootD software suite.
//
// XRootD is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// XRootD is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with XRootD. If not, see <http://www.gnu.org/licenses/>.
//
// In applying this licence, CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
//------------------------------------------------------------------------------

#include <cppunit/extensions/HelperMacros.h>
#include "TestEnv.hh"
#include "CppUnitXrdHelpers.hh"

#include "XrdEc/XrdEcStrmWriter.hh"

//------------------------------------------------------------------------------
// Declaration
//------------------------------------------------------------------------------
class StrmWriterTest: public CppUnit::TestCase
{
public:
CPPUNIT_TEST_SUITE( StrmWriterTest );
CPPUNIT_TEST( Test );
CPPUNIT_TEST_SUITE_END();
void Test();
};

CPPUNIT_TEST_SUITE_REGISTRATION( StrmWriterTest );

void StrmWriterTest::Test()
{
// TODO
}
4 changes: 2 additions & 2 deletions tests/common/CMakeLists.txt
Expand Up @@ -16,13 +16,13 @@ target_link_libraries(
XrdCl
XrdUtils)

add_executable(text-runner TextRunner.cc PathProcessor.hh)
add_executable(test-runner TextRunner.cc PathProcessor.hh)
target_link_libraries(text-runner ${CMAKE_DL_LIBS} ${CPPUNIT_LIBRARIES} pthread)

#-------------------------------------------------------------------------------
# Install
#-------------------------------------------------------------------------------
install(
TARGETS XrdClTestsHelper text-runner
TARGETS XrdClTestsHelper test-runner
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

0 comments on commit 9a100ba

Please sign in to comment.