From ba8c5564200090cc79fdc452d8fb34523070a04f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Plewa?= <lukasz.plewa@intel.com>
Date: Mon, 18 Mar 2019 10:46:13 -0700
Subject: [PATCH] test: fix pmempool check tests

As we are clearing shutdown state incompat feature by pmemspoil
we must reset SDS to 0 otherwise pmempool check will detect a pool
corruption.
---
 src/test/pmempool_check/TEST1          | 5 ++++-
 src/test/pmempool_check/TEST1.PS1      | 9 +++------
 src/test/pmempool_check/TEST9          | 5 ++++-
 src/test/pmempool_check/TEST9.PS1      | 9 ++++-----
 src/test/pmempool_check/out1.log.match | 3 +++
 src/test/pmempool_check/out9.log.match | 3 +++
 6 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/src/test/pmempool_check/TEST1 b/src/test/pmempool_check/TEST1
index 82239ccfe..92bfe4399 100755
--- a/src/test/pmempool_check/TEST1
+++ b/src/test/pmempool_check/TEST1
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 #
-# Copyright 2014-2018, Intel Corporation
+# Copyright 2014-2019, Intel Corporation
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -53,6 +53,9 @@ $PMEMSPOIL -v $POOL pool_hdr.major=0x0\
 			pool_hdr.features.compat=0xfe\
 			pool_hdr.features.incompat=0xfb\
 			pool_hdr.features.ro_compat=0xff\
+			pool_hdr.shutdown_state.usc=0\
+			pool_hdr.shutdown_state.uuid=0\
+			'pool_hdr.shutdown_state.checksum_gen()'\
 			pool_hdr.unused=ERROR >> $LOG
 expect_normal_exit $PMEMPOOL$EXESUFFIX check -vry $POOL >> $LOG
 
diff --git a/src/test/pmempool_check/TEST1.PS1 b/src/test/pmempool_check/TEST1.PS1
index 30c187165..ef54d4817 100644
--- a/src/test/pmempool_check/TEST1.PS1
+++ b/src/test/pmempool_check/TEST1.PS1
@@ -1,5 +1,5 @@
 #
-# Copyright 2014-2018, Intel Corporation
+# Copyright 2014-2019, Intel Corporation
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -47,11 +47,8 @@ $LOG="out$Env:UNITTEST_NUM.log"
 echo "PMEMLOG: pool_hdr" > $LOG
 expect_normal_exit $PMEMPOOL create log $POOL
 check_file $POOL
-# pool_hdr.features.incompat on Windows has to have SHUTDOWN_STATE feature enabled
-# otherwise pmempool check will fail because of dirty shutdown state structures
-# which are expected to be zeroed if SHUTDOWN_STATE feature is disabled
-# 0xfe == 0xfb | SHUTDOWN_STATE
-Invoke-Expression "$PMEMSPOIL -v $POOL pool_hdr.major=0x0 pool_hdr.features.compat=0xfe pool_hdr.features.incompat=0xfe pool_hdr.features.ro_compat=0xff pool_hdr.unused=ERROR >> $LOG"
+
+Invoke-Expression "$PMEMSPOIL -v $POOL pool_hdr.major=0x0 pool_hdr.features.compat=0xfe pool_hdr.features.incompat=0xfe pool_hdr.features.ro_compat=0xfb pool_hdr.shutdown_state.usc=0 pool_hdr.shutdown_state.uuid=0 'pool_hdr.shutdown_state.checksum_gen()' pool_hdr.unused=ERROR >> $LOG"
 expect_normal_exit $PMEMPOOL check -vry $POOL >> $LOG
 
 echo "PMEMLOG: pmemlog" >> $LOG
diff --git a/src/test/pmempool_check/TEST9 b/src/test/pmempool_check/TEST9
index bf90d9cb6..6f006dd28 100755
--- a/src/test/pmempool_check/TEST9
+++ b/src/test/pmempool_check/TEST9
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 #
-# Copyright 2014-2018, Intel Corporation
+# Copyright 2014-2019, Intel Corporation
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -54,6 +54,9 @@ $PMEMSPOIL -v $POOL pool_hdr.major=0x0\
 			pool_hdr.features.compat=0xfe\
 			pool_hdr.features.incompat=0xfb\
 			pool_hdr.features.ro_compat=0xff\
