Skip to content

Commit f66af92

Browse files
committed
Merge bitcoin/bitcoin#28545: test: Avoid test failure on Linux root without cap-add LINUX_IMMUTABLE
fa40b3e 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 fa40b3e jonatack: ACK fa40b3e Tree-SHA512: d986ff8aeae5f8267c21a23d5be16f7c5a4d4d3be045a6999d8b39c7b8672cfe915dedde762cc9965cdc4970940bffc4b0d1412833d8036d4425450eb6181f67
2 parents 5bbf735 + fa40b3e commit f66af92

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/functional/feature_reindex_readonly.py

+6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- Start a node, generate blocks, then restart with -reindex after setting blk files to read-only
77
"""
88

9+
import os
910
import platform
1011
import stat
1112
import subprocess
@@ -45,6 +46,11 @@ def reindex_readonly(self):
4546
self.log.warning(f"stdout: {e.stdout}")
4647
if e.stderr:
4748
self.log.warning(f"stderr: {e.stderr}")
49+
if os.getuid() == 0:
50+
self.log.warning("Return early on Linux under root, because chattr failed.")
51+
self.log.warning("This should only happen due to missing capabilities in a container.")
52+
self.log.warning("Make sure to --cap-add LINUX_IMMUTABLE if you want to run this test.")
53+
return
4854

4955
self.log.debug("Attempt to restart and reindex the node with the unwritable block file")
5056
with self.nodes[0].assert_debug_log(expected_msgs=['FlushStateToDisk', 'failed to open file'], unexpected_msgs=[]):

0 commit comments

Comments
 (0)