| 1 | #!/bin/sh |
| 2 | # Exercise the installed compiler and graphics paths from an ordinary account. |
| 3 | set -eu |
| 4 | export PATH=/bin:/usr/bin:/sbin:/usr/sbin LC_ALL=C |
| 5 | fixtures=/usr/share/vinix-toolchain-test |
| 6 | |
| 7 | if [ "$(id -u)" = 0 ]; then |
| 8 | trap '/sbin/poweroff -f' EXIT |
| 9 | mkdir -p /tmp/.X11-unix |
| 10 | chmod 1777 /tmp/.X11-unix |
| 11 | /bin/su -s /bin/sh -c "exec /bin/sh $fixtures/public-modes.sh" nobody |
| 12 | echo 'Vinix verified the compiler and X11 paths as an ordinary user' |
| 13 | echo 'VPAC FIXTURE GUEST PASS' |
| 14 | exit 0 |
| 15 | fi |
| 16 | |
| 17 | test "$(id -u)" = 65534 |
| 18 | test "$(id -g)" = 65534 |
| 19 | arch=$(uname -m) |
| 20 | test -x "/usr/$arch-linux-musl/bin/as" |
| 21 | for path in "/usr/$arch-linux-musl/lib/ldscripts/"*.x \ |
| 22 | /usr/lib/bfd-plugins/liblto_plugin.so \ |
| 23 | /usr/lib/xorg/modules/drivers/fbdev_drv.so \ |
| 24 | /usr/lib/xorg/modules/extensions/libglx.so \ |
| 25 | /usr/lib/xorg/modules/input/inputtest_drv.so \ |
| 26 | /usr/lib/cmake/FreeGLUT/FreeGLUTConfig.cmake \ |
| 27 | /etc/X11/xinit/xinitrc |
| 28 | do |
| 29 | test -r "$path" || { echo "ordinary user cannot read $path" >&2; exit 1; } |
| 30 | done |
| 31 | |
| 32 | HOME=$(mktemp -d /tmp/vinix-public-modes.XXXXXX) |
| 33 | export HOME |
| 34 | cd "$HOME" |
| 35 | cat >headers.c <<'VINIX_PUBLIC_HEADERS' |
| 36 | #include <limits.h> |
| 37 | #if defined(__x86_64__) |
| 38 | #include <immintrin.h> |
| 39 | #elif defined(__aarch64__) |
| 40 | #include <arm_neon.h> |
| 41 | #endif |
| 42 | |
| 43 | int main(void) |
| 44 | { |
| 45 | return CHAR_BIT != 8; |
| 46 | } |
| 47 | VINIX_PUBLIC_HEADERS |
| 48 | cc -std=c17 -Wall -Wextra -Werror headers.c -o headers |
| 49 | ./headers |
| 50 | cp "$fixtures/Makefile" "$fixtures/graphite.c" "$fixtures/optimizers.c" . |
| 51 | make -j1 optimizers |
| 52 | ./optimizers |
| 53 | echo 'Vinix compiled with the installed GCC headers and LTO tools as an ordinary user' |
| 54 | /bin/sh "$fixtures/graphics.sh" |
| 55 | |