aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcrossbuild.bash10
-rwxr-xr-xtest.bash8
2 files changed, 16 insertions, 2 deletions
diff --git a/crossbuild.bash b/crossbuild.bash
index 25eeb91..a9fc6ae 100755
--- a/crossbuild.bash
+++ b/crossbuild.bash
@@ -7,9 +7,13 @@ function build {
go build -tags without_openssl -o /dev/null
}
-set -eux
+function compile_tests {
+ for i in $(go list ./...) ; do
+ go test -c -tags without_openssl -o /dev/null "$i" > /dev/null
+ done
+}
-cd "$(dirname "$0")"
+set -eux
export GO111MODULE=on
export CGO_ENABLED=0
@@ -22,6 +26,8 @@ GOOS=linux GOARCH=arm64 build
# MacOS on Intel
GOOS=darwin GOARCH=amd64 build
+# Catch tests that don't work on MacOS (takes a long time so we only run it once)
+time GOOS=darwin GOARCH=amd64 compile_tests
# MacOS on Apple Silicon M1.
# Go 1.16 added support for the M1 and added ios/arm64,
diff --git a/test.bash b/test.bash
index efc6456..6289072 100755
--- a/test.bash
+++ b/test.bash
@@ -93,4 +93,12 @@ if find . -type f -name \*.go -print0 | xargs -0 grep -E 'syscall.(Setegid|Seteu
exit 1
fi
+if find . -type f -name \*.go -print0 | xargs -0 grep '\.Creat('; then
+ # MacOS does not have syscall.Creat(). Creat() is equivalent to Open(..., O_CREAT|O_WRONLY|O_TRUNC, ...),
+ # but usually you want O_EXCL instead of O_TRUNC because it is safer, so that's what we suggest
+ # instead.
+ echo "$MYNAME: Please use Open(..., O_CREAT|O_WRONLY|O_EXCL, ...) instead of Creat()! https://github.com/rfjakob/gocryptfs/issues/623"
+ exit 1
+fi
+
) 200> "$LOCKFILE"