+			pool_hdr.shutdown_state.usc=0\
+			pool_hdr.shutdown_state.uuid=0\
+			'pool_hdr.shutdown_state.checksum_gen()'\
 			pool_hdr.unused=ERROR >> $LOG
 
 expect_abnormal_exit $PMEMPOOL$EXESUFFIX check -vyr $POOL >> $LOG
diff --git a/src/test/pmempool_check/TEST9.PS1 b/src/test/pmempool_check/TEST9.PS1
index 5cb094371..cc0ab95f5 100644
--- a/src/test/pmempool_check/TEST9.PS1
+++ b/src/test/pmempool_check/TEST9.PS1
@@ -1,5 +1,5 @@
 #
-# Copyright 2017-2018, Intel Corporation
+# Copyright 2017-2019, Intel Corporation
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -48,15 +48,14 @@ expect_normal_exit $PMEMPOOL create obj $POOL
 
 expect_normal_exit $PMEMPOOL check -vyr $POOL >> $LOG
 
-# pool_hdr.features.incompat on Windows has to have SHUTDOWN_STATE feature enabled
-# otherwise pmempool check will fail because of dirty shutdown state structures
-# which are expected to be zeroed if SHUTDOWN_STATE feature is disabled
-# 0xfe == 0xfb | SHUTDOWN_STATE
 &$PMEMSPOIL -v $POOL `
 	pool_hdr.major=0x0 `
 	pool_hdr.features.compat=0xfe `
 	pool_hdr.features.incompat=0xfe `
 	pool_hdr.features.ro_compat=0xff `
+	pool_hdr.shutdown_state.usc=0 `
+	pool_hdr.shutdown_state.uuid=0 `
+	'pool_hdr.shutdown_state.checksum_gen()' `
 	pool_hdr.unused=ERROR `
 	>> $LOG
 
diff --git a/src/test/pmempool_check/out1.log.match b/src/test/pmempool_check/out1.log.match
index 301bc9f4d..6515de7c5 100644
--- a/src/test/pmempool_check/out1.log.match
+++ b/src/test/pmempool_check/out1.log.match
@@ -3,6 +3,9 @@ $(nW): spoil: pool_hdr.major=$(*)
 $(nW): spoil: pool_hdr.features.compat=$(*)
 $(nW): spoil: pool_hdr.features.incompat=$(*)
 $(nW): spoil: pool_hdr.features.ro_compat=$(*)
+$(nW): spoil: pool_hdr.shutdown_state.usc=0
+$(nW): spoil: pool_hdr.shutdown_state.uuid=0
+$(nW): spoil: pool_hdr.shutdown_state.checksum_gen()
 $(nW): spoil: pool_hdr.unused=$(*)
 checking shutdown state
 shutdown state correct
diff --git a/src/test/pmempool_check/out9.log.match b/src/test/pmempool_check/out9.log.match
index 46149f1c2..057e73a55 100644
--- a/src/test/pmempool_check/out9.log.match
+++ b/src/test/pmempool_check/out9.log.match
@@ -8,6 +8,9 @@ $(nW)file.pool: spoil: pool_hdr.features.compat=0xfe
 $(OPT)$(nW)file.pool: spoil: pool_hdr.features.incompat=0xfb
 $(OPX)$(nW)file.pool: spoil: pool_hdr.features.incompat=0xfe
 $(nW)file.pool: spoil: pool_hdr.features.ro_compat=0xff
+$(nW): spoil: pool_hdr.shutdown_state.usc=0
+$(nW): spoil: pool_hdr.shutdown_state.uuid=0
+$(nW): spoil: pool_hdr.shutdown_state.checksum_gen()
 $(nW)file.pool: spoil: pool_hdr.unused=ERROR
 checking shutdown state
 shutdown state correct
-- 
GitLab