skip userns test in schroot as well
authorShengjing Zhu <zhsj@debian.org>
Fri, 5 Feb 2021 13:21:45 +0000 (21:21 +0800)
committerWilliam 'jawn-smith' Wilson <jawn-smith@ubuntu.com>
Tue, 6 Dec 2022 19:39:48 +0000 (19:39 +0000)
When schroot is using overlayfs, it fails to detect it as chroot.

Gbp-Pq: Name 0004-skip-userns-test-in-schroot-as-well.patch

src/syscall/exec_linux_test.go

index 0ec9c4db0f182e7ee2126731b39261565c935d75..cabaaf991833f6f5e7d94f241c582ae8a48f4f33 100644 (file)
@@ -32,6 +32,10 @@ func isLXC() bool {
        return os.Getenv("container") == "lxc"
 }
 
+func isSchroot() bool {
+       return os.Getenv("SCHROOT_SESSION_ID") != ""
+}
+
 func skipInContainer(t *testing.T) {
        // TODO: the callers of this func are using this func to skip
        // tests when running as some sort of "fake root" that's uid 0
@@ -47,6 +51,9 @@ func skipInContainer(t *testing.T) {
        if isLXC() {
                t.Skip("skip this test in LXC container")
        }
+       if isSchroot() {
+               t.Skip("skip this test in Schroot container")
+       }
 }
 
 func skipNoUserNamespaces(t *testing.T) {