Skip to content

Commit

Permalink
test: replace deprecated libpmempool_api tests
Browse files Browse the repository at this point in the history
- drop tests if log, blk and btt specific
- replace log, blk and btt using tests with obj tests
- pmemwrite has been extended to support PMEMOBJ pools as well

Signed-off-by: Jan Michalski <jan.michalski@intel.com>
  • Loading branch information
janekmi committed Jun 27, 2023
1 parent 0ca6593 commit 627e970
Show file tree
Hide file tree
Showing 26 changed files with 81 additions and 259 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
* Unreleased *

This release:
- removes libpmempool API tests that use log/blk/btt pool types (partially)
- ...

Wed May 31 2023 Oksana Sałyk <oksana.salyk@intel.com>
Expand Down
4 changes: 2 additions & 2 deletions src/test/libpmempool_api/TEST0
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2016-2018, Intel Corporation
# Copyright 2016-2023, Intel Corporation
#
#
# libpmempool_api/TEST0 -- test for checking API
Expand All @@ -18,7 +18,7 @@ POOL=$DIR/file.pool
LOG=out${UNITTEST_NUM}.log
rm -f $LOG && touch $LOG

expect_normal_exit $PMEMPOOL$EXESUFFIX create log $POOL
expect_normal_exit $PMEMPOOL$EXESUFFIX create obj $POOL
check_file $POOL
expect_normal_exit $PMEMWRITE$EXESUFFIX $POOL TEST

Expand Down
4 changes: 2 additions & 2 deletions src/test/libpmempool_api/TEST1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2016-2018, Intel Corporation
# Copyright 2016-2023, Intel Corporation
#
#
# libpmempool_api/TEST1 -- test for checking API
Expand All @@ -18,7 +18,7 @@ POOL=$DIR/file.pool
LOG=out${UNITTEST_NUM}.log
rm -f $LOG && touch $LOG

expect_normal_exit $PMEMPOOL$EXESUFFIX create log $POOL
expect_normal_exit $PMEMPOOL$EXESUFFIX create obj $POOL
check_file $POOL
expect_normal_exit $PMEMWRITE$EXESUFFIX $POOL TEST

Expand Down
6 changes: 3 additions & 3 deletions src/test/libpmempool_api/TEST10
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2016-2018, Intel Corporation
# Copyright 2016-2023, Intel Corporation
#
#
# libpmempool_api/TEST10 -- test for checking API
Expand All @@ -20,7 +20,7 @@ LOG_TEMP=out${UNITTEST_NUM}_part.log
rm -f $LOG && touch $LOG
rm -f $LOG_TEMP && touch $LOG_TEMP

expect_normal_exit $PMEMPOOL$EXESUFFIX create log $POOL >> $LOG_TEMP
expect_normal_exit $PMEMPOOL$EXESUFFIX create obj $POOL >> $LOG_TEMP
$PMEMSPOIL $POOL "pool_hdr.major=7" >> $LOG_TEMP
check_file $POOL

Expand All @@ -29,7 +29,7 @@ expect_normal_exit ./libpmempool_test$EXESUFFIX \
cat $LOG >> $LOG_TEMP
rm -f $POOL

expect_normal_exit $PMEMPOOL$EXESUFFIX create log $POOL >> $LOG_TEMP
expect_normal_exit $PMEMPOOL$EXESUFFIX create obj $POOL >> $LOG_TEMP
$PMEMSPOIL $POOL "pool_hdr.major=7" >> $LOG_TEMP
check_file $POOL

Expand Down
44 changes: 0 additions & 44 deletions src/test/libpmempool_api/TEST11

This file was deleted.

46 changes: 0 additions & 46 deletions src/test/libpmempool_api/TEST12

This file was deleted.

4 changes: 2 additions & 2 deletions src/test/libpmempool_api/TEST13
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2016-2018, Intel Corporation
# Copyright 2016-2023, Intel Corporation
#
#
# libpmempool_api/TEST13 -- test for checking API
Expand All @@ -20,7 +20,7 @@ LOG_TEMP=out${UNITTEST_NUM}_part.log
rm -f $LOG && touch $LOG
rm -f $LOG_TEMP && touch $LOG_TEMP

