aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/flake.nix2
-rw-r--r--test/internal/testsuite/testsuite.go40
-rw-r--r--test/options.md1175
-rw-r--r--test/sharefs/configuration.nix44
-rw-r--r--test/sharefs/default.nix44
-rw-r--r--test/sharefs/main.go126
-rw-r--r--test/sharefs/test.py60
7 files changed, 166 insertions, 1325 deletions
diff --git a/test/flake.nix b/test/flake.nix
index 01a07f78..b106ec7a 100644
--- a/test/flake.nix
+++ b/test/flake.nix
@@ -55,8 +55,6 @@
withRace = true;
};
- sharefs = callPackage ./sharefs { inherit system self; };
-
formatting = runCommandLocal "check-formatting" { nativeBuildInputs = [ nixfmt ]; } ''
cd ${./.}
diff --git a/test/internal/testsuite/testsuite.go b/test/internal/testsuite/testsuite.go
new file mode 100644
index 00000000..4b70da34
--- /dev/null
+++ b/test/internal/testsuite/testsuite.go
@@ -0,0 +1,40 @@
+// Package testsuite provides many quick-and-dirty integration testing utilities.
+package testsuite
+
+import (
+ "log"
+ "os"
+ "os/exec"
+ "os/signal"
+ "syscall"
+)
+
+func init() {
+ log.SetFlags(0)
+ log.SetPrefix("testsuite: ")
+
+ if os.Geteuid() != 0 {
+ log.Fatal("this program must run as root")
+ }
+}
+
+// ReceiveSignals blocks until a termination signal arrives, and terminates.
+func ReceiveSignals() {
+ s := make(chan os.Signal, 3)
+ signal.Notify(s, os.Interrupt, syscall.SIGTERM, syscall.SIGHUP)
+ log.Fatalf("terminating on signal %s", <-s)
+}
+
+// MustRun runs command and terminates the testsuite on error.
+func MustRun(command ...string) {
+ cmd := exec.Command(command[0], command[1:]...)
+ cmd.Stdout, cmd.Stderr = os.Stdout, os.Stderr
+ if err := cmd.Run(); err != nil {
+ log.Fatal(err)
+ }
+}
+
+// MustRunAs wraps [MustRun] for sudo.
+func MustRunAs(username string, command ...string) {
+ MustRun(append([]string{"sudo", "-u", username}, command...)...)
+}
diff --git a/test/options.md b/test/options.md
deleted file mode 100644
index 6f6acddd..00000000
--- a/test/options.md
+++ /dev/null
@@ -1,1175 +0,0 @@
-## environment\.hakurei\.enable
-
-
-
-Whether to enable hakurei\.
-
-
-
-*Type:*
-boolean
-
-
-
-*Default:*
-
-```nix
-false
-```
-
-
-
-*Example:*
-
-```nix
-true
-```
-
-
-
-## environment\.hakurei\.package
-
-
-
-The hakurei package to use\.
-
-
-
-*Type:*
-package
-
-
-
-*Default:*
-
-```nix
-<derivation hakurei-static-x86_64-unknown-linux-musl-0.4.3>
-```
-
-
-
-## environment\.hakurei\.apps
-
-Declaratively configured hakurei apps\.
-
-
-
-*Type:*
-attribute set of (submodule)
-
-
-
-*Default:*
-
-```nix
-{ }
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.enablements\.dbus
-
-
-
-Whether to proxy D-Bus\.
-
-
-
-*Type:*
-null or boolean
-
-
-
-*Default:*
-
-```nix
-true
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.enablements\.pipewire
-
-
-
-Whether to share the PipeWire server via pipewire-pulse on a SecurityContext socket\.
-
-
-
-*Type:*
-null or boolean
-
-
-
-*Default:*
-
-```nix
-true
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.enablements\.wayland
-
-
-
-Whether to share the Wayland server via security-context-v1\.
-
-
-
-*Type:*
-null or boolean
-
-
-
-*Default:*
-
-```nix
-true
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.enablements\.x11
-
-
-
-Whether to share the X11 socket and allow connection\.
-
-
-
-*Type:*
-null or boolean
-
-
-
-*Default:*
-
-```nix
-false
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.packages
-
-
-
-List of extra packages to install via home-manager\.
-
-
-
-*Type:*
-list of package
-
-
-
-*Default:*
-
-```nix
-[ ]
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.args
-
-
-
-Custom args\.
-Setting this to null will default to script name\.
-
-
-
-*Type:*
-null or (list of string)
-
-
-
-*Default:*
-
-```nix
-null
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.command
-
-
-
-Command to run as the target user\.
-Setting this to null will default command to launcher name\.
-Has no effect when script is set\.
-
-
-
-*Type:*
-null or string
-
-
-
-*Default:*
-
-```nix
-null
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.dbus\.session
-
-
-
-D-Bus session bus custom configuration\.
-Setting this to null will enable built-in defaults\.
-
-
-
-*Type:*
-null or (function that evaluates to a(n) anything)
-
-
-
-*Default:*
-
-```nix
-null
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.dbus\.system
-
-
-
-D-Bus system bus custom configuration\.
-Setting this to null will disable the system bus proxy\.
-
-
-
-*Type:*
-null or anything
-
-
-
-*Default:*
-
-```nix
-null
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.devel
-
-
-
-Whether to enable debugging-related kernel interfaces\.
-
-
-
-*Type:*
-boolean
-
-
-
-*Default:*
-
-```nix
-false
-```
-
-
-
-*Example:*
-
-```nix
-true
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.device
-
-
-
-Whether to enable access to all devices\.
-
-
-
-*Type:*
-boolean
-
-
-
-*Default:*
-
-```nix
-false
-```
-
-
-
-*Example:*
-
-```nix
-true
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.env
-
-
-
-Environment variables to set for the initial process in the sandbox\.
-
-
-
-*Type:*
-null or (attribute set of string)
-
-
-
-*Default:*
-
-```nix
-null
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.extraConfig
-
-
-
-Extra home-manager configuration\.
-
-
-
-*Type:*
-anything
-
-
-
-*Default:*
-
-```nix
-{ }
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.extraPaths
-
-
-
-Extra paths to make available to the container\.
-
-
-
-*Type:*
-list of attribute set of anything
-
-
-
-*Default:*
-
-```nix
-[ ]
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.gpu
-
-
-
-Target process GPU and driver access\.
-Setting this to null will enable GPU whenever X or Wayland is enabled\.
-
-
-
-*Type:*
-null or boolean
-
-
-
-*Default:*
-
-```nix
-null
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.groups
-
-
-
-List of groups to inherit from the privileged user\.
-
-
-
-*Type:*
-list of string
-
-
-
-*Default:*
-
-```nix
-[ ]
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.hostAbstract
-
-
-
-Whether to enable share abstract unix socket scope\.
-
-
-
-*Type:*
-boolean
-
-
-
-*Default:*
-
-```nix
-false
-```
-
-
-
-*Example:*
-
-```nix
-true
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.hostNet
-
-
-
-Whether to enable share host net namespace\.
-
-
-
-*Type:*
-boolean
-
-
-
-*Default:*
-
-```nix
-true
-```
-
-
-
-*Example:*
-
-```nix
-true
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.identity
-
-
-
-Application identity\. Identity 0 is reserved for system services\.
-
-
-
-*Type:*
-integer between 1 and 9999 (both inclusive)
-
-
-
-## environment\.hakurei\.apps\.\<name>\.insecureWayland
-
-
-
-Whether to enable direct access to the Wayland socket\.
-
-
-
-*Type:*
-boolean
-
-
-
-*Default:*
-
-```nix
-false
-```
-
-
-
-*Example:*
-
-```nix
-true
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.mapRealUid
-
-
-
-Whether to enable mapping to priv-user uid\.
-
-
-
-*Type:*
-boolean
-
-
-
-*Default:*
-
-```nix
-false
-```
-
-
-
-*Example:*
-
-```nix
-true
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.multiarch
-
-
-
-Whether to enable multiarch kernel-level support\.
-
-
-
-*Type:*
-boolean
-
-
-
-*Default:*
-
-```nix
-false
-```
-
-
-
-*Example:*
-
-```nix
-true
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.name
-
-
-
-Name of the app’s launcher script\.
-
-
-
-*Type:*
-string
-
-
-
-## environment\.hakurei\.apps\.\<name>\.nix
-
-
-
-Whether to enable nix daemon access\.
-
-
-
-*Type:*
-boolean
-
-
-
-*Default:*
-
-```nix
-false
-```
-
-
-
-*Example:*
-
-```nix
-true
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.path
-
-
-
-Custom executable path\.
-Setting this to null will default to the start script\.
-
-
-
-*Type:*
-null or string
-
-
-
-*Default:*
-
-```nix
-null
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.schedPolicy
-
-
-
-Scheduling policy to set for the container\.
-The zero value retains the current scheduling policy\.
-
-
-
-*Type:*
-null or one of “fifo”, “rr”, “batch”, “idle”, “deadline”, “ext”
-
-
-
-*Default:*
-
-```nix
-null
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.schedPriority
-
-
-
-Scheduling priority to set for the container\.
-
-
-
-*Type:*
-null or integer between 1 and 99 (both inclusive)
-
-
-
-*Default:*
-
-```nix
-null
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.script
-
-
-
-Application launch script\.
-
-
-
-*Type:*
-null or string
-
-
-
-*Default:*
-
-```nix
-null
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.share
-
-
-
-Package containing share files\.
-Setting this to null will default package name to wrapper name\.
-
-
-
-*Type:*
-null or package
-
-
-
-*Default:*
-
-```nix
-null
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.shareRuntime
-
-
-
-Whether to enable sharing of XDG_RUNTIME_DIR between containers under the same identity\.
-
-
-
-*Type:*
-boolean
-
-
-
-*Default:*
-
-```nix
-false
-```
-
-
-
-*Example:*
-
-```nix
-true
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.shareTmpdir
-
-
-
-Whether to enable sharing of TMPDIR between containers under the same identity\.
-
-
-
-*Type:*
-boolean
-
-
-
-*Default:*
-
-```nix
-false
-```
-
-
-
-*Example:*
-
-```nix
-true
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.shareUid
-
-
-
-Whether to enable sharing identity with another application\.
-
-
-
-*Type:*
-boolean
-
-
-
-*Default:*
-
-```nix
-false
-```
-
-
-
-*Example:*
-
-```nix
-true
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.tty
-
-
-
-Whether to enable access to the controlling terminal\.
-
-
-
-*Type:*
-boolean
-
-
-
-*Default:*
-
-```nix
-false
-```
-
-
-
-*Example:*
-
-```nix
-true
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.useCommonPaths
-
-
-
-Whether to enable common extra paths\.
-
-
-
-*Type:*
-boolean
-
-
-
-*Default:*
-
-```nix
-true
-```
-
-
-
-*Example:*
-
-```nix
-true
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.userns
-
-
-
-Whether to enable user namespace creation\.
-
-
-
-*Type:*
-boolean
-
-
-
-*Default:*
-
-```nix
-false
-```
-
-
-
-*Example:*
-
-```nix
-true
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.verbose
-
-
-
-Whether to enable launchers with verbose output\.
-
-
-
-*Type:*
-boolean
-
-
-
-*Default:*
-
-```nix
-false
-```
-
-
-
-*Example:*
-
-```nix
-true
-```
-
-
-
-## environment\.hakurei\.apps\.\<name>\.wait_delay
-
-
-
-Duration to wait for after interrupting a container’s initial process in nanoseconds\.
-A negative value causes the container to be terminated immediately on cancellation\.
-Setting this to null defaults to five seconds\.
-
-
-
-*Type:*
-null or signed integer
-
-
-
-*Default:*
-
-```nix
-null
-```
-
-
-
-## environment\.hakurei\.commonPaths
-
-
-
-Common extra paths to make available to the container\.
-
-
-
-*Type:*
-list of attribute set of anything
-
-
-
-*Default:*
-
-```nix
-[ ]
-```
-
-
-
-## environment\.hakurei\.extraHomeConfig
-
-
-
-Extra home-manager configuration to merge with all target users\.
-
-
-
-*Type:*
-anything
-
-
-
-## environment\.hakurei\.hsuPackage
-
-
-
-The hsu package to use\.
-
-
-
-*Type:*
-package
-
-
-
-*Default:*
-
-```nix
-<derivation hakurei-hsu-0.4.3>
-```
-
-
-
-## environment\.hakurei\.sharefs\.package
-
-
-
-The sharefs package to use\.
-
-
-
-*Type:*
-package
-
-
-
-*Default:*
-
-```nix
-<derivation sharefs>
-```
-
-
-
-## environment\.hakurei\.sharefs\.group
-
-
-
-Name of the group to run the sharefs daemon as\.
-
-
-
-*Type:*
-string
-
-
-
-*Default:*
-
-```nix
-"sharefs"
-```
-
-
-
-## environment\.hakurei\.sharefs\.name
-
-
-
-Host path to mount sharefs on\.
-
-
-
-*Type:*
-string
-
-
-
-*Default:*
-
-```nix
-"/sdcard"
-```
-
-
-
-## environment\.hakurei\.sharefs\.source
-
-
-
-Writable backing directory\. Setting this to null disables sharefs\.
-
-
-
-*Type:*
-null or string
-
-
-
-*Default:*
-
-```nix
-null
-```
-
-
-
-## environment\.hakurei\.sharefs\.user
-
-
-
-Name of the user to run the sharefs daemon as\.
-
-
-
-*Type:*
-string
-
-
-
-*Default:*
-
-```nix
-"sharefs"
-```
-
-
-
-## environment\.hakurei\.shell
-
-
-
-Absolute path to preferred shell\.
-
-
-
-*Type:*
-string
-
-
-
-*Default:*
-
-```nix
-"/run/current-system/sw/bin/bash"
-```
-
-
-
-## environment\.hakurei\.stateDir
-
-
-
-The state directory where app home directories are stored\.
-
-
-
-*Type:*
-string
-
-
-
-## environment\.hakurei\.users
-
-
-
-Users allowed to spawn hakurei apps and their corresponding hakurei identity\.
-
-
-
-*Type:*
-attribute set of integer between 0 and 99 (both inclusive)
-
-
-
-*Default:*
-
-```nix
-{ }
-```
-
-
diff --git a/test/sharefs/configuration.nix b/test/sharefs/configuration.nix
deleted file mode 100644
index 05d67dcb..00000000
--- a/test/sharefs/configuration.nix
+++ /dev/null
@@ -1,44 +0,0 @@
-{ pkgs, ... }:
-{
- users.users = {
- alice = {
- isNormalUser = true;
- description = "Alice Foobar";
- password = "foobar";
- uid = 1000;
- };
- };
-
- home-manager.users.alice.home.stateVersion = "24.11";
-
- # Automatically login on tty1 as a normal user:
- services.getty.autologinUser = "alice";
-
- environment = {
- # For benchmarking sharefs:
- systemPackages = [ pkgs.fsmark ];
- };
-
- virtualisation = {
- # Hopefully reduces spurious test failures:
- memorySize = if pkgs.stdenv.hostPlatform.is32bit then 2046 else 8192;
-
- diskSize = 6 * 1024;
-
- qemu.options = [
- # Increase test performance:
- "-smp 16"
- ];
- };
-
- environment.hakurei = rec {
- enable = true;
- stateDir = "/var/lib/hakurei";
- sharefs.source = "${stateDir}/sdcard";
- users.alice = 0;
-
- extraHomeConfig = {
- home.stateVersion = "23.05";
- };
- };
-}
diff --git a/test/sharefs/default.nix b/test/sharefs/default.nix
deleted file mode 100644
index e963eaa6..00000000
--- a/test/sharefs/default.nix
+++ /dev/null
@@ -1,44 +0,0 @@
-{
- testers,
-
- system,
- self,
-}:
-testers.nixosTest {
- name = "sharefs";
- nodes.machine =
- { options, pkgs, ... }:
- let
- fhs =
- let
- hakurei = options.environment.hakurei.package.default;
- in
- pkgs.buildFHSEnv {
- pname = "hakurei-fhs";
- inherit (hakurei) version;
- targetPkgs = _: hakurei.targetPkgs;
- extraOutputsToInstall = [ "dev" ];
- profile = ''
- export PKG_CONFIG_PATH="/usr/share/pkgconfig:$PKG_CONFIG_PATH"
- '';
- };
- in
- {
- environment.systemPackages = [
- # For go tests:
- (pkgs.writeShellScriptBin "sharefs-workload-hakurei-tests" ''
- cp -r "${self.packages.${system}.hakurei.src}" "/sdcard/hakurei" && cd "/sdcard/hakurei"
- ${fhs}/bin/hakurei-fhs -c 'ROSA_SKIP_BINFMT=1 CC="clang -O3 -Werror" go test ./...'
- '')
- ];
-
- imports = [
- ./configuration.nix
-
- self.nixosModules.hakurei
- self.inputs.home-manager.nixosModules.home-manager
- ];
- };
-
- testScript = builtins.readFile ./test.py;
-}
diff --git a/test/sharefs/main.go b/test/sharefs/main.go
new file mode 100644
index 00000000..536a61b3
--- /dev/null
+++ b/test/sharefs/main.go
@@ -0,0 +1,126 @@
+//go:build testsuite
+
+// The sharefs test program checks cli behaviour and exercises the filesystem
+// implemented by cmd/sharefs using fs_mark.
+package main
+
+import (
+ "errors"
+ "log"
+ "os"
+ "os/exec"
+ "slices"
+ "strings"
+
+ "hakurei.app/test/internal/testsuite"
+)
+
+// checkBadOpts invokes cmd/sharefs with the specified options and compares
+// the resulting error message.
+func checkBadOpts(username, opts, want string) {
+ var buf strings.Builder
+ buf.Grow(len(want))
+
+ sudo := []string{"sudo", "-u", username, "-i", "--"}
+ if username == "root" {
+ sudo = nil
+ }
+
+ a := slices.Concat(sudo, []string{
+ "sharefs",
+ "-f",
+ "-o", "source=/etc," + opts,
+ "/mnt",
+ })
+ cmd := exec.Command(a[0], a[1:]...)
+ cmd.Stderr = &buf
+ err := cmd.Run()
+ if err == nil {
+ log.Fatalf("opts=%q, unexpected success", opts)
+ }
+ if e, ok := errors.AsType[*exec.ExitError](err); !ok {
+ log.Fatal(err)
+ } else if !e.Exited() {
+ log.Fatal(e)
+ }
+
+ if got := buf.String(); got != want {
+ log.Fatalf("opts=%q\n\t got:%q\n\twant:%q", opts, got, want)
+ }
+}
+
+func main() {
+ go testsuite.ReceiveSignals()
+
+ if err := os.Mkdir("result", 0755); err != nil {
+ log.Fatal(err)
+ }
+
+ if len(os.Args) != 2 {
+ log.Fatal("expecting 1 argument")
+ }
+ username := os.Args[1]
+
+ done := make(chan struct{})
+ go func() {
+ defer close(done)
+
+ testsuite.MustRun(
+ "fs_mark",
+ "-v",
+ "-d", "/sdcard/fs_mark",
+ "-l", "result/fs_mark.log",
+ )
+ }()
+
+ log.Println("checking malformed setuid/setgid representation")
+ checkBadOpts(username, "setuid=ff", "sharefs: invalid value for option setuid\n")
+ checkBadOpts(username, "setgid=ff", "sharefs: invalid value for option setgid\n")
+
+ log.Println("checking bounds check for setuid/setgid")
+ checkBadOpts(username, "setuid=0", "sharefs: invalid value for option setuid\n")
+ checkBadOpts(username, "setgid=0", "sharefs: invalid value for option setgid\n")
+ checkBadOpts(username, "setuid=-1", "sharefs: invalid value for option setuid\n")
+ checkBadOpts(username, "setgid=-1", "sharefs: invalid value for option setgid\n")
+
+ log.Println("checking non-root setuid/setgid")
+ checkBadOpts(username, "setuid=1023", "sharefs: setuid and setgid has no effect when not starting as root\n")
+ checkBadOpts(username, "setgid=1023", "sharefs: setuid and setgid has no effect when not starting as root\n")
+ checkBadOpts(username, "setuid=1023,setgid=1023", "sharefs: setuid and setgid has no effect when not starting as root\n")
+ checkBadOpts(username, "mkdir", "sharefs: mkdir has no effect when not starting as root\n")
+
+ log.Println("checking root without setuid/setgid")
+ checkBadOpts("root", "allow_other", "sharefs: setuid and setgid must not be 0\n")
+ checkBadOpts("root", "setuid=1023", "sharefs: setuid and setgid must not be 0\n")
+ checkBadOpts("root", "setgid=1023", "sharefs: setuid and setgid must not be 0\n")
+
+ log.Println("verifying mount point")
+ if err := os.Remove("/mnt"); err != nil {
+ log.Fatal(err)
+ }
+
+ log.Println("checking unprivileged mount/unmount")
+ testsuite.MustRunAs(username, "-i", "mkdir", "/tmp/sdcard", "/tmp/persistent")
+ testsuite.MustRunAs(username, "-i", "sharefs", "-o", "source=/tmp/persistent", "/tmp/sdcard")
+ testsuite.MustRunAs(username, "-i", "touch", "/tmp/sdcard/check")
+ testsuite.MustRunAs(username, "-i", "umount", "/tmp/sdcard")
+ testsuite.MustRunAs(username, "-i", "rm", "/tmp/persistent/check")
+ testsuite.MustRunAs(username, "-i", "rmdir", "/tmp/sdcard", "/tmp/persistent")
+
+ log.Println("waiting for fs_mark to complete")
+ <-done
+
+ const (
+ backingDir = "/var/lib/sdcard"
+ sharefsUser = "media_rw"
+ )
+ log.Println("checking permissions")
+ testsuite.MustRunAs(sharefsUser, "touch", backingDir+"/fs_mark/.check")
+ testsuite.MustRunAs(sharefsUser, "rm", backingDir+"/fs_mark/.check")
+ testsuite.MustRunAs(username, "-i", "rm", "-rf", "/sdcard/fs_mark")
+ if _, err := os.ReadDir(backingDir + "/fs_mark"); err == nil {
+ log.Fatal("fs_mark directory was not removed")
+ } else if !errors.Is(err, os.ErrNotExist) {
+ log.Fatal(err)
+ }
+}
diff --git a/test/sharefs/test.py b/test/sharefs/test.py
deleted file mode 100644
index 4b925c9c..00000000
--- a/test/sharefs/test.py
+++ /dev/null
@@ -1,60 +0,0 @@
-start_all()
-machine.wait_for_unit("multi-user.target")
-
-# To check sharefs version:
-print(machine.succeed("sharefs -V"))
-
-# Make sure sharefs started:
-machine.wait_for_unit("sdcard.mount")
-
-machine.succeed("mkdir /mnt")
-def check_bad_opts_output(opts, want, source="/etc", privileged=False):
- output = machine.fail(("" if privileged else "sudo -u alice -i ") + f"sharefs -f -o source={source},{opts} /mnt 2>&1")
- if output != want:
- raise Exception(f"unexpected output: {output}")
-
-# Malformed setuid/setgid representation:
-check_bad_opts_output("setuid=ff", "sharefs: invalid value for option setuid\n")
-check_bad_opts_output("setgid=ff", "sharefs: invalid value for option setgid\n")
-
-# Bounds check for setuid/setgid:
-check_bad_opts_output("setuid=0", "sharefs: invalid value for option setuid\n")
-check_bad_opts_output("setgid=0", "sharefs: invalid value for option setgid\n")
-check_bad_opts_output("setuid=-1", "sharefs: invalid value for option setuid\n")
-check_bad_opts_output("setgid=-1", "sharefs: invalid value for option setgid\n")
-
-# Non-root setuid/setgid:
-check_bad_opts_output("setuid=1023", "sharefs: setuid and setgid has no effect when not starting as root\n")
-check_bad_opts_output("setgid=1023", "sharefs: setuid and setgid has no effect when not starting as root\n")
-check_bad_opts_output("setuid=1023,setgid=1023", "sharefs: setuid and setgid has no effect when not starting as root\n")
-check_bad_opts_output("mkdir", "sharefs: mkdir has no effect when not starting as root\n")
-
-# Starting as root without setuid/setgid:
-check_bad_opts_output("allow_other", "sharefs: setuid and setgid must not be 0\n", privileged=True)
-check_bad_opts_output("setuid=1023", "sharefs: setuid and setgid must not be 0\n", privileged=True)
-check_bad_opts_output("setgid=1023", "sharefs: setuid and setgid must not be 0\n", privileged=True)
-
-# Make sure nothing actually got mounted:
-machine.fail("umount /mnt")
-machine.succeed("rmdir /mnt")
-
-# Unprivileged mount/unmount:
-machine.succeed("sudo -u alice -i mkdir /home/alice/{sdcard,persistent}")
-machine.succeed("sudo -u alice -i sharefs -o source=/home/alice/persistent /home/alice/sdcard")
-machine.succeed("sudo -u alice -i touch /home/alice/sdcard/check")
-machine.succeed("sudo -u alice -i umount /home/alice/sdcard")
-machine.succeed("sudo -u alice -i rm /home/alice/persistent/check")
-machine.succeed("sudo -u alice -i rmdir /home/alice/{sdcard,persistent}")
-
-# Benchmark sharefs:
-machine.succeed("fs_mark -v -d /sdcard/fs_mark -l /tmp/fs_log.txt")
-machine.copy_from_vm("/tmp/fs_log.txt", "")
-
-# Check permissions:
-machine.succeed("sudo -u sharefs touch /var/lib/hakurei/sdcard/fs_mark/.check")
-machine.succeed("sudo -u sharefs rm /var/lib/hakurei/sdcard/fs_mark/.check")
-machine.succeed("sudo -u alice rm -rf /sdcard/fs_mark")
-machine.fail("ls /var/lib/hakurei/sdcard/fs_mark")
-
-# Run hakurei tests on sharefs:
-machine.succeed("sudo -u alice -i sharefs-workload-hakurei-tests")