Commit 781601a0 authored by Kirill Tkhai's avatar Kirill Tkhai Committed by Pavel Emelyanov

zdtm: Custom file names in binfmt_misc test

If several copies of binfmt_misc test are running, we may fail because of duplicate names.
Fix that by giving a custom name for registered /proc/sys/fs/binfmt_misc/xxx.

################## Test zdtm/static/binfmt_misc FAIL at start ##################
Test output: ================================
18:03:33.594: 4: string: :magic_file:M:9:\x73\x51\xff\x4a\xec\x29\xcd\xba\xab\xf2::/bin/interpreter:OCP
18:03:33.594: 4: FAIL: binfmt_misc.c:133: write magic_file (errno = 22 (Invalid argument))
18:03:33.594: 3: ERR: test.c:204: Test exited unexpectedly with code 1
Signed-off-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent d3cf1c4f
......@@ -230,12 +230,12 @@ TST_DIR = \
mnt_ext_auto \
mnt_ext_master \
mntns_deleted \
binfmt_misc \
unlink_regular00 \
TST_DIR_FILE = \
chroot \
chroot-file
chroot-file \
binfmt_misc \
TST = \
$(TST_NOFILE) \
......
......@@ -19,8 +19,10 @@ const char *test_author = "Kirill Tkhai <ktkhai@odin.com";
char *dirname = "binfmt_misc.dir";
TEST_OPTION(dirname, string, "binfmt_misc mount directory name", 1);
char *filename;
TEST_OPTION(filename, string, "file name prefix (prefix_magic, prefix, extention)", 1);
const char *NAME[2] = { "magic_file", "extension_file" };
char NAME[2][PATH_MAX];
/* :name:type:offset:magic:mask:interpreter:flags */
......@@ -102,6 +104,9 @@ int main(int argc, char **argv)
test_init(argc, argv);
snprintf(NAME[0], PATH_MAX, "%s_magic", filename);
snprintf(NAME[1], PATH_MAX, "%s_extention", filename);
if (mkdir(dirname, 0777)) {
fail("mkdir");
exit(1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment