From cdf43796a86c475a9197837d3caaca70e12fd682 Mon Sep 17 00:00:00 2001 From: Oksana Salyk Date: Fri, 12 Jul 2024 14:44:03 +0200 Subject: [PATCH] improve the tests --- CMakeLists.txt | 5 ++++- .../ras/unsafe_shutdown/local_move_tests.cc | 18 +++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 42d1b0b..8dc62d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 @@ -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----") diff --git a/src/tests/ras/unsafe_shutdown/local_move_tests.cc b/src/tests/ras/unsafe_shutdown/local_move_tests.cc index 2fbd12d..6be746f 100644 --- a/src/tests/ras/unsafe_shutdown/local_move_tests.cc +++ b/src/tests/ras/unsafe_shutdown/local_move_tests.cc @@ -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 @@ -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 GetMoveParams() { std::vector ret_vec; LocalTestPhase& test_phase = LocalTestPhase::GetInstance(); @@ -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 pd{pop_}; ASSERT_EQ(0, pd.Write(obj_data_)) << "Writing to pool failed";