test/others/rpc: parse action-script via config

Extend the test for overwriting config options via RPC with
repeatable option (--action-script) and verify that the value
will not be silently duplicated.

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
This commit is contained in:
Radostin Stoyanov 2025-09-03 18:29:34 +01:00 committed by Andrei Vagin
parent c03c08d1bc
commit 9d072222ef
3 changed files with 29 additions and 0 deletions

View file

@ -12,6 +12,7 @@ run: all
chmod a+rwx build
chmod a+rwx build/{imgs_errno,imgs_ps,imgs_c,imgs_loop,imgs_py}
rm -f build/status
rm -f build/_marker_*
@# Create all log files to be accessible for anybody
@# so that they can be displayed by any user.
for i in imgs_errno/criu.log imgs_ps/page-server.log imgs_ps/dump.log \

View file

@ -0,0 +1,17 @@
#!/bin/bash
MARKER_FILE="_marker_${CRTOOLS_SCRIPT_ACTION}"
if [ -z "$CRTOOLS_SCRIPT_ACTION" ]; then
echo "Error: CRTOOLS_SCRIPT_ACTION is not set."
exit 2
fi
if [ ! -f "$MARKER_FILE" ]; then
touch "$MARKER_FILE"
else
echo "Error: Running the same action hook for the second time"
exit 1
fi
exit 0

View file

@ -13,6 +13,9 @@ from setup_swrk import setup_swrk
log_file = 'config_file_test.log'
does_not_exist = 'does-not.exist'
script_path = os.path.dirname(os.path.abspath(__file__))
action_script_file = os.path.join(script_path, 'action-script.sh')
def setup_config_file(content):
# Creating a temporary file which will be used as configuration file.
@ -156,6 +159,7 @@ def test_rpc_with_configuration_file_overwriting_rpc():
# file settings in the default configuration.
log = does_not_exist
content = 'log-file ' + log + '\n'
content += 'action-script ' + action_script_file + '\n'
content += 'no-tcp-established\nno-shell-job'
path = setup_config_file(content)
# Only set the configuration file via RPC;
@ -180,11 +184,18 @@ args = vars(parser.parse_args())
cleanup_output(args['dir'])
print("*** Test broken config file ***")
test_broken_configuration_file()
cleanup_output(args['dir'])
print("*** Test RPC without config file ***")
test_rpc_without_configuration_file()
cleanup_output(args['dir'])
print("*** Test RPC with config file ***")
test_rpc_with_configuration_file()
cleanup_output(args['dir'])
print("*** Test configuration file overwriting RPC ***")
test_rpc_with_configuration_file_overwriting_rpc()
cleanup_output(args['dir'])