aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2023-10-02 11:00:49 +0200
committerfanquake <fanquake@gmail.com>2023-10-02 11:08:56 +0200
commitf66af92f1a3e2ebbae8050e57a60e051f9bf5f39 (patch)
treefe16238677ec6949a824cad3b7a5d57717fe69a1
parent5bbf735defac20f58133bea95226e13a5d8209bc (diff)
parentfa40b3ee22e78f58d7426dbc4343472ba40081e3 (diff)
Merge bitcoin/bitcoin#28545: test: Avoid test failure on Linux root without cap-add LINUX_IMMUTABLE
fa40b3ee22e78f58d7426dbc4343472ba40081e3 test: Avoid test failure on Linux root without cap-add LINUX_IMMUTABLE (MarcoFalke) Pull request description: This turns a test failure on Linux when running the test as `root`, but without the `LINUX_IMMUTABLE` capability, into an early return, with a suggestion to turn on `LINUX_IMMUTABLE` next time (if possible). ACKs for top commit: pinheadmz: utACK fa40b3ee22e78f58d7426dbc4343472ba40081e3 jonatack: ACK fa40b3ee22e78f58d7426dbc4343472ba40081e3 Tree-SHA512: d986ff8aeae5f8267c21a23d5be16f7c5a4d4d3be045a6999d8b39c7b8672cfe915dedde762cc9965cdc4970940bffc4b0d1412833d8036d4425450eb6181f67
-rwxr-xr-xtest/functional/feature_reindex_readonly.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/functional/feature_reindex_readonly.py b/test/functional/feature_reindex_readonly.py
index 9f1bb30023..26531f472b 100755
--- a/test/functional/feature_reindex_readonly.py
+++ b/test/functional/feature_reindex_readonly.py
@@ -6,6 +6,7 @@
- Start a node, generate blocks, then restart with -reindex after setting blk files to read-only
"""
+import os
import platform
import stat
import subprocess
@@ -45,6 +46,11 @@ class BlockstoreReindexTest(BitcoinTestFramework):
self.log.warning(f"stdout: {e.stdout}")
if e.stderr:
self.log.warning(f"stderr: {e.stderr}")
+ if os.getuid() == 0:
+ self.log.warning("Return early on Linux under root, because chattr failed.")
+ self.log.warning("This should only happen due to missing capabilities in a container.")
+ self.log.warning("Make sure to --cap-add LINUX_IMMUTABLE if you want to run this test.")
+ return
self.log.debug("Attempt to restart and reindex the node with the unwritable block file")
with self.nodes[0].assert_debug_log(expected_msgs=['FlushStateToDisk', 'failed to open file'], unexpected_msgs=[]):