expect_normal_exit $PMEMPOOL$EXESUFFIX create log $POOL
expect_normal_exit $PMEMPOOL$EXESUFFIX create obj $POOL

expect_normal_exit ./libpmempool_test$EXESUFFIX -s 0 $POOL >> $LOG
cat $LOG >> $LOG_TEMP
Expand Down
6 changes: 3 additions & 3 deletions src/test/libpmempool_api/TEST2
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2016-2018, Intel Corporation
# Copyright 2016-2023, Intel Corporation
#
#
# libpmempool_api/TEST2 -- test for checking API
Expand All @@ -18,12 +18,12 @@ POOL=$DIR/file.pool
LOG=out${UNITTEST_NUM}.log
rm -f $LOG && touch $LOG

expect_normal_exit $PMEMPOOL$EXESUFFIX create log $POOL
expect_normal_exit $PMEMPOOL$EXESUFFIX create obj $POOL
check_file $POOL
expect_normal_exit $PMEMWRITE$EXESUFFIX $POOL TEST

expect_normal_exit ./libpmempool_test$EXESUFFIX\
-d 0 -a 1 -r 0 $POOL>> $LOG
-d 0 -a 1 -r 0 $POOL>> $LOG
check

pass
4 changes: 2 additions & 2 deletions src/test/libpmempool_api/TEST3
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2016-2018, Intel Corporation
# Copyright 2016-2023, Intel Corporation
#
#
# libpmempool_api/TEST3 -- test for checking API
Expand All @@ -18,7 +18,7 @@ POOL=$DIR/file.pool
LOG=out${UNITTEST_NUM}.log
rm -f $LOG && touch $LOG

expect_normal_exit $PMEMPOOL$EXESUFFIX create log $POOL
expect_normal_exit $PMEMPOOL$EXESUFFIX create obj $POOL
check_file $POOL
expect_normal_exit $PMEMWRITE$EXESUFFIX $POOL TEST

Expand Down
4 changes: 2 additions & 2 deletions src/test/libpmempool_api/TEST4
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2016-2018, Intel Corporation
# Copyright 2016-2023, Intel Corporation
#
#
# libpmempool_api/TEST4 -- test for checking API
Expand All @@ -18,7 +18,7 @@ POOL=$DIR/file.pool
LOG=out${UNITTEST_NUM}.log
rm -f $LOG && touch $LOG

expect_normal_exit $PMEMPOOL$EXESUFFIX create log $POOL
expect_normal_exit $PMEMPOOL$EXESUFFIX create obj $POOL
check_file $POOL
expect_normal_exit $PMEMWRITE$EXESUFFIX $POOL TEST

Expand Down
4 changes: 2 additions & 2 deletions src/test/libpmempool_api/TEST5
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2016-2018, Intel Corporation
# Copyright 2016-2023, Intel Corporation
#
#
# libpmempool_api/TEST5 -- test for checking API
Expand All @@ -18,7 +18,7 @@ POOL=$DIR/file.pool
LOG=out${UNITTEST_NUM}.log
rm -f $LOG && touch $LOG

expect_normal_exit $PMEMPOOL$EXESUFFIX create log $POOL
expect_normal_exit $PMEMPOOL$EXESUFFIX create obj $POOL
check_file $POOL
expect_normal_exit $PMEMWRITE$EXESUFFIX $POOL TEST

Expand Down
4 changes: 2 additions & 2 deletions src/test/libpmempool_api/TEST6
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2016-2018, Intel Corporation
# Copyright 2016-2023, Intel Corporation
#
#
# libpmempool_api/TEST6 -- test for checking API
Expand All @@ -18,7 +18,7 @@ POOL=$DIR/file.pool
LOG=out${UNITTEST_NUM}.log
rm -f $LOG && touch $LOG

expect_normal_exit $PMEMPOOL$EXESUFFIX create log $POOL
expect_normal_exit $PMEMPOOL$EXESUFFIX create obj $POOL
check_file $POOL
expect_normal_exit $PMEMWRITE$EXESUFFIX $POOL TEST

