summaryrefslogtreecommitdiff
path: root/src/test/test-fstab-util.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-01-11 00:04:00 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-01-11 23:41:41 -0500
commitb9f111b93f9f442f00266f338b14f25ca8685352 (patch)
treeb181920cabc924b56810502bef2a4a270f414932 /src/test/test-fstab-util.c
parenta6dba97829e345772fae7c1d859e9fe0570ac42b (diff)
Support negated fstab options
We would ignore options like "fail" and "auto", and for any option which takes a value the first assignment would win. Repeated and options equivalent to the default are rarely used, but they have been documented forever, and people might use them. Especially on the kernel command line it is easier to append a repeated or negated option at the end.
Diffstat (limited to 'src/test/test-fstab-util.c')
-rw-r--r--src/test/test-fstab-util.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/test/test-fstab-util.c b/src/test/test-fstab-util.c
index ddf965dde5..284484d656 100644
--- a/src/test/test-fstab-util.c
+++ b/src/test/test-fstab-util.c
@@ -107,6 +107,15 @@ static void test_fstab_filter_options(void) {
do_fstab_filter_options("", "opt\0", 0, NULL, NULL, "");
}
+static void test_fstab_yes_no_option(void) {
+ assert_se(fstab_test_yes_no_option("nofail,fail,nofail", "nofail\0fail\0") == true);
+ assert_se(fstab_test_yes_no_option("nofail,nofail,fail", "nofail\0fail\0") == false);
+ assert_se(fstab_test_yes_no_option("abc,cde,afail", "nofail\0fail\0") == false);
+ assert_se(fstab_test_yes_no_option("nofail,fail=0,nofail=0", "nofail\0fail\0") == true);
+ assert_se(fstab_test_yes_no_option("nofail,nofail=0,fail=0", "nofail\0fail\0") == false);
+}
+
int main(void) {
test_fstab_filter_options();
+ test_fstab_yes_no_option();
}