diff options
author | Povilas Kanapickas <povilas@radix.lt> | 2021-02-08 02:39:05 +0200 |
---|---|---|
committer | Povilas Kanapickas <povilas@radix.lt> | 2021-02-08 02:42:31 +0200 |
commit | 2b01b2250dd265acd2317e076eb6511f8b27b2ab (patch) | |
tree | 07a2c7b64df8d942ccf2c14863be3d055381fb62 | |
parent | a8264cbbd94c70d0a3a3887d522a73c5be4a3912 (diff) |
Add a script to run tests in isolated environment
-rw-r--r-- | README.md | 12 | ||||
-rwxr-xr-x | start-unshare-impl.sh | 19 | ||||
-rwxr-xr-x | start-unshare.sh | 9 |
3 files changed, 29 insertions, 11 deletions
@@ -19,17 +19,7 @@ All tests except the input and video module load tests can be run inside a conta This allows to run the tests in a regular development machine with convenient debugging and fast turnaround. The only prerequisite is root permissions. -The most convenient way to run the tests is doing the following as root: - -``` -$ unshare --ipc --mount --mount-proc --net --pid --fork /bin/bash - # then, in the newly opened shell session, perform the following -$ mkdir -p empty -$ mount --bind empty /dev -$ mount --bind empty /sys - # now the tests can be run -``` - +The most convenient way to run the tests is running `./start-unshare.sh` as root. This creates a bare-bones environment that shares the filesystem with the rest of the system, but is otherwise isolated from it. This allows running additional X servers without affecting the primary X server running on the machine. diff --git a/start-unshare-impl.sh b/start-unshare-impl.sh new file mode 100755 index 0000000..bb1bf8b --- /dev/null +++ b/start-unshare-impl.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +if [[ -z $IN_CONTAINER ]]; then + echo "Please use start-container.sh script" + exit +fi + +function cleanup { + rm -rf _xorg_integration_test_empty +} + +trap cleanup EXIT + +mkdir -p _xorg_integration_test_empty + +mount --bind _xorg_integration_test_empty /dev +mount --bind _xorg_integration_test_empty /sys + +/bin/bash diff --git a/start-unshare.sh b/start-unshare.sh new file mode 100755 index 0000000..f7d253a --- /dev/null +++ b/start-unshare.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +if (( $EUID != 0 )); then + echo "Please run this script as root" + exit +fi + +unshare --ipc --mount --mount-proc --net --pid --fork \ + /bin/bash -c "IN_CONTAINER=1 ./start-unshare-impl.sh" |