Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dCache
cta
Commits
5e55c15f
Commit
5e55c15f
authored
6 years ago
by
Steven Murray
Browse files
Options
Downloads
Patches
Plain Diff
Added cta_mediachanger_acs_AcsTest unit-tests
parent
0b5a9d85
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
cta.spec.in
+1
-0
1 addition, 0 deletions
cta.spec.in
mediachanger/acs/AcsTest.cpp
+104
-0
104 additions, 0 deletions
mediachanger/acs/AcsTest.cpp
mediachanger/acs/CMakeLists.txt
+21
-0
21 additions, 0 deletions
mediachanger/acs/CMakeLists.txt
tests/CMakeLists.txt
+1
-0
1 addition, 0 deletions
tests/CMakeLists.txt
with
127 additions
and
0 deletions
cta.spec.in
+
1
−
0
View file @
5e55c15f
...
...
@@ -238,6 +238,7 @@ Unit tests and system tests with virtual tape drives
%{_libdir}/libctadaemonunittests.so*
%{_libdir}/libctamediachangerunittests.so*
%{_libdir}/libctamediachangeracsdaemonunittests.so*
%{_libdir}/libctamediachangeracsunittests.so*
%{_bindir}/cta-systemTests
%{_libdir}/libctadaemonunittests-multiprocess.so*
%attr(0644,root,root) %{_datadir}/%{name}-%{ctaVersion}/unittest/*.suppr
...
...
This diff is collapsed.
Click to expand it.
mediachanger/acs/AcsTest.cpp
0 → 100644
+
104
−
0
View file @
5e55c15f
/*
* The CERN Tape Archive (CTA) project
* Copyright (C) 2015 CERN
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include
"common/exception/InvalidArgument.hpp"
#include
"mediachanger/acs/Acs.hpp"
#include
<gtest/gtest.h>
namespace
unitTests
{
class
cta_mediachanger_acs_AcsTest
:
public
::
testing
::
Test
{
protected:
virtual
void
SetUp
()
{
}
virtual
void
TearDown
()
{
}
};
/**
* Tests good day senario with Acs::strToDrveId.
*/
TEST_F
(
cta_mediachanger_acs_AcsTest
,
goodDayStr2DriveId
)
{
using
namespace
cta
::
mediachanger
::
acs
;
const
std
::
string
str
(
"1:2:3:4"
);
const
auto
driveId
=
Acs
::
str2DriveId
(
str
);
ASSERT_EQ
(
1
,
driveId
.
panel_id
.
lsm_id
.
acs
);
ASSERT_EQ
(
2
,
driveId
.
panel_id
.
lsm_id
.
lsm
);
ASSERT_EQ
(
3
,
driveId
.
panel_id
.
panel
);
ASSERT_EQ
(
4
,
driveId
.
drive
);
}
/**
* Tests too many components with Acs::strToDrveId.
*/
TEST_F
(
cta_mediachanger_acs_AcsTest
,
tooManyComponentsStr2DriveId
)
{
using
namespace
cta
::
mediachanger
::
acs
;
const
std
::
string
str
(
"1:2:3:4:5"
);
ASSERT_THROW
(
Acs
::
str2DriveId
(
str
),
cta
::
exception
::
InvalidArgument
);
}
/**
* Tests too few components with Acs::strToDrveId.
*/
TEST_F
(
cta_mediachanger_acs_AcsTest
,
tooFewComponentsStr2DriveIdgoodDayStr2DriveId
)
{
using
namespace
cta
::
mediachanger
::
acs
;
const
std
::
string
str
(
"1:2:3"
);
ASSERT_THROW
(
Acs
::
str2DriveId
(
str
),
cta
::
exception
::
InvalidArgument
);
}
/**
* Tests tool long component with Acs::strToDrveId.
*/
TEST_F
(
cta_mediachanger_acs_AcsTest
,
tooLongAcsComponentStr2DriveId
)
{
using
namespace
cta
::
mediachanger
::
acs
;
const
std
::
string
str
(
"1111:2:3:4"
);
ASSERT_THROW
(
Acs
::
str2DriveId
(
str
),
cta
::
exception
::
InvalidArgument
);
}
/**
* Tests tool long component with Acs::strToDrveId.
*/
TEST_F
(
cta_mediachanger_acs_AcsTest
,
tooLongLsmComponentStr2DriveId
)
{
using
namespace
cta
::
mediachanger
::
acs
;
const
std
::
string
str
(
"1:2222:3:4"
);
ASSERT_THROW
(
Acs
::
str2DriveId
(
str
),
cta
::
exception
::
InvalidArgument
);
}
/**
* Tests tool long component with Acs::strToDrveId.
*/
TEST_F
(
cta_mediachanger_acs_AcsTest
,
tooLongPanComponentStr2DriveId
)
{
using
namespace
cta
::
mediachanger
::
acs
;
const
std
::
string
str
(
"1:2:3333:4"
);
ASSERT_THROW
(
Acs
::
str2DriveId
(
str
),
cta
::
exception
::
InvalidArgument
);
}
/**
* Tests tool long component with Acs::strToDrveId.
*/
TEST_F
(
cta_mediachanger_acs_AcsTest
,
tooLongDrvComponentStr2DriveId
)
{
using
namespace
cta
::
mediachanger
::
acs
;
const
std
::
string
str
(
"1:2:3:4444"
);
ASSERT_THROW
(
Acs
::
str2DriveId
(
str
),
cta
::
exception
::
InvalidArgument
);
}
}
// namespace unitTests
This diff is collapsed.
Click to expand it.
mediachanger/acs/CMakeLists.txt
+
21
−
0
View file @
5e55c15f
...
...
@@ -41,6 +41,27 @@ set_target_properties (cta-acs PROPERTIES
COMPILE_FLAGS -I/usr/include/CDK
COMPILE_DEFINITIONS LINUX
)
################################################################################
# Rules to build and install unit-tests
################################################################################
set
(
MEDIACHANGER_ACS_UNIT_TESTS_LIB_SRC_FILES
AcsTest.cpp
)
add_library
(
ctamediachangeracsunittests SHARED
${
MEDIACHANGER_ACS_UNIT_TESTS_LIB_SRC_FILES
}
)
set_property
(
TARGET ctamediachangeracsunittests PROPERTY SOVERSION
"
${
CTA_SOVERSION
}
"
)
set_property
(
TARGET ctamediachangeracsunittests PROPERTY VERSION
"
${
CTA_LIBVERSION
}
"
)
target_link_libraries
(
ctamediachangeracsunittests
cta-acs
)
set_target_properties
(
ctamediachangeracsunittests PROPERTIES
COMPILE_FLAGS -I/usr/include/CDK
COMPILE_DEFINITIONS LINUX
)
install
(
TARGETS ctamediachangeracsunittests DESTINATION usr/
${
CMAKE_INSTALL_LIBDIR
}
)
################################################################################
# Rules to build and install castor-tape-acs-dismount
################################################################################
...
...
This diff is collapsed.
Click to expand it.
tests/CMakeLists.txt
+
1
−
0
View file @
5e55c15f
...
...
@@ -41,6 +41,7 @@ target_link_libraries(cta-unitTests
ctadaemonunittests
ctamediachangerunittests
ctamediachangeracsdaemonunittests
ctamediachangeracsunittests
${
GMOCK_LIB
}
gtest
pthread
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment