]> ruderich.org/simon Gitweb - safcm/safcm.git/commitdiff
Fix tests on FreeBSD and OpenBSD
authorSimon Ruderich <simon@ruderich.org>
Sun, 19 Oct 2025 08:21:00 +0000 (10:21 +0200)
committerSimon Ruderich <simon@ruderich.org>
Sun, 19 Oct 2025 08:21:00 +0000 (10:21 +0200)
Broken in 5141405 (Update dependencies, static checkers and Go to 1.24,
2025-10-17) which switched from manually creating the directory to using
t.TempDir().

remote/sync/files_test.go

index 9376413afbc58efb818d56a025039057a3a556c2..1803e08d78a0d80aa5943c90df27e18610c1ab00 100644 (file)
@@ -806,6 +806,12 @@ func TestSyncFiles(t *testing.T) {
                        if err != nil {
                                t.Fatal(err)
                        }
+                       // On BSD systems directories created under /tmp inherit the wheel
+                       // group which would break the tests.
+                       err = os.Chown(path, os.Getuid(), os.Getgid())
+                       if err != nil {
+                               t.Fatal(err)
+                       }
                        t.Chdir(path)
 
                        if tc.prepare != nil {
@@ -2542,6 +2548,12 @@ file
                        if err != nil {
                                t.Fatal(err)
                        }
+                       // On BSD systems directories created under /tmp inherit the wheel
+                       // group which would break the tests.
+                       err = os.Chown(path, os.Getuid(), os.Getgid())
+                       if err != nil {
+                               t.Fatal(err)
+                       }
                        t.Chdir(path)
 
                        if tc.prepare != nil {