Skip to content

Commit

Permalink
improve the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
osalyk committed Jul 15, 2024
1 parent 5f9fac9 commit cdf4379
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2017-2023, Intel Corporation
# Copyright 2017-2024, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -35,6 +35,9 @@ cmake_minimum_required(VERSION 2.8.12)

project(pmdk_tests)

# ignore all the warnings
add_definitions(-w)

# check if 32-bit architecture
if (NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
message(FATAL_ERROR "----Building as 64-bit is required. Please set build to 64-bit----")
Expand Down
18 changes: 15 additions & 3 deletions src/tests/ras/unsafe_shutdown/local_move_tests.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018-2023, Intel Corporation
* Copyright 2018-2024, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -37,6 +37,15 @@ std::ostream& operator<<(std::ostream& stream, move_param const& m) {
return stream;
}

/* Change the status of the shutdown state */
void set_sds_at_create_func(bool state) {
int ret = pmemobj_ctl_set(NULL, "sds.at_create", &state);
if (ret) {
std::cerr << "Failed to set sds.at_create: " << pmemobj_errormsg() << std::endl;
exit(1);
}
}

std::vector<move_param> GetMoveParams() {
std::vector<move_param> ret_vec;
LocalTestPhase& test_phase = LocalTestPhase::GetInstance();
Expand Down Expand Up @@ -144,22 +153,25 @@ void MovePoolClean::SetUp() {
* and closed properly can be reopened.
* Trigger unsafe shutdown after closing the pool.
* \test
* \li \c Step1. Create pool on device. / SUCCESS
* \li \c Step1. Disable SDS. Create pool on device. / SUCCESS
* \li \c Step2. Write pattern persistently to pool, close the pool
* / SUCCESS
* \li \c Step3. Increment USC on DIMM specified by parameter, power cycle
* \li \c Step4. Confirm USC incremented / SUCCESS
* \li \c Step4. Move the pool to different device. / SUCCESS
* \li \c Step5. Open the pool. / SUCCESS
* \li \c Step5. Enable SDS. Open the pool. / SUCCESS
* \li \c Step6. Verify written pattern. / SUCCESS
* \li \c Step7. Close the pool / SUCCESS
*/
TEST_P(MovePoolClean, TC_MOVE_POOL_CLEAN_phase_1) {
/* Step1 */
set_sds_at_create_func(false);
pop_ = pmemobj_create(src_pool_path_.c_str(), nullptr, PMEMOBJ_MIN_POOL, 0644);
ASSERT_TRUE(pop_ != nullptr) << "Pool creating failed. Errno: " << errno
<< std::endl
<< pmemobj_errormsg();
set_sds_at_create_func(true);

/* Step2 */
ObjData<int> pd{pop_};
ASSERT_EQ(0, pd.Write(obj_data_)) << "Writing to pool failed";
Expand Down

0 comments on commit cdf4379

Please sign in to comment.