Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

guess the xorg path in tests #308

Merged
merged 4 commits into from
Apr 23, 2024
Merged

guess the xorg path in tests #308

merged 4 commits into from
Apr 23, 2024

Conversation

jat001
Copy link
Contributor

@jat001 jat001 commented Apr 23, 2024

No description provided.

@metalefty
Copy link
Member

@jat001
Copy link
Contributor Author

jat001 commented Apr 23, 2024

I wrote a loop to guess the xorg path

@jat001 jat001 changed the title On Arch Linux, Xorg is located at /usr/lib/Xorg guess the xorg path in tests Apr 23, 2024
tests/xorg-test-run.sh Outdated Show resolved Hide resolved
tests/xorg-test-run.sh Outdated Show resolved Hide resolved
@jat001 jat001 requested a review from matt335672 April 23, 2024 09:08
@matt335672
Copy link
Member

@jat001 - very sorry. The positional parameters are used for XORG_ARGS later in the file. I didn't check carefully enough.

I can give you a couple of options:-

  1. Move the new code below the line XORG_ARGS="$@"
  2. Try this patch which solves the problem a different way:-
--- a/tests/xorg-test-run.sh
+++ b/tests/xorg-test-run.sh
@@ -2,8 +2,8 @@
 
 # Test that Xorg can load the compiled modules
 
-# X server to run
-if [ -z "$XORG" ]; then
+FindXorg()
+{
     set -- \
         /usr/local/libexec/Xorg \
         /usr/libexec/Xorg \
@@ -13,14 +13,17 @@ if [ -z "$XORG" ]; then
 
     for path in "$@"; do
         if [ -x "$path" ]; then
-            XORG=$path
-            break
+            echo "$path"
+            exit
         fi
     done
 
-    if [ -z "$XORG" ]; then
-        XORG=Xorg
-    fi
+    echo "Xorg"
+}
+
+# X server to run
+if [ -z "$XORG" ]; then
+    XORG=$(FindXorg)
 fi
 
 # Client to connect to Xorg

Use whatever work best for you.

@jat001
Copy link
Contributor Author

jat001 commented Apr 23, 2024

@matt335672 that's why I don't like posix sh LOL

@matt335672 matt335672 merged commit 4c25520 into neutrinolabs:devel Apr 23, 2024
8 checks passed
@matt335672
Copy link
Member

Thanks @jat001. I really shouldn't propose changes without testing them.

sh is a bit of a pig to get right, but it's always there. It's made easier with tools like shellcheck (which we haven't used for this script). Only having one array available, and no associative arrays does make it only suitable for very simple tasks though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants