Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/pip/src/tests/ras/utils/reboote…
Browse files Browse the repository at this point in the history
…rs/powerswitch/urllib3-1.26.19
  • Loading branch information
osalyk authored Aug 21, 2024
2 parents af59cfb + 0dc3c0e commit f719739
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 55 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build

on:
pull_request:
workflow_dispatch:

jobs:
Build:
runs-on: ubuntu-latest
container:
# The pmdk-tests repository struggles to build on any modern distro.
# Rocky 8 was hand-picked to meet the repository requirements.
# On Rocky 9 the libdaxctl.h header is placed in daxctl/ instead of ndctl/.
image: ghcr.io/pmem/pmdk:2.1-rockylinux-8-x86_64
options: --user root # WA the messed-up access rights inside the container
steps:
- name: Clone the pmdk-test repo
uses: actions/checkout@v4
with:
fetch-depth: 1 # WA actions/checkout#664

- name: Install dependencies
run: >
sudo dnf install --assumeyes
cmake libpmem-devel libpmemobj-devel libpmempool-devel ndctl-devel
- name: Create the build directory
run: mkdir build

- name: Build sources
working-directory: build
run: cmake .. && make -j
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.*
!.github
!.gitignore
!.gitattributes
!.clang-format
Expand Down
17 changes: 14 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 @@ -51,6 +51,7 @@ std::vector<move_param> GetMoveParams() {
tc.enough_dimms = true;
tc.src_pool_dir = unsafe_dn[0].GetTestDir();
tc.dest_pool_dir = test_phase.GetTestDir();
tc.src_pool_dir_is_pmem = true;
} else {
tc.enough_dimms = false;
}
Expand All @@ -65,6 +66,7 @@ std::vector<move_param> GetMoveParams() {
tc.enough_dimms = true;
tc.src_pool_dir = test_phase.GetTestDir();
tc.dest_pool_dir = unsafe_dn[0].GetTestDir();
tc.src_pool_dir_is_pmem = false;
} else {
tc.enough_dimms = false;
}
Expand All @@ -79,6 +81,7 @@ std::vector<move_param> GetMoveParams() {
tc.enough_dimms = true;
tc.src_pool_dir = unsafe_dn[0].GetTestDir();
tc.dest_pool_dir = safe_dn[0].GetTestDir();
tc.src_pool_dir_is_pmem = true;
} else {
tc.enough_dimms = false;
}
Expand All @@ -93,6 +96,7 @@ std::vector<move_param> GetMoveParams() {
tc.enough_dimms = true;
tc.src_pool_dir = unsafe_dn[1].GetTestDir();
tc.dest_pool_dir = unsafe_dn[0].GetTestDir();
tc.src_pool_dir_is_pmem = true;
} else {
tc.enough_dimms = false;
}
Expand All @@ -107,6 +111,7 @@ std::vector<move_param> GetMoveParams() {
tc.enough_dimms = true;
tc.src_pool_dir = safe_dn[0].GetTestDir();
tc.dest_pool_dir = test_phase.GetTestDir();
tc.src_pool_dir_is_pmem = true;
} else {
tc.enough_dimms = false;
}
Expand All @@ -121,6 +126,7 @@ std::vector<move_param> GetMoveParams() {
tc.enough_dimms = true;
tc.src_pool_dir = test_phase.GetTestDir();
tc.dest_pool_dir = safe_dn[0].GetTestDir();
tc.src_pool_dir_is_pmem = false;
} else {
tc.enough_dimms = false;
}
Expand All @@ -136,6 +142,8 @@ void MovePoolClean::SetUp() {
<< "Insufficient number of DIMMs to run this test";
src_pool_path_ = param.src_pool_dir + GetNormalizedTestName() + "_pool";
dest_pool_path_ = param.dest_pool_dir + GetNormalizedTestName() + "_pool";
create_on_pmem = param.src_pool_dir_is_pmem;
UnsafeShutdown::SetUp();
}

/**
Expand All @@ -144,7 +152,7 @@ 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. Create a pool on the 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
Expand All @@ -160,6 +168,7 @@ TEST_P(MovePoolClean, TC_MOVE_POOL_CLEAN_phase_1) {
ASSERT_TRUE(pop_ != nullptr) << "Pool creating failed. Errno: " << errno
<< std::endl
<< pmemobj_errormsg();

/* Step2 */
ObjData<int> pd{pop_};
ASSERT_EQ(0, pd.Write(obj_data_)) << "Writing to pool failed";
Expand Down Expand Up @@ -195,14 +204,16 @@ void MovePoolDirty::SetUp() {
<< "Insufficient number of DIMMs to run this test";
src_pool_path_ = param.src_pool_dir + GetNormalizedTestName() + "_pool";
dest_pool_path_ = param.dest_pool_dir + GetNormalizedTestName() + "_pool";
create_on_pmem = param.src_pool_dir_is_pmem;
UnsafeShutdown::SetUp();
}

/**
* TC_MOVE_POOL_DIRTY
* Check if pool moved between devices in a manner specified by test parameters
* can be opened.
* \test
* \li \c Step1. Create pool on device. / SUCCESS
* \li \c Step1. Create a pool on the device. / SUCCESS
* \li \c Step2. Write pattern persistently to pool / SUCCESS
* \li \c Step3. Increment USC on DIMM specified by parameter, power cycle,
* confirm USC is incremented / SUCCESS
Expand Down
3 changes: 2 additions & 1 deletion src/tests/ras/unsafe_shutdown/local_move_tests.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018, 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 @@ -40,6 +40,7 @@ struct move_param {
std::string src_pool_dir;
std::string dest_pool_dir;
bool enough_dimms;
bool src_pool_dir_is_pmem;
};

std::ostream& operator<<(std::ostream& stream, move_param const& m);
Expand Down
52 changes: 7 additions & 45 deletions src/tests/ras/unsafe_shutdown/local_replicas_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 @@ -41,6 +41,8 @@ void SyncLocalReplica::SetUp() {
sync_local_replica_tc param = GetParam();
ASSERT_TRUE(param.enough_dimms)
<< "Insufficient number of DIMMs to run this test";
create_on_pmem = true;
UnsafeShutdown::SetUp();
}

/**
Expand Down Expand Up @@ -153,28 +155,8 @@ std::vector<sync_local_replica_tc> GetSyncLocalReplicaParams() {
}

/* Master replica on unsafely shutdown DIMM, healthy secondary replica on
* non-pmem device. */
{
sync_local_replica_tc tc;
tc.description =
"Master replica on unsafely shutdown DIMM, healthy secondary replica "
"on non-pmem device.";
if (unsafe_dn.size() > 0) {
tc.enough_dimms = true;
tc.poolset = Poolset{
unsafe_dn[0].GetTestDir(),
"pool_tc2.set",
{{"PMEMPOOLSET",
"9MB " + unsafe_dn[0].GetTestDir() + "tc2_master.part0",
"9MB " + unsafe_dn[0].GetTestDir() + "tc2_master.part1"},
{"REPLICA", "9MB " + test_phase.GetTestDir() + "tc2_replica.part0",
"9MB " + test_phase.GetTestDir() + "tc2_replica.part1"}}};
tc.is_syncable = true;
} else {
tc.enough_dimms = false;
}
ret_vec.emplace_back(tc);
}
* non-pmem device.
* Note: The use case was deemed irrelevant and deleted. */

/* Two local secodary replicas, one partially on unsafely shutdown DIMM, other
* on safely shutdown DIMM.
Expand Down Expand Up @@ -298,28 +280,8 @@ std::vector<sync_local_replica_tc> GetSyncLocalReplicaParams() {
}

/* Master replica and secondary replica partially on non-pmem,
* partially on two us-dimms. */
{
sync_local_replica_tc tc;
tc.description =
"Master and secondary replica partially on non-pmem, partially on two "
"unsafely shutdown dimms.";
if (unsafe_dn.size() >= 2) {
tc.enough_dimms = true;
tc.poolset = Poolset{
unsafe_dn[0].GetTestDir(),
"pool5.set",
{{"PMEMPOOLSET", "9MB " + unsafe_dn[0].GetTestDir() + "master5.part0",
"9MB " + test_phase.GetTestDir() + "master5.part1",
"9MB " + unsafe_dn[0].GetTestDir() + "master5.part2"},
{"REPLICA", "9MB " + unsafe_dn[1].GetTestDir() + "replica5.part0",
"18MB " + test_phase.GetTestDir() + "replica5.part1"}}};
tc.is_syncable = false;
} else {
tc.enough_dimms = false;
}
ret_vec.emplace_back(tc);
}
* partially on two us-dimms.
* Note: The use case was deemed irrelevant and deleted. */

/* Master and two secondary replicas on unsafely shutdown DIMMs */
{
Expand Down
2 changes: 1 addition & 1 deletion src/tests/ras/unsafe_shutdown/local_replicas_tests.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018, 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
20 changes: 18 additions & 2 deletions src/tests/ras/unsafe_shutdown/unsafe_shutdown.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018, 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 @@ -48,7 +48,7 @@ void UnsafeShutdown::StampPassedResult() const {
}
}

bool UnsafeShutdown::PassedOnPreviousPhase() const {
bool UnsafeShutdown:: PassedOnPreviousPhase() const {
bool ret = ApiC::RegularFileExists(GetPassedStamp());
if (ret) {
ApiC::RemoveFile(GetPassedStamp());
Expand Down Expand Up @@ -86,3 +86,19 @@ int UnsafeShutdown::PmempoolRepair(std::string pool_file_path) const {

return pmempool_check_end(ppc);
}

void UnsafeShutdown::SetSdsAtCreate(bool state) const {
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);
}
}

void UnsafeShutdown::SetUp() {
if (!create_on_pmem) {
SetSdsAtCreate(false);
} else {
SetSdsAtCreate(true);
}
}
7 changes: 6 additions & 1 deletion src/tests/ras/unsafe_shutdown/unsafe_shutdown.h
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 @@ -58,6 +58,9 @@ class UnsafeShutdown : public ::testing::Test {
std::string GetNormalizedTestName() const;
int PmempoolRepair(std::string pool_file_path) const;


void SetUp() override;

~UnsafeShutdown() {
StampPassedResult();
if (close_pools_at_end_) {
Expand All @@ -69,6 +72,7 @@ class UnsafeShutdown : public ::testing::Test {

protected:
bool close_pools_at_end_ = true;
bool create_on_pmem = true;

private:
const ::testing::TestInfo& GetTestInfo() const {
Expand All @@ -78,6 +82,7 @@ class UnsafeShutdown : public ::testing::Test {
return test_phase_.GetTestDir() + GetNormalizedTestName() + "_passed";
}
void StampPassedResult() const;
void SetSdsAtCreate(bool state) const;
};

#endif // UNSAFE_SHUTDOWN_H
4 changes: 2 additions & 2 deletions src/tests/ras/utils/rebooters/powerswitch/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
certifi==2022.12.7
certifi==2023.7.22
chardet==3.0.4
idna==2.6
idna==3.7
lxml==4.9.1
requests==2.31.0
urllib3==1.26.19

0 comments on commit f719739

Please sign in to comment.