From patchwork Sat Oct 31 11:55:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Mosnacek X-Patchwork-Id: 11871327 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EBFB5139F for ; Sat, 31 Oct 2020 11:56:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C53EB20729 for ; Sat, 31 Oct 2020 11:56:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="gShIsbBu" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727085AbgJaL4K (ORCPT ); Sat, 31 Oct 2020 07:56:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:28961 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727043AbgJaL4J (ORCPT ); Sat, 31 Oct 2020 07:56:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604145368; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vYrQJbkdrg54Gc+N/qM71BZB5xoYJ/RWA9WY/UFLS/g=; b=gShIsbBug0Qrknx3yEf8775mwS2B3lfgU1dzqUmNeSjC95BPZspMgSIvGrfKtSE+46uTW/ qqq4xsaIT0uEzpQa+UcdrmJ0cXAZgDgHEy7hwH3dFzf4Zk0k5ZkROCO/99b/tLK3MbK75P 3J/594iqMoV1IKWmaeizbGANMC3cDhg= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-548-SstUUFscN1OafIWMuexafg-1; Sat, 31 Oct 2020 07:56:06 -0400 X-MC-Unique: SstUUFscN1OafIWMuexafg-1 Received: by mail-ed1-f69.google.com with SMTP id b16so3833074edn.6 for ; Sat, 31 Oct 2020 04:56:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vYrQJbkdrg54Gc+N/qM71BZB5xoYJ/RWA9WY/UFLS/g=; b=pJrkp7ry4MPHJKv93Gh9DOk9zjsAgR+CeodZ7FtOQPfjf4Z9yiGsEBRhQPwbjylZJS EZJlcj+rLjYXhkQW2235hjk8GS9yAu3CdXgOrrD8M1KfLyqxEkA23qooTikgKKQ5f9uX PJVK7ViYSQ378UbRRiCkRFaG5vyjCHjyKTXr6J6jJ8gpVMPjOTA1QcWhZ8/2Fi22h3Rz oqYu+WWIu/EcXc1zMb79aUY8YZo0lDOJczn60UrqXaeNDDts6ttHBXHHJm+314mefbP0 XjKInmgN4aEyL5Jgo3L/ITJ88JxkNv0Oh4Z7PQfPV3gbsV40pUToulfYs5D4HmFgkVrc HEgA== X-Gm-Message-State: AOAM531egixW0ckXeEWwjJL3/LvN14uXufFAPxsn8obD6jKGSRgoGfNZ uMRVHj/gCSn1ntlVPUNjtj3/cLpv2qTfJFk2R525gcxO8iSUD0zs7/Gcg/h8bzskhCX9m6EoibG YFdcEh5SxfwTR2YpqLw== X-Received: by 2002:a17:906:814:: with SMTP id e20mr7293716ejd.367.1604145364581; Sat, 31 Oct 2020 04:56:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7LHmW0XZAw55V/NwGorDgFaZUfq64BVama5QAD7sj5vrrzq2v/F+meI4Q9VOQykXTgm9ugQ== X-Received: by 2002:a17:906:814:: with SMTP id e20mr7293700ejd.367.1604145364430; Sat, 31 Oct 2020 04:56:04 -0700 (PDT) Received: from omos.redhat.com ([2a02:8308:b103:4000:9293:f330:b535:b530]) by smtp.gmail.com with ESMTPSA id y14sm4770746edo.69.2020.10.31.04.56.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Oct 2020 04:56:03 -0700 (PDT) From: Ondrej Mosnacek To: selinux@vger.kernel.org Cc: Richard Haines , Paul Moore Subject: [PATCH testsuite 1/3] README,travis: add e2fsprogs, jfsutils, and dosfstools to deps Date: Sat, 31 Oct 2020 12:55:59 +0100 Message-Id: <20201031115601.157591-2-omosnace@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201031115601.157591-1-omosnace@redhat.com> References: <20201031115601.157591-1-omosnace@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org They are needed for ext4, jfs, and vfat tests, which will become executed by default in an upcoming patch. Signed-off-by: Ondrej Mosnacek --- README.md | 6 ++++++ travis-ci/run-testsuite.sh | 3 +++ 2 files changed, 9 insertions(+) diff --git a/README.md b/README.md index 838a082..1149f30 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,9 @@ similar dependencies): * keyutils-libs-devel _(tools used by the keys tests)_ * kernel-devel _(used by the kernel module tests)_ * quota, xfsprogs-devel and libuuid-devel _(used by the filesystem tests)_ +* e2fsprogs _(used by the ext4 filesystem tests)_ +* jfsutils _(used by the jfs filesystem tests)_ +* dosfstools _(used by the vfat filesystem tests)_ * nftables _(used by inet_socket and sctp tests if ver >= 9.3 for secmark testing )_ On a modern Fedora system you can install these dependencies with the @@ -81,6 +84,9 @@ following command (NOTE: On Fedora 32 and below you need to remove quota \ xfsprogs-devel \ libuuid-devel \ + e2fsprogs \ + jfsutils \ + dosfstools \ nftables \ kernel-devel-$(uname -r) \ kernel-modules-$(uname -r) diff --git a/travis-ci/run-testsuite.sh b/travis-ci/run-testsuite.sh index 051f9d8..bd9073c 100755 --- a/travis-ci/run-testsuite.sh +++ b/travis-ci/run-testsuite.sh @@ -38,6 +38,9 @@ dnf install -y \ quota \ xfsprogs-devel \ libuuid-devel \ + e2fsprogs \ + jfsutils \ + dosfstools \ kernel-devel-"$(uname -r)" \ kernel-modules-"$(uname -r)" From patchwork Sat Oct 31 11:56:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Mosnacek X-Patchwork-Id: 11871331 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7997215E6 for ; Sat, 31 Oct 2020 11:56:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5E18620729 for ; Sat, 31 Oct 2020 11:56:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VsCHihDK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727028AbgJaL4L (ORCPT ); Sat, 31 Oct 2020 07:56:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:51909 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727060AbgJaL4K (ORCPT ); Sat, 31 Oct 2020 07:56:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604145369; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EEdhfquk6SyWWkHPzszNFtJfFb9gTGHgZXx6x23uqg0=; b=VsCHihDKGJGrmSgBbtJOdGliJmsLz2LbyvCiiWXIphh6YQQYzyc6KtqdvYIr3uuZTfg1/H sizajpmrpsvmWY2t1hlNksYu39ueETjsN8otJ0iIItfZIzNLceBtH7YdXOrt/cQadzymLa ZIE1+avP4gltdTse83gynShukZepHeE= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-538-dYvHYO6CP_qmgQW23UeFrw-1; Sat, 31 Oct 2020 07:56:07 -0400 X-MC-Unique: dYvHYO6CP_qmgQW23UeFrw-1 Received: by mail-ej1-f72.google.com with SMTP id z18so3237172eji.1 for ; Sat, 31 Oct 2020 04:56:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EEdhfquk6SyWWkHPzszNFtJfFb9gTGHgZXx6x23uqg0=; b=ACDrrqJmok0UCXN+aig/7iY9qs0QwtINk4W/ujFDD6oc4G/7D0yalwBh2wJNYxEbOU QVIld5uwndOz1FKrO/wGb9rOYiXGz5vnOlcGUpn2PFNgqCbUwEbJViXlefjJc5dwIQZf a8Y5nOakEI0pBl2uF7e9g8ZuzL7jBxOyli2kKNBrEmD1DJdrFLrjOg44NncfrtP3JiX9 rOwhV+6cVzRUxwGCcQFK85WWRwWQ25WeVgAdiyI9g2EF98NmtUmius5AYdGt2acPOXAR QXqhAh7VRWld3w2NE63paI7nIWfDbn3LHLErsB2ZPfZbLZgaq9oEXFNhLlBTqCzRpVJT VcvA== X-Gm-Message-State: AOAM533Kutdcf1lecI5pXF7IF70wyUZNVe6ReIVNXHDRpt1sRrk/spQb KXbBxNpkwfcE81Z1HkTocGiPjekTiWZuhvxLnIwVapETpR5OVbYHpy6TnfuJBkasZa19QRuUrqD DwgCRw7k18+C809BvXQ== X-Received: by 2002:a17:906:e24a:: with SMTP id gq10mr6705990ejb.552.1604145365855; Sat, 31 Oct 2020 04:56:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6UvZ4yGrE/kjSnYPZX0HmCHUoBIb+Fhaj5qdAOj1RS0B+sinX78Gej8qf2kWh/pVie7spxA== X-Received: by 2002:a17:906:e24a:: with SMTP id gq10mr6705974ejb.552.1604145365692; Sat, 31 Oct 2020 04:56:05 -0700 (PDT) Received: from omos.redhat.com ([2a02:8308:b103:4000:9293:f330:b535:b530]) by smtp.gmail.com with ESMTPSA id y14sm4770746edo.69.2020.10.31.04.56.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Oct 2020 04:56:05 -0700 (PDT) From: Ondrej Mosnacek To: selinux@vger.kernel.org Cc: Richard Haines , Paul Moore Subject: [PATCH testsuite 2/3] tests/filesystem: pipe "yes" to mkfs.* to fix jfs test Date: Sat, 31 Oct 2020 12:56:00 +0100 Message-Id: <20201031115601.157591-3-omosnace@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201031115601.157591-1-omosnace@redhat.com> References: <20201031115601.157591-1-omosnace@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org mkfs.jfs is reluctant to overwrite the device without the user's consent, so shout a stream of y's on it to avoid the test getting stuck. We can't universally pass -q to mkfs.*, because not all mkfs.* tools support it. Signed-off-by: Ondrej Mosnacek --- tests/filesystem/Filesystem.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/filesystem/Filesystem.pm b/tests/filesystem/Filesystem.pm index 2365ce8..c14e760 100644 --- a/tests/filesystem/Filesystem.pm +++ b/tests/filesystem/Filesystem.pm @@ -133,7 +133,7 @@ sub make_fs { attach_dev( $mk_dev, $mk_dir ); print "Make $mk_type filesystem on $mk_dev\n"; - $result = system("mkfs.$mk_type $mk_dev >& /dev/null"); + $result = system("yes | mkfs.$mk_type $mk_dev >& /dev/null"); if ( $result != 0 ) { system("losetup -d $mk_dev 2>/dev/null"); print "mkfs.$mk_type failed to create filesystem on $mk_dev\n"; From patchwork Sat Oct 31 11:56:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Mosnacek X-Patchwork-Id: 11871333 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 20DFC14B2 for ; Sat, 31 Oct 2020 11:56:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0158920729 for ; Sat, 31 Oct 2020 11:56:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="M1Jfw7a1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727092AbgJaL4Q (ORCPT ); Sat, 31 Oct 2020 07:56:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:32370 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727060AbgJaL4Q (ORCPT ); Sat, 31 Oct 2020 07:56:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604145374; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z/y1OYalnRGI1Olmrjs8WONPGORx9187XsB0QOJai9k=; b=M1Jfw7a1A4MycpQtyOQN/DkgId+9P+7IUtEhe4MWSDa/NCi61pas2u49LVrO2B6awKruYG ujJl0A7Vg0J43y0/4XwzDxqgWyCqM+FYuioEBezZa4RaAQJoykFjiT9FDbyJEoHzEsxMAM mwZV5PM6Og07uYm+cc6k25CgbTw1WbQ= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-558-Vzf3ykXPPR6RSViik_pvsA-1; Sat, 31 Oct 2020 07:56:08 -0400 X-MC-Unique: Vzf3ykXPPR6RSViik_pvsA-1 Received: by mail-ed1-f71.google.com with SMTP id u12so3803039edi.17 for ; Sat, 31 Oct 2020 04:56:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Z/y1OYalnRGI1Olmrjs8WONPGORx9187XsB0QOJai9k=; b=f2HE9sv9mCQHl2k/8cQUxs/0/Tong3veByTNRDVPQFEQ5I1aTXqYinR5Mooo4nxP+1 nf3+lBtuHYHvggYjUl44fzziHrq3JCYqDEINKnAJaRmN0cTzZSbpXqzC5dx8C6daw0ys 1hfNhWvbIEU2kAzDktu8mmJ/v07y8FX27baLmA6Ckxju9E/CPDw//AYOnoGFS2day8xd ujZzeNPWQITuusCjsx81dlrPlx28J2U9wmqnmSsYt62J8OWdEHaVP8xhDKX68v/Vxnav qlbZuJGxjLVn31WGTXMyG6/O1R2yeTLQqT0L2FDT9gonji/6IipAVWxq9Tm3RE2nn8N+ 1YNQ== X-Gm-Message-State: AOAM532JY5IojEZmk4KU9XqwhIQ1ez2NnmsFVpum5t16gB1++r/t3M94 knMxzR5QH5UCTZZ8ULr5/ZRIO/V8gdFOVJ+3KsI9A1ZFyX0g/1tZJOi8bhBYVNSh69Gd3ofynnI 7RvjSj3FLSoWCQIBWgg== X-Received: by 2002:aa7:ce8c:: with SMTP id y12mr7512284edv.185.1604145366682; Sat, 31 Oct 2020 04:56:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTmdMF1ua5YuYALF20VcwGVJqQ3KxdeTYua7fUgVdQsdhBgRWYZhdYKqzLEx2SgwSOyH95Wg== X-Received: by 2002:aa7:ce8c:: with SMTP id y12mr7512269edv.185.1604145366457; Sat, 31 Oct 2020 04:56:06 -0700 (PDT) Received: from omos.redhat.com ([2a02:8308:b103:4000:9293:f330:b535:b530]) by smtp.gmail.com with ESMTPSA id y14sm4770746edo.69.2020.10.31.04.56.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Oct 2020 04:56:05 -0700 (PDT) From: Ondrej Mosnacek To: selinux@vger.kernel.org Cc: Richard Haines , Paul Moore Subject: [PATCH testsuite 3/3] tests/[fs_]filesystem: test all filesystems Date: Sat, 31 Oct 2020 12:56:01 +0100 Message-Id: <20201031115601.157591-4-omosnace@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201031115601.157591-1-omosnace@redhat.com> References: <20201031115601.157591-1-omosnace@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org Run [fs_]filesystem tests always for all common filesystems (xfs, ext4, jfs, vfat). Use symlinks to achieve this without changing much code while still allowing to run the test script directly (optionally specifying the filesystem type). Signed-off-by: Ondrej Mosnacek --- tests/Makefile | 8 ++++++-- tests/filesystem/ext4 | 1 + tests/filesystem/jfs | 1 + tests/filesystem/test | 14 ++++++++++++-- tests/filesystem/vfat | 1 + tests/filesystem/xfs | 1 + tests/fs_filesystem/ext4 | 1 + tests/fs_filesystem/jfs | 1 + tests/fs_filesystem/test | 14 ++++++++++++-- tests/fs_filesystem/vfat | 1 + tests/fs_filesystem/xfs | 1 + 11 files changed, 38 insertions(+), 6 deletions(-) create mode 120000 tests/filesystem/ext4 create mode 120000 tests/filesystem/jfs create mode 120000 tests/filesystem/vfat create mode 120000 tests/filesystem/xfs create mode 120000 tests/fs_filesystem/ext4 create mode 120000 tests/fs_filesystem/jfs create mode 120000 tests/fs_filesystem/vfat create mode 120000 tests/fs_filesystem/xfs diff --git a/tests/Makefile b/tests/Makefile index 001639b..b441031 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -4,6 +4,7 @@ SBINDIR ?= $(PREFIX)/sbin POLDEV ?= $(PREFIX)/share/selinux/devel INCLUDEDIR ?= $(PREFIX)/include SELINUXFS ?= /sys/fs/selinux +FILESYSTEMS ?= ext4 xfs jfs vfat export CFLAGS+=-g -O0 -Wall -D_GNU_SOURCE @@ -17,6 +18,9 @@ MOD_POL_VERS := $(shell $(CHECKMODULE) -V |cut -f 2 -d '-') MAX_KERNEL_POLICY := $(shell cat $(SELINUXFS)/policyvers) POL_TYPE := $(shell ./pol_detect $(SELINUXFS)) +# Filter out unavailable filesystems +FILESYSTEMS := $(foreach fs,$(FILESYSTEMS),$(shell modprobe $(fs) && echo $(fs))) + SUBDIRS:= domain_trans entrypoint execshare exectrace execute_no_trans \ fdreceive inherit link mkdir msg open ptrace readlink relabel rename \ rxdir sem setattr setnice shm sigkill stat sysctl task_create \ @@ -111,7 +115,7 @@ SUBDIRS += lockdown endif ifeq ($(shell grep -q filesystem $(POLDEV)/include/support/all_perms.spt && echo true),true) -SUBDIRS += filesystem +SUBDIRS += $(addprefix filesystem/,$(FILESYSTEMS)) ifeq ($(shell grep -q all_filesystem_perms.*watch $(POLDEV)/include/support/all_perms.spt && echo true),true) export CFLAGS += -DHAVE_FS_WATCH_PERM endif @@ -119,7 +123,7 @@ endif ifeq ($(shell grep -q filesystem $(POLDEV)/include/support/all_perms.spt && echo true),true) ifneq ($(shell ./kvercmp $$(uname -r) 5.2),-1) -SUBDIRS += fs_filesystem +SUBDIRS += $(addprefix fs_filesystem/,$(FILESYSTEMS)) endif endif diff --git a/tests/filesystem/ext4 b/tests/filesystem/ext4 new file mode 120000 index 0000000..945c9b4 --- /dev/null +++ b/tests/filesystem/ext4 @@ -0,0 +1 @@ +. \ No newline at end of file diff --git a/tests/filesystem/jfs b/tests/filesystem/jfs new file mode 120000 index 0000000..945c9b4 --- /dev/null +++ b/tests/filesystem/jfs @@ -0,0 +1 @@ +. \ No newline at end of file diff --git a/tests/filesystem/test b/tests/filesystem/test index 7d4654d..6b37b76 100755 --- a/tests/filesystem/test +++ b/tests/filesystem/test @@ -12,6 +12,17 @@ BEGIN { $basedir = $0; $basedir =~ s|(.*)/[^/]*|$1|; + # extract test_name and move up one dir if started from a subdir + $test_name = $basedir; + $test_name =~ s|.*/([^/]*)|$1|; + if ( $test_name eq "fs_filesystem" ) { + $fs_type = " "; + } + else { + $fs_type = $test_name; + $basedir =~ s|(.*)/[^/]*|$1|; + } + # Options: -v Verbose, -e enable udisks(8) daemon, -f filesystem type $v = " "; $disable_udisks = 1; @@ -20,8 +31,7 @@ BEGIN { $nfs_enabled = 0; $vfat_enabled = 0; - $i = 0; - $fs_type = " "; + $i = 0; foreach $arg (@ARGV) { if ( $arg eq "-v" ) { $v = $arg; diff --git a/tests/filesystem/vfat b/tests/filesystem/vfat new file mode 120000 index 0000000..945c9b4 --- /dev/null +++ b/tests/filesystem/vfat @@ -0,0 +1 @@ +. \ No newline at end of file diff --git a/tests/filesystem/xfs b/tests/filesystem/xfs new file mode 120000 index 0000000..945c9b4 --- /dev/null +++ b/tests/filesystem/xfs @@ -0,0 +1 @@ +. \ No newline at end of file diff --git a/tests/fs_filesystem/ext4 b/tests/fs_filesystem/ext4 new file mode 120000 index 0000000..945c9b4 --- /dev/null +++ b/tests/fs_filesystem/ext4 @@ -0,0 +1 @@ +. \ No newline at end of file diff --git a/tests/fs_filesystem/jfs b/tests/fs_filesystem/jfs new file mode 120000 index 0000000..945c9b4 --- /dev/null +++ b/tests/fs_filesystem/jfs @@ -0,0 +1 @@ +. \ No newline at end of file diff --git a/tests/fs_filesystem/test b/tests/fs_filesystem/test index 5dedf83..ec71d92 100755 --- a/tests/fs_filesystem/test +++ b/tests/fs_filesystem/test @@ -12,6 +12,17 @@ BEGIN { $basedir = $0; $basedir =~ s|(.*)/[^/]*|$1|; + # extract test_name and move up one dir if started from a subdir + $test_name = $basedir; + $test_name =~ s|.*/([^/]*)|$1|; + if ( $test_name eq "fs_filesystem" ) { + $fs_type = " "; + } + else { + $fs_type = $test_name; + $basedir =~ s|(.*)/[^/]*|$1|; + } + # Some code in tests/filesystem is reused $filesystem_dir = "$basedir/../filesystem"; @@ -23,8 +34,7 @@ BEGIN { $nfs_enabled = 0; $vfat_enabled = 0; - $i = 0; - $fs_type = " "; + $i = 0; foreach $arg (@ARGV) { if ( $arg eq "-v" ) { $v = $arg; diff --git a/tests/fs_filesystem/vfat b/tests/fs_filesystem/vfat new file mode 120000 index 0000000..945c9b4 --- /dev/null +++ b/tests/fs_filesystem/vfat @@ -0,0 +1 @@ +. \ No newline at end of file diff --git a/tests/fs_filesystem/xfs b/tests/fs_filesystem/xfs new file mode 120000 index 0000000..945c9b4 --- /dev/null +++ b/tests/fs_filesystem/xfs @@ -0,0 +1 @@ +. \ No newline at end of file