Commit 0687bea5 authored by Steven Murray's avatar Steven Murray
Browse files

Fixed more c77 errors

parent 25053c10
# 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/>.
cmake_minimum_required (VERSION 2.6)
project(cta)
......@@ -24,6 +39,29 @@ set(CMAKE_CXX_FLAGS "-fPIC -pedantic -Wall -Wextra -Werror -Wno-unused-parameter
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g")
set (CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wnon-virtual-dtor")
# Switch on support for c++0x if the compiler is gcc 4.4.7 or clang
execute_process(
COMMAND ${CMAKE_C_COMPILER} -dumpversion
OUTPUT_VARIABLE GCC_VERSION)
if (CMAKE_COMPILER_IS_GNUCC)
if (GCC_VERSION VERSION_GREATER 4.4.6)
message(STATUS "Detected gcc >= 4.4.7 - switching on support for c++0x")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
endif (GCC_VERSION VERSION_GREATER 4.4.6)
endif (CMAKE_COMPILER_IS_GNUCC)
set (GCC_VERSION_GE_4_8_0 FALSE)
if (CMAKE_COMPILER_IS_GNUCC AND ((GCC_VERSION VERSION_GREATER 4.8.0) OR (GCC_VERSION VERSION_EQUAL 4.8.0)))
set (GCC_VERSION_GE_4_8_0 TRUE)
endif (CMAKE_COMPILER_IS_GNUCC AND ((GCC_VERSION VERSION_GREATER 4.8.0) OR (GCC_VERSION VERSION_EQUAL 4.8.0)))
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
message(STATUS "Detected clang - switching on support for c++0x")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# Generate the compilation variables, if needed
if (NOT DEFINED SKIP_UNIT_TESTS)
message (STATUS "Setting SKIP_UNIT_TESTS to the value of 0")
......
......@@ -41,7 +41,7 @@ public:
/**
* Destructor
*/
~TapeMount() throw();
virtual ~TapeMount() throw();
virtual void setId(const uint64_t id);
virtual uint64_t getId() const;
......
......@@ -64,7 +64,7 @@ set(ObjectStoreUnitTests
add_library(ctaobjectstoreunittests SHARED ${ObjectStoreUnitTests})
target_link_libraries(ctaobjectstoreunittests
protobuf rados ctacommon gtest gmock ctaobjectstore)
protobuf rados ctacommon gtest ctaobjectstore)
add_executable(makeMinimalVFS makeMinimalVFS.cpp)
target_link_libraries(makeMinimalVFS
......@@ -76,4 +76,4 @@ target_link_libraries(listObjectStore
add_executable(dumpObject dumpObject.cpp)
target_link_libraries(dumpObject
protobuf ctaobjectstore ctacommon)
\ No newline at end of file
protobuf ctaobjectstore ctacommon)
......@@ -18,7 +18,9 @@
#include "MockRemoteFullFS.hpp"
#include "common/exception/Errnum.hpp"
#include <fcntl.h>
#include <unistd.h>
namespace cta {
......@@ -132,4 +134,4 @@ namespace cta {
} // end of namespace cta
\ No newline at end of file
} // end of namespace cta
......@@ -87,7 +87,7 @@ namespace threadedUnitTests {
ts.tv_sec = 0;
ts.tv_nsec = 100*1000*1000;
nanosleep(&ts, NULL);
ASSERT_EQ(false, cp.running());
ASSERT_FALSE(cp.running());
EXPECT_THROW(cp.exitCode(), castor::server::ChildProcess::ProcessWasKilled);
}
} // namespace threadedUnitTests
......@@ -64,21 +64,21 @@ namespace unitTests {
castor::server::PosixSemaphore s(2);
ASSERT_NO_THROW(s.acquire());
ASSERT_EQ(true, s.tryAcquire());
ASSERT_EQ(false, s.tryAcquire());
ASSERT_FALSE(s.tryAcquire());
}
TEST(castor_tape_threading, CondVarSemaphore_basic_counting) {
castor::server::CondVarSemaphore s(2);
ASSERT_NO_THROW(s.acquire());
ASSERT_EQ(true, s.tryAcquire());
ASSERT_EQ(false, s.tryAcquire());
ASSERT_FALSE(s.tryAcquire());
}
TEST(castor_tape_threading, Semaphore_basic_counting) {
castor::server::Semaphore s(2);
ASSERT_NO_THROW(s.acquire());
ASSERT_EQ(true, s.tryAcquire());
ASSERT_EQ(false, s.tryAcquire());
ASSERT_FALSE(s.tryAcquire());
}
class Thread_exception_throwing: public castor::server::Thread {
......
......@@ -21,6 +21,17 @@ cmake_minimum_required (VERSION 2.6)
include_directories(${CMAKE_SOURCE_DIR}/tapeserver)
if(CMAKE_COMPILER_IS_GNUCC)
if(GCC_VERSION_GE_4_8_0)
set_property(SOURCE Device.cpp
PROPERTY COMPILE_FLAGS " -Wno-unused-local-typedefs")
set_property(SOURCE DeviceTest.cpp
PROPERTY COMPILE_FLAGS " -Wno-unused-local-typedefs")
set_property(SOURCE StructuresTest.cpp
PROPERTY COMPILE_FLAGS " -Wno-unused-local-typedefs")
endif(GCC_VERSION_GE_4_8_0)
endif(CMAKE_COMPILER_IS_GNUCC)
add_library(SCSI Device.cpp Structures.cpp Constants.cpp Exception.cpp)
add_library(ctatapeserverscsiunittests SHARED
......
......@@ -28,7 +28,7 @@ include_directories(${PROJECT_BINARY_DIR})
find_package( ZLIB REQUIRED )
add_library(ctaTapeServerDaemon
set(CTATAPESERVERDAEMON_LIBRARY_SRCS
Catalogue.cpp
CatalogueDrive.cpp
CatalogueDriveState.cpp
......@@ -70,6 +70,30 @@ add_library(ctaTapeServerDaemon
TpconfigLine.cpp
TpconfigLines.cpp)
if(CMAKE_COMPILER_IS_GNUCC)
if(GCC_VERSION_GE_4_8_0)
foreach(CTATAPESERVERDAEMON_LIBRARY_SRC
${CTATAPESERVERDAEMON_LIBRARY_SRCS}
CatalogueTest.cpp
DiskReadTaskTest.cpp
DiskWriteTaskTest.cpp
DiskWriteTaskTest.cpp
DiskWriteThreadPoolTest.cpp
MigrationReportPackerTest.cpp
ProcessForkerProxyDummy.cpp
ProcessForkerTest.cpp
RecallTaskInjectorTest.cpp
TapeDaemon.cpp
TapeDaemonTest.cpp)
set_property(SOURCE ${CTATAPESERVERDAEMON_LIBRARY_SRC}
PROPERTY COMPILE_FLAGS " -Wno-unused-local-typedefs")
endforeach(CTATAPESERVERDAEMON_LIBRARY_SRC)
endif(GCC_VERSION_GE_4_8_0)
endif(CMAKE_COMPILER_IS_GNUCC)
add_library(ctaTapeServerDaemon
${CTATAPESERVERDAEMON_LIBRARY_SRCS})
target_link_libraries(ctaTapeServerDaemon ctamessages ctatapereactor ctacommon ctanameserver ctaremotens protobuf ctascheduler ctalegacymsg ctaserverutils ctacatalogue)
add_dependencies(ctaTapeServerDaemon ctamessagesprotobuf)
......
......@@ -211,7 +211,7 @@ void DiskWriteTask::releaseAllBlock(){
};
tape::utils::suppresUnusedVariable(sp);
std::string errorMsg;
int errCode;
//int errCode;
if(mb->isFailed()){
errorMsg=mb->errorMsg();
......@@ -220,7 +220,7 @@ void DiskWriteTask::releaseAllBlock(){
}
else{
errorMsg="Mismatch between expected and received filed or blockid";
errCode=666;
//errCode=666;
}
lc.log(LOG_ERR,errorMsg);
throw castor::exception::Exception(errorMsg);
......
......@@ -28,6 +28,7 @@
#include "castor/utils/utils.hpp"
#include <errno.h>
#include <unistd.h>
//------------------------------------------------------------------------------
// serializePayload
......
......@@ -27,6 +27,9 @@
#include "castor/tape/tapeserver/daemon/TapeServerReporter.hpp"
#include "castor/tape/tapeserver/daemon/TpconfigLine.hpp"
#include <sys/types.h>
#include <unistd.h>
namespace castor {
namespace tape {
namespace tapeserver {
......
......@@ -33,6 +33,8 @@
#include "castor/utils/utils.hpp"
#include "castor/tape/tapeserver/daemon/TapeSessionStats.hpp"
#include <unistd.h>
namespace castor {
namespace tape {
......@@ -143,7 +145,6 @@ protected:
*/
void reportStats() {
// Shortcut definitions
typedef castor::log::ParamDoubleSnprintf ParamDoubleSnprintf;
typedef castor::log::Param Param;
if (m_statsSet) {
// Build the statistics to be logged
......@@ -184,7 +185,6 @@ protected:
*/
void run(){
// Shortcut definitions
typedef castor::log::ParamDoubleSnprintf ParamDoubleSnprintf;
typedef castor::log::Param Param;
// reset timers as we don't know how long it took before the thread started
m_reportTimer.reset();
......
......@@ -21,10 +21,29 @@ cmake_minimum_required (VERSION 2.6)
include_directories(${CMAKE_SOURCE_DIR}/tapeserver)
add_library(TapeDrive DriveGeneric.cpp FakeDrive.cpp)
set_property(SOURCE DriveGeneric.cpp PROPERTY COMPILE_FLAGS -fno-strict-aliasing)
set(TAPEDRIVE_LIBRARY_SRCS
DriveGeneric.cpp
FakeDrive.cpp)
if(CMAKE_COMPILER_IS_GNUCC)
if(GCC_VERSION_GE_4_8_0)
foreach(TAPEDRIVE_LIBRARY_SRC ${TAPEDRIVE_LIBRARY_SRCS})
set_property(SOURCE ${TAPEDRIVE_LIBRARY_SRC}
PROPERTY COMPILE_FLAGS " -Wno-unused-local-typedefs")
endforeach(TAPEDRIVE_LIBRARY_SRC)
endif(GCC_VERSION_GE_4_8_0)
endif(CMAKE_COMPILER_IS_GNUCC)
add_library(TapeDrive ${TAPEDRIVE_LIBRARY_SRCS})
target_link_libraries(TapeDrive SCSI)
if(CMAKE_COMPILER_IS_GNUCC)
if(GCC_VERSION_GE_4_8_0)
set_property(SOURCE TapeDriveReadWriteTest.cpp
PROPERTY COMPILE_FLAGS " -Wno-unused-local-typedefs")
endif(GCC_VERSION_GE_4_8_0)
endif(CMAKE_COMPILER_IS_GNUCC)
add_executable(TapeDriveReadWriteTest
TapeDriveReadWriteTest.cpp)
target_link_libraries(TapeDriveReadWriteTest
......@@ -37,9 +56,15 @@ target_link_libraries(TapeDriveReadWriteTest
#ctaclient
ctaTapeServerDaemon
gtest
gmock
pthread)
if(CMAKE_COMPILER_IS_GNUCC)
if(GCC_VERSION_GE_4_8_0)
set_property(SOURCE DriveTest.cpp
PROPERTY COMPILE_FLAGS " -Wno-unused-local-typedefs")
endif(GCC_VERSION_GE_4_8_0)
endif(CMAKE_COMPILER_IS_GNUCC)
add_library(ctatapeserverdriveunittests SHARED
DriveTest.cpp)
......
......@@ -25,13 +25,34 @@ include_directories(/usr/include/shift)
include_directories(${CMAKE_SOURCE_DIR}/tapeserver)
include_directories (${XROOTD_INCLUDE_DIR})
add_library(File
set(TAPESERVER_FILE_LIBRARY_SRCS
File.cpp
DiskFile.cpp
Structures.cpp
../exception/XrootCl.cpp)
if(CMAKE_COMPILER_IS_GNUCC)
if(GCC_VERSION_GE_4_8_0)
foreach(TAPESERVER_FILE_LIBRARY_SRC ${TAPESERVER_FILE_LIBRARY_SRCS})
set_property(SOURCE ${TAPESERVER_FILE_LIBRARY_SRC}
PROPERTY COMPILE_FLAGS " -Wno-unused-local-typedefs")
endforeach(TAPESERVER_FILE_LIBRARY_SRC)
endif(GCC_VERSION_GE_4_8_0)
endif(CMAKE_COMPILER_IS_GNUCC)
add_library(File
${TAPESERVER_FILE_LIBRARY_SRCS})
target_link_libraries (File XrdCl cryptopp ctaserverutils)
if(CMAKE_COMPILER_IS_GNUCC)
if(GCC_VERSION_GE_4_8_0)
set_property(SOURCE StructuresTest.cpp
PROPERTY COMPILE_FLAGS " -Wno-unused-local-typedefs")
set_property(SOURCE FileTest.cpp
PROPERTY COMPILE_FLAGS " -Wno-unused-local-typedefs")
endif(GCC_VERSION_GE_4_8_0)
endif(CMAKE_COMPILER_IS_GNUCC)
add_library(ctatapeserverfileunittests SHARED
StructuresTest.cpp
FileTest.cpp)
......
......@@ -24,3 +24,11 @@ add_library(System Wrapper.cpp FileWrappers.cpp)
set_property(SOURCE Wrapper.cpp
APPEND PROPERTY COMPILE_FLAGS -fno-strict-aliasing
)
if(CMAKE_COMPILER_IS_GNUCC)
if(GCC_VERSION_GE_4_8_0)
set_property(SOURCE Wrapper.cpp
PROPERTY COMPILE_FLAGS " -Wno-unused-local-typedefs")
endif(GCC_VERSION_GE_4_8_0)
endif(CMAKE_COMPILER_IS_GNUCC)
# 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/>.
cmake_minimum_required (VERSION 2.6)
find_package(gmock REQUIRED)
add_executable(unitTests
unit_tests.cpp)
unit_tests.cpp
${GMOCK_SRC})
target_link_libraries(unitTests
ctacatalogueunittests
......@@ -26,6 +44,5 @@ target_link_libraries(unitTests
ctaremotensunittests
ctaschedulerunittests
ctaio
gmock
gtest
pthread)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment