aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/canonical-benchmarks.bash3
-rw-r--r--tests/cluster/cluster_test.go4
-rwxr-xr-xtests/dl-linux-tarball.bash4
-rw-r--r--tests/example_filesystems/example_test_helpers.go12
-rwxr-xr-xtests/fuse-unmount.bash5
-rw-r--r--tests/matrix/atime_darwin+freebsd.go (renamed from tests/matrix/atime_darwin.go)2
-rwxr-xr-xtests/reverse/linux-tarball-test.bash2
-rwxr-xr-xtests/sshfs-benchmark.bash2
-rwxr-xr-xtests/stress_tests/extractloop.bash2
-rwxr-xr-xtests/stress_tests/fsstress-gocryptfs.bash2
-rwxr-xr-xtests/stress_tests/pingpong.bash2
-rw-r--r--tests/test_helpers/mount_unmount.go6
12 files changed, 29 insertions, 17 deletions
diff --git a/tests/canonical-benchmarks.bash b/tests/canonical-benchmarks.bash
index 4c1a357..963fd6a 100755
--- a/tests/canonical-benchmarks.bash
+++ b/tests/canonical-benchmarks.bash
@@ -1,4 +1,4 @@
-#!/bin/bash -eu
+#!/usr/bin/env bash
#
# Run the set of "canonical" benchmarks that are shown on
# https://nuetzlich.net/gocryptfs/comparison/
@@ -6,6 +6,7 @@
#
# This is called by the top-level script "benchmark.bash".
+set -eu
MYNAME=$(basename "$0")
diff --git a/tests/cluster/cluster_test.go b/tests/cluster/cluster_test.go
index 2e969ce..af93bc4 100644
--- a/tests/cluster/cluster_test.go
+++ b/tests/cluster/cluster_test.go
@@ -27,8 +27,8 @@ import (
// > buffered read/write.
//
// See also:
-// * https://lore.kernel.org/linux-xfs/20190325001044.GA23020@dastard/
-// Dave Chinner: XFS is the only linux filesystem that provides this behaviour.
+// - https://lore.kernel.org/linux-xfs/20190325001044.GA23020@dastard/
+// Dave Chinner: XFS is the only linux filesystem that provides this behaviour.
func TestClusterConcurrentRW(t *testing.T) {
if os.Getenv("ENABLE_CLUSTER_TEST") != "1" {
t.Skipf("This test is disabled by default because it fails unless on XFS.\n" +
diff --git a/tests/dl-linux-tarball.bash b/tests/dl-linux-tarball.bash
index 03c0e7d..3c325db 100755
--- a/tests/dl-linux-tarball.bash
+++ b/tests/dl-linux-tarball.bash
@@ -1,8 +1,10 @@
-#!/bin/bash -eu
+#!/usr/bin/env bash
#
# This script checks the size of /tmp/linux-3.0.tar.gz and downloads
# a fresh copy if the size is incorrect or the file is missing.
+set -eu
+
URL=https://cdn.kernel.org/pub/linux/kernel/v3.0/linux-3.0.tar.gz
TGZ=/tmp/linux-3.0.tar.gz
diff --git a/tests/example_filesystems/example_test_helpers.go b/tests/example_filesystems/example_test_helpers.go
index 34e5786..5e38721 100644
--- a/tests/example_filesystems/example_test_helpers.go
+++ b/tests/example_filesystems/example_test_helpers.go
@@ -27,26 +27,26 @@ func checkExampleFS(t *testing.T, dir string, rw bool) {
symlink := filepath.Join(dir, "rel")
target, err := os.Readlink(symlink)
if err != nil {
- t.Error(err)
+ t.Errorf("relative symlink: Readlink: %v", err)
return
}
if target != "status.txt" {
- t.Errorf("Unexpected link target: %s\n", target)
+ t.Errorf("relative symlink: Unexpected link target: %s\n", target)
}
// Read absolute symlink
symlink = filepath.Join(dir, "abs")
target, err = os.Readlink(symlink)
if err != nil {
- t.Error(err)
+ t.Errorf("absolute symlink: Readlink: %v", err)
return
}
if target != "/a/b/c/d" {
- t.Errorf("Unexpected link target: %s\n", target)
+ t.Errorf("absolute symlink: Unexpected link target: %s\n", target)
}
if rw {
// Test directory operations
- test_helpers.TestRename(t, dir)
- test_helpers.TestMkdirRmdir(t, dir)
+ t.Run("TestRename", func(t *testing.T) { test_helpers.TestRename(t, dir) })
+ t.Run("TestMkdirRmdir", func(t *testing.T) { test_helpers.TestMkdirRmdir(t, dir) })
}
}
diff --git a/tests/fuse-unmount.bash b/tests/fuse-unmount.bash
index b36f28c..02c6e4c 100755
--- a/tests/fuse-unmount.bash
+++ b/tests/fuse-unmount.bash
@@ -1,10 +1,13 @@
-#!/bin/bash -eu
+#!/usr/bin/env bash
#
# Compatibility wrapper around "fusermount" on Linux and "umount" on
# Mac OS X and friends.
#
# This script can be sourced or executed directly.
#
+
+set -eu
+
fuse-unmount() {
local MYNAME=$(basename "$BASH_SOURCE")
if [[ $# -eq 0 ]] ; then
diff --git a/tests/matrix/atime_darwin.go b/tests/matrix/atime_darwin+freebsd.go
index 5f89c69..43db0d5 100644
--- a/tests/matrix/atime_darwin.go
+++ b/tests/matrix/atime_darwin+freebsd.go
@@ -1,3 +1,5 @@
+//go:build darwin || freebsd
+
package matrix
import (
diff --git a/tests/reverse/linux-tarball-test.bash b/tests/reverse/linux-tarball-test.bash
index 4054c29..27afa23 100755
--- a/tests/reverse/linux-tarball-test.bash
+++ b/tests/reverse/linux-tarball-test.bash
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -eu
diff --git a/tests/sshfs-benchmark.bash b/tests/sshfs-benchmark.bash
index 4695f8d..2421f20 100755
--- a/tests/sshfs-benchmark.bash
+++ b/tests/sshfs-benchmark.bash
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -eu
diff --git a/tests/stress_tests/extractloop.bash b/tests/stress_tests/extractloop.bash
index 1f78a5e..714d2d7 100755
--- a/tests/stress_tests/extractloop.bash
+++ b/tests/stress_tests/extractloop.bash
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#
# Mount a gocryptfs filesystem somewhere on /tmp, then run two parallel
# infinite loops inside that do the following:
diff --git a/tests/stress_tests/fsstress-gocryptfs.bash b/tests/stress_tests/fsstress-gocryptfs.bash
index e6c3281..7e3f160 100755
--- a/tests/stress_tests/fsstress-gocryptfs.bash
+++ b/tests/stress_tests/fsstress-gocryptfs.bash
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#
# Mount a gocryptfs filesystem in /var/tmp and run fsstress against it
# in an infinite loop, only exiting on errors.
diff --git a/tests/stress_tests/pingpong.bash b/tests/stress_tests/pingpong.bash
index d0d21b3..4fd5ff2 100755
--- a/tests/stress_tests/pingpong.bash
+++ b/tests/stress_tests/pingpong.bash
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#
# Mounts two gocryptfs filesystems, "ping" and "pong" and moves the
# linux-3.0 kernel tree back and forth between them, checking integrity
diff --git a/tests/test_helpers/mount_unmount.go b/tests/test_helpers/mount_unmount.go
index 4abc432..3927dd5 100644
--- a/tests/test_helpers/mount_unmount.go
+++ b/tests/test_helpers/mount_unmount.go
@@ -35,7 +35,11 @@ type mountInfo struct {
// Contrary to InitFS(), you MUST passt "-extpass=echo test" (or another way for
// getting the master key) explicitly.
func Mount(c string, p string, showOutput bool, extraArgs ...string) error {
- args := []string{"-q", "-wpanic", "-nosyslog", "-fg", fmt.Sprintf("-notifypid=%d", os.Getpid())}
+ args := []string{"-q", "-nosyslog", "-fg", fmt.Sprintf("-notifypid=%d", os.Getpid())}
+ // We are warning-free on Linux, but not (yet) on other OS's
+ if runtime.GOOS == "linux" {
+ args = append(args, "-wpanic")
+ }
args = append(args, extraArgs...)
if _, isset := os.LookupEnv("FUSEDEBUG"); isset {
fmt.Println("FUSEDEBUG is set, enabling -fusedebug")