diff --git a/ChangeLog b/ChangeLog index 0ebe933ccdb..16ce20dc93d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/src/test/libpmempool_api/TEST0 b/src/test/libpmempool_api/TEST0 index ee8b69f7283..d67b6cfd8a0 100755 --- a/src/test/libpmempool_api/TEST0 +++ b/src/test/libpmempool_api/TEST0 @@ -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 @@ -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 diff --git a/src/test/libpmempool_api/TEST1 b/src/test/libpmempool_api/TEST1 index b1c9e5969ff..d73d540938f 100755 --- a/src/test/libpmempool_api/TEST1 +++ b/src/test/libpmempool_api/TEST1 @@ -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 @@ -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 diff --git a/src/test/libpmempool_api/TEST10 b/src/test/libpmempool_api/TEST10 index a146de71c89..e7f77b51ae4 100755 --- a/src/test/libpmempool_api/TEST10 +++ b/src/test/libpmempool_api/TEST10 @@ -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 @@ -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 @@ -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 diff --git a/src/test/libpmempool_api/TEST11 b/src/test/libpmempool_api/TEST11 deleted file mode 100755 index 17dfd8182e7..00000000000 --- a/src/test/libpmempool_api/TEST11 +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env bash -# SPDX-License-Identifier: BSD-3-Clause -# Copyright 2016-2018, Intel Corporation -# -# -# libpmempool_api/TEST11 -- test for checking API -# - -. ../unittest/unittest.sh - -require_test_type medium - -require_fs_type any - -# this test creates huge file -configure_valgrind memcheck force-disable -configure_valgrind pmemcheck force-disable -configure_valgrind helgrind force-disable -configure_valgrind drd force-disable - -setup - -POOL=$DIR/file.pool -LOG=out${UNITTEST_NUM}.log -LOG_TEMP=out${UNITTEST_NUM}_part.log -rm -f $LOG && touch $LOG -rm -f $LOG_TEMP && touch $LOG_TEMP - -truncate -s1T $POOL -expect_normal_exit $BTTCREATE -s 1T -b 512M -t $POOL >> $LOG_TEMP - -$PMEMSPOIL $POOL "bttdevice.arena(0).btt_info.checksum=777"\ - "bttdevice.arena(0).btt_info_backup.checksum=777" >> $LOG_TEMP -check_file $POOL - -expect_normal_exit ./libpmempool_test$EXESUFFIX -r 1 -t btt $POOL >> $LOG -cat $LOG >> $LOG_TEMP -expect_normal_exit ./libpmempool_test$EXESUFFIX -r 1 -t btt -a 1 $POOL >> $LOG -cat $LOG >> $LOG_TEMP - -mv $LOG_TEMP $LOG - -check -pass diff --git a/src/test/libpmempool_api/TEST12 b/src/test/libpmempool_api/TEST12 deleted file mode 100755 index bc9ef0e2a50..00000000000 --- a/src/test/libpmempool_api/TEST12 +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env bash -# SPDX-License-Identifier: BSD-3-Clause -# Copyright 2016-2018, Intel Corporation -# -# -# libpmempool_api/TEST12 -- test for checking API -# - -. ../unittest/unittest.sh - -require_test_type medium - -require_fs_type any - -setup - -POOL=$DIR/file.pool -LOG=out${UNITTEST_NUM}.log -LOG_TEMP=out${UNITTEST_NUM}_part.log -rm -f $LOG && touch $LOG -rm -f $LOG_TEMP && touch $LOG_TEMP - -ent_val=5 - -expect_normal_exit $BTTCREATE $POOL - -for((i=0;i> $LOG_TEMP - $PMEMSPOIL $POOL $spcmd -done - -spcmd="bttdevice.arena.btt_flog(0).seq=4" -echo $spcmd >> $LOG_TEMP -$PMEMSPOIL $POOL $spcmd - -expect_normal_exit ./libpmempool_test$EXESUFFIX -r 1 -t btt $POOL >> $LOG -cat $LOG >> $LOG_TEMP -expect_normal_exit ./libpmempool_test$EXESUFFIX -r 1 -t btt -a 1 $POOL >> $LOG -cat $LOG >> $LOG_TEMP - -mv $LOG_TEMP $LOG - -check -pass diff --git a/src/test/libpmempool_api/TEST13 b/src/test/libpmempool_api/TEST13 index be3187a9cbe..dade2d8de65 100755 --- a/src/test/libpmempool_api/TEST13 +++ b/src/test/libpmempool_api/TEST13 @@ -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 @@ -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 diff --git a/src/test/libpmempool_api/TEST2 b/src/test/libpmempool_api/TEST2 index b16afeae33c..9ed3a01211e 100755 --- a/src/test/libpmempool_api/TEST2 +++ b/src/test/libpmempool_api/TEST2 @@ -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 @@ -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 diff --git a/src/test/libpmempool_api/TEST3 b/src/test/libpmempool_api/TEST3 index 5c3bfcf7486..8a0ab2abcfa 100755 --- a/src/test/libpmempool_api/TEST3 +++ b/src/test/libpmempool_api/TEST3 @@ -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 @@ -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 diff --git a/src/test/libpmempool_api/TEST4 b/src/test/libpmempool_api/TEST4 index 8242f732d6c..384c6c3d8d4 100755 --- a/src/test/libpmempool_api/TEST4 +++ b/src/test/libpmempool_api/TEST4 @@ -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 @@ -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 diff --git a/src/test/libpmempool_api/TEST5 b/src/test/libpmempool_api/TEST5 index 2a1798c0374..e7a492f605d 100755 --- a/src/test/libpmempool_api/TEST5 +++ b/src/test/libpmempool_api/TEST5 @@ -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 @@ -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 diff --git a/src/test/libpmempool_api/TEST6 b/src/test/libpmempool_api/TEST6 index a46a3d8cc4c..4c8c0379b20 100755 --- a/src/test/libpmempool_api/TEST6 +++ b/src/test/libpmempool_api/TEST6 @@ -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 @@ -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 diff --git a/src/test/libpmempool_api/TEST7 b/src/test/libpmempool_api/TEST7 index 3a2ae00245d..d637eaa1c98 100755 --- a/src/test/libpmempool_api/TEST7 +++ b/src/test/libpmempool_api/TEST7 @@ -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 @@ -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 diff --git a/src/test/libpmempool_api/TEST8 b/src/test/libpmempool_api/TEST8 deleted file mode 100755 index 68bd3518c68..00000000000 --- a/src/test/libpmempool_api/TEST8 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash -# SPDX-License-Identifier: BSD-3-Clause -# Copyright 2016-2018, Intel Corporation -# -# -# libpmempool_api/TEST8 -- test for checking API -# - -. ../unittest/unittest.sh - -require_test_type medium - -require_fs_type any - -setup - -POOL=$DIR/file.pool -LOG=out${UNITTEST_NUM}.log -rm -f $LOG && touch $LOG - -expect_normal_exit $PMEMPOOL$EXESUFFIX create log $POOL -check_file $POOL -expect_normal_exit $PMEMWRITE$EXESUFFIX $POOL TEST - -expect_normal_exit ./libpmempool_test$EXESUFFIX -t blk $POOL >> $LOG -check - -pass diff --git a/src/test/libpmempool_api/TEST9 b/src/test/libpmempool_api/TEST9 index 63cca6e22f0..ca28f705e0d 100755 --- a/src/test/libpmempool_api/TEST9 +++ b/src/test/libpmempool_api/TEST9 @@ -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 @@ -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 diff --git a/src/test/libpmempool_api/libpmempool_test.c b/src/test/libpmempool_api/libpmempool_test.c index 73570886c88..59d49694710 100644 --- a/src/test/libpmempool_api/libpmempool_test.c +++ b/src/test/libpmempool_api/libpmempool_test.c @@ -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 }; diff --git a/src/test/libpmempool_api/out0.log.match b/src/test/libpmempool_api/out0.log.match index d2561a339ab..039f6ab9d11 100644 --- a/src/test/libpmempool_api/out0.log.match +++ b/src/test/libpmempool_api/out0.log.match @@ -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 diff --git a/src/test/libpmempool_api/out1.log.match b/src/test/libpmempool_api/out1.log.match index 100b0c9d8f9..6a11cb2acc3 100644 --- a/src/test/libpmempool_api/out1.log.match +++ b/src/test/libpmempool_api/out1.log.match @@ -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 diff --git a/src/test/libpmempool_api/out10.log.match b/src/test/libpmempool_api/out10.log.match index 7fdeff216de..cdd867dbe67 100644 --- a/src/test/libpmempool_api/out10.log.match +++ b/src/test/libpmempool_api/out10.log.match @@ -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 diff --git a/src/test/libpmempool_api/out11.log.match b/src/test/libpmempool_api/out11.log.match deleted file mode 100644 index f88ec38a9f5..00000000000 --- a/src/test/libpmempool_api/out11.log.match +++ /dev/null @@ -1,23 +0,0 @@ -libpmempool_api/TEST11: START: libpmempool_test$(nW) - ./libpmempool_test$(nW) -r 1 -t btt $(nW) -checking BTT Info headers -arena 0: BTT Info header checksum incorrect. Do you want to regenerate BTT Info? -arena 0: regenerating BTT Info header -the following error can be fixed using PMEMPOOL_CHECK_ADVANCED flag -arena 0: BTT Info header checksum incorrect -status = cannot repair -libpmempool_api/TEST11: DONE -libpmempool_api/TEST11: START: libpmempool_test$(nW) - ./libpmempool_test$(nW) -r 1 -t btt -a 1 $(nW) -checking BTT Info headers -arena 0: BTT Info header checksum incorrect. Do you want to regenerate BTT Info? -arena 0: regenerating BTT Info header -arena 0: BTT Info header checksum incorrect. Do you want to regenerate BTT Info checksum? -arena 0: BTT Info backup checksum incorrect. Do you want to restore it from BTT Info header? -arena 0: restoring BTT Info backup from header -arena 1: BTT Info header checksum correct -checking BTT Map and Flog -arena 0: checking BTT Map and Flog -arena 1: checking BTT Map and Flog -status = repaired -libpmempool_api/TEST11: DONE diff --git a/src/test/libpmempool_api/out12.log.match b/src/test/libpmempool_api/out12.log.match deleted file mode 100644 index 0f1adc56fd6..00000000000 --- a/src/test/libpmempool_api/out12.log.match +++ /dev/null @@ -1,37 +0,0 @@ -bttdevice.arena.btt_map(0)=0x00000000 -bttdevice.arena.btt_map(1)=0x00000001 -bttdevice.arena.btt_map(2)=0x00000002 -bttdevice.arena.btt_map(3)=0x00000003 -bttdevice.arena.btt_map(4)=0x00000004 -bttdevice.arena.btt_flog(0).seq=4 -libpmempool_api/TEST12: START: libpmempool_test$(nW) - ./libpmempool_test$(nW) -r 1 -t btt $(nW) -checking BTT Info headers -arena 0: BTT Info header checksum correct -checking BTT Map and Flog -arena 0: checking BTT Map and Flog -arena 0: invalid BTT Flog entry at 0 -$(OPT)arena 0: unmapped block 40322 -$(OPX)arena 0: unmapped block 40203 -arena 0: number of unmapped blocks: 1 -arena 0: number of invalid BTT Flog entries: 1 -the following error can be fixed using PMEMPOOL_CHECK_ADVANCED flag -BTT Map and / or BTT Flog contain invalid entries -status = cannot repair -libpmempool_api/TEST12: DONE -libpmempool_api/TEST12: START: libpmempool_test$(nW) - ./libpmempool_test$(nW) -r 1 -t btt -a 1 $(nW) -checking BTT Info headers -arena 0: BTT Info header checksum correct -checking BTT Map and Flog -arena 0: checking BTT Map and Flog -arena 0: invalid BTT Flog entry at 0 -$(OPT)arena 0: unmapped block 40322 -$(OPX)arena 0: unmapped block 40203 -arena 0: number of unmapped blocks: 1 -arena 0: number of invalid BTT Flog entries: 1 -Do you want to repair invalid BTT Flog entries? -$(OPT)arena 0: repairing BTT Flog at 0 with free block entry 0x40009d82 -$(OPX)arena 0: repairing BTT Flog at 0 with free block entry 0x40009d0b -status = repaired -libpmempool_api/TEST12: DONE diff --git a/src/test/libpmempool_api/out13.log.match b/src/test/libpmempool_api/out13.log.match index cc449af264a..25c4fe240fe 100644 --- a/src/test/libpmempool_api/out13.log.match +++ b/src/test/libpmempool_api/out13.log.match @@ -8,7 +8,5 @@ checking shutdown state shutdown state correct checking pool header pool header correct -checking pmemlog header -pmemlog header correct status = consistent libpmempool_api$(nW)TEST13: DONE diff --git a/src/test/libpmempool_api/out8.log.match b/src/test/libpmempool_api/out8.log.match deleted file mode 100644 index 83bf26ee7eb..00000000000 --- a/src/test/libpmempool_api/out8.log.match +++ /dev/null @@ -1,4 +0,0 @@ -libpmempool_api$(nW)TEST8: START: libpmempool_test$(nW) - $(nW)libpmempool_test$(nW) -t blk $(nW) -Error: Invalid argument -libpmempool_api$(nW)TEST8: DONE diff --git a/src/test/libpmempool_api/out9.log.match b/src/test/libpmempool_api/out9.log.match index e5824c14705..6895744801c 100644 --- a/src/test/libpmempool_api/out9.log.match +++ b/src/test/libpmempool_api/out9.log.match @@ -1,28 +1,9 @@ -Pool type: log Params: log libpmempool_api$(nW)TEST9: START: libpmempool_test$(nW) - $(nW)libpmempool_test$(nW) -d 1 -r 1 -y 1 -t log $(nW) + $(nW)libpmempool_test$(nW) -d 1 -r 1 -y 1 $(nW) 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 -libpmempool_api$(nW)TEST9: DONE -Pool type: blk Params: blk 512 -libpmempool_api$(nW)TEST9: START: libpmempool_test$(nW) - $(nW)libpmempool_test$(nW) -d 1 -r 1 -y 1 -t blk $(nW) -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 pmemblk header -pmemblk header correct -checking BTT Info headers -BTT Layout not written -status = repaired +the repair of pmemobj pools is not supported +status = cannot repair libpmempool_api$(nW)TEST9: DONE diff --git a/src/test/tools/pmemwrite/Makefile b/src/test/tools/pmemwrite/Makefile index 3fd1ff05507..f9e6f1bd91c 100644 --- a/src/test/tools/pmemwrite/Makefile +++ b/src/test/tools/pmemwrite/Makefile @@ -13,6 +13,7 @@ OBJS = write.o LIBPMEM=y LIBPMEMBLK=y LIBPMEMLOG=y +LIBPMEMOBJ=y TOOLS_COMMON=y TOOLS_PMEMPOOL_COMMON=y LIBPMEMBLK_PRIV=btt_info_convert2h diff --git a/src/test/tools/pmemwrite/write.c b/src/test/tools/pmemwrite/write.c index ed7811ae279..edd0d3c136c 100644 --- a/src/test/tools/pmemwrite/write.c +++ b/src/test/tools/pmemwrite/write.c @@ -16,6 +16,7 @@ #include "output.h" #include #include +#include #include "mmap.h" #include "queue.h" @@ -167,6 +168,39 @@ pmemwrite_blk(struct pmemwrite *pwp) return ret; } +/* + * pmemwrite_obj -- write data to pmemobj pool file + */ +static int +pmemwrite_obj(struct pmemwrite *pwp) +{ + PMEMobjpool *pop = pmemobj_open(pwp->fname, NULL); + + if (!pop) { + warn("%s", pwp->fname); + return -1; + } + + int i; + int ret = 0; + for (i = 0; i < pwp->nargs; i++) { + size_t len = strlen(pwp->args[i]); + PMEMoid oid; + if (pmemobj_alloc(pop, &oid, len, 0, NULL, NULL)) { + warn("%s", pwp->fname); + ret = -1; + break; + } + void *dest = pmemobj_direct(oid); + + (void) pmemobj_memcpy_persist(pop, dest, pwp->args[i], len); + } + + pmemobj_close(pop); + + return ret; +} + int main(int argc, char *argv[]) { @@ -214,6 +248,9 @@ main(int argc, char *argv[]) case PMEM_POOL_TYPE_LOG: ret = pmemwrite_log(&pmemwrite); break; + case PMEM_POOL_TYPE_OBJ: + ret = pmemwrite_obj(&pmemwrite); + break; default: ret = 1; }