Expand Down
4 changes: 2 additions & 2 deletions src/test/libpmempool_api/TEST7
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2016-2018, Intel Corporation
# Copyright 2016-2023, Intel Corporation
#
#
# libpmempool_api/TEST7 -- test for checking API
Expand All @@ -18,7 +18,7 @@ POOL=$DIR/file.pool
LOG=out${UNITTEST_NUM}.log
rm -f $LOG && touch $LOG

expect_normal_exit $PMEMPOOL$EXESUFFIX create log $POOL
expect_normal_exit $PMEMPOOL$EXESUFFIX create obj $POOL
check_file $POOL
expect_normal_exit $PMEMWRITE$EXESUFFIX $POOL TEST

Expand Down
28 changes: 0 additions & 28 deletions src/test/libpmempool_api/TEST8

This file was deleted.

35 changes: 14 additions & 21 deletions src/test/libpmempool_api/TEST9
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2016-2019, Intel Corporation
# Copyright 2016-2023, Intel Corporation
#
#
# libpmempool_api/TEST9 -- test for checking API
Expand All @@ -20,26 +20,19 @@ LOG_TEMP=out${UNITTEST_NUM}_part.log
rm -f $LOG && touch $LOG
rm -f $LOG_TEMP && touch $LOG_TEMP

declare -A pool_args=(["log"]="log"
["blk"]="blk 512")

for field in log blk;
do
echo "Pool type: ${field} Params: ${pool_args["$field"]}" >> $LOG_TEMP
expect_normal_exit $PMEMPOOL$EXESUFFIX create\
${pool_args["$field"]} $POOL >> $LOG_TEMP
$PMEMSPOIL $POOL "pool_hdr.major=7" >> $LOG_TEMP
check_file $POOL

cp $POOL ${POOL}_copy >> $LOG_TEMP
expect_normal_exit ./libpmempool_test$EXESUFFIX\
-d 1 -r 1 -y 1 -t ${field} $POOL >> $LOG
cat $LOG >> $LOG_TEMP
cmp $POOL ${POOL}_copy >> $LOG_TEMP || true

rm -f $POOL
rm -f ${POOL}_copy
done
expect_normal_exit $PMEMPOOL$EXESUFFIX create obj $POOL >> $LOG_TEMP
$PMEMSPOIL $POOL "pool_hdr.major=7" >> $LOG_TEMP
check_file $POOL

cp $POOL ${POOL}_copy >> $LOG_TEMP
expect_normal_exit ./libpmempool_test$EXESUFFIX\
-d 1 -r 1 -y 1 $POOL >> $LOG
cat $LOG >> $LOG_TEMP
cmp $POOL ${POOL}_copy >> $LOG_TEMP || true

rm -f $POOL
rm -f ${POOL}_copy

mv $LOG_TEMP $LOG

check
Expand Down
2 changes: 1 addition & 1 deletion src/test/libpmempool_api/libpmempool_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ main(int argc, char *argv[])
struct pmempool_check_args_1_0 args = {
.path = NULL,
.backup_path = NULL,
.pool_type = PMEMPOOL_POOL_TYPE_LOG,
.pool_type = PMEMPOOL_POOL_TYPE_OBJ,
.flags = PMEMPOOL_CHECK_FORMAT_STR |
PMEMPOOL_CHECK_REPAIR | PMEMPOOL_CHECK_VERBOSE
};
Expand Down
2 changes: 0 additions & 2 deletions src/test/libpmempool_api/out0.log.match
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@ checking shutdown state
shutdown state correct
checking pool header
pool header correct
checking pmemlog header
pmemlog header correct
status = consistent
libpmempool_api$(nW)TEST0: DONE
2 changes: 0 additions & 2 deletions src/test/libpmempool_api/out1.log.match
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@ checking shutdown state
shutdown state correct
checking pool header
pool header correct
checking pmemlog header
pmemlog header correct
status = consistent
libpmempool_api$(nW)TEST1: DONE
7 changes: 2 additions & 5 deletions src/test/libpmempool_api/out10.log.match
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ checking shutdown state
shutdown state correct
checking pool header
incorrect pool header
pool_hdr.major is not valid
setting pool_hdr.major to 0x1
checking pmemlog header
pmemlog header correct
status = repaired
the repair of pmemobj pools is not supported
status = cannot repair
libpmempool_api$(nW)TEST10: DONE
Loading

0 comments on commit 627e970

Please sign in to comment.