Skip to content

Commit

Permalink
tests: enabled multiplied-device-test
Browse files Browse the repository at this point in the history
  • Loading branch information
franku committed Apr 5, 2019
1 parent 7df5433 commit c802aba
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
39 changes: 39 additions & 0 deletions core/src/tests/multiplied_device_test.cc
Expand Up @@ -299,3 +299,42 @@ TEST(sd,

EXPECT_EQ(count, 3);
}

TEST(sd, MultipliedDeviceTest_CheckPointerReferenceOfOriginalDevice)
{
InitGlobals();
std::string path_to_config =
PROJECT_SOURCE_DIR "/src/tests/configs/stored_multiplied_device/";

PConfigParser my_config(InitSdConfig(path_to_config.c_str(), M_INFO));
storagedaemon::my_config = my_config.get();

ASSERT_TRUE(my_config->ParseConfig());

CommonResourceHeader* p;
p = my_config->GetResWithName(R_DEVICE, "MultipliedDeviceResource0001");
ASSERT_TRUE(p);
DeviceResource* original_device = reinterpret_cast<DeviceResource*>(p);
EXPECT_EQ(original_device, original_device->multiplied_device_resource);
}

TEST(sd, MultipliedDeviceTest_CheckPointerReferenceOfCopiedDevice)
{
InitGlobals();
std::string path_to_config =
PROJECT_SOURCE_DIR "/src/tests/configs/stored_multiplied_device/";

PConfigParser my_config(InitSdConfig(path_to_config.c_str(), M_INFO));
storagedaemon::my_config = my_config.get();

ASSERT_TRUE(my_config->ParseConfig());

CommonResourceHeader* p;
p = my_config->GetResWithName(R_DEVICE, "MultipliedDeviceResource0001");
ASSERT_TRUE(p);
DeviceResource* original_device = reinterpret_cast<DeviceResource*>(p);
p = my_config->GetResWithName(R_DEVICE, "MultipliedDeviceResource0002");
ASSERT_TRUE(p);
DeviceResource* multiplied_device = reinterpret_cast<DeviceResource*>(p);
EXPECT_EQ(original_device, multiplied_device->multiplied_device_resource);
}
1 change: 1 addition & 0 deletions systemtests/CMakeLists.txt
Expand Up @@ -162,6 +162,7 @@ set(tests_dir ${PROJECT_BINARY_DIR}/tests)
set(SYSTEM_TESTS
backup-bareos-test
backup-bareos-passive-test
multiplied-device-test
)

set(BASEPORT 42001)
Expand Down

0 comments on commit c802aba

Please sign in to comment.