me

/

vinix-ports Public
382 commits 0 issues 0 pull requests 1 contributor Discussions Projects Snippets LOC history Platform CI

Test the installed compiler and X11 from an ordinary account

diviocity committed 4 days ago · 039afca9c1067d84a02b25017e81e25d2071bf28 View patch
Unverified signature 2 files changed +55 -1
tests/x11/graphics.sh +1 -1

@@ -11,7 +11,7 @@ finish() {

1111 if [ -f /tmp/xvfb-glx.log ]; then cat /tmp/xvfb-glx.log; fi

1212 fi

1313 if [ -n "$server" ]; then kill "$server" 2>/dev/null || true; fi

14- /sbin/poweroff -f

14+ if [ "$(id -u)" = 0 ]; then /sbin/poweroff -f; fi

1515}

1616trap finish EXIT

1717

tests/x11/public-modes.sh new file +54 -0

@@ -0,0 +1,54 @@

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"