From 82d87ff8eda1a8e43cda4a5f500fc579477ee606 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Thu, 16 Jun 2016 21:29:22 +0200 Subject: Add "-ro" (read-only) flag From the man page: **-ro** : Mount the filesystem read-only Also add a test. --- tests/integration_tests/cli_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests') diff --git a/tests/integration_tests/cli_test.go b/tests/integration_tests/cli_test.go index ae6ef7f..0246901 100644 --- a/tests/integration_tests/cli_test.go +++ b/tests/integration_tests/cli_test.go @@ -102,3 +102,21 @@ func TestInitPlaintextNames(t *testing.T) { t.Error("FlagEMENames and FlagDirIV should be not set") } } + +// Test -ro +func TestRo(t *testing.T) { + dir := test_helpers.InitFS(t) + mnt := dir + ".mnt" + test_helpers.MountOrFatal(t, dir, mnt, "-ro", "-extpass=echo test") + defer test_helpers.Unmount(mnt) + + file := mnt + "/file" + err := os.Mkdir(file, 0777) + if err == nil { + t.Errorf("Mkdir should have failed") + } + _, err = os.Create(file) + if err == nil { + t.Errorf("Create should have failed") + } +} -- cgit v1.2.3