build/qemu-wrap
author Sandor Molnar <smolnar@mozilla.com>
Fri, 11 Jul 2025 19:57:29 +0300 (13 hours ago)
changeset 796221 8ba6984a5604ac7dcf50325b1a0ebadf9e305d22
parent 113444 1a53df18c076a7388496b9d78cceb855ce793735
permissions -rwxr-xr-x
Revert "Bug 1972411 - give gnome-shell and pipewire more time to start, and retry the task if we time out. r=jmaher" for causing linux perma failures This reverts commit 2b905fe7199c9210434f7c7f8326b57025c91c55. Revert "Bug 1972411 - make /builds/worker/fetches a volume in the test docker image. r=releng-reviewers,Eijebong" This reverts commit 9d15aecaf6a08b98d3c47f2d0e644e35341b2520.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
113444
1a53df18c076a7388496b9d78cceb855ce793735 Add in support for running a cross-shell directly in qemu (bug 807936, r=ted)
Marty Rosenberg <mrosenberg@mozilla.com>
parents:
diff changeset
     1
#!/bin/bash
1a53df18c076a7388496b9d78cceb855ce793735 Add in support for running a cross-shell directly in qemu (bug 807936, r=ted)
Marty Rosenberg <mrosenberg@mozilla.com>
parents:
diff changeset
     2
# this script creates a wrapper shell script for an executable.  The idea is the actual executable cannot be
1a53df18c076a7388496b9d78cceb855ce793735 Add in support for running a cross-shell directly in qemu (bug 807936, r=ted)
Marty Rosenberg <mrosenberg@mozilla.com>
parents:
diff changeset
     3
# executed natively (it was cross compiled), but we want to run tests natively.  Running this script
1a53df18c076a7388496b9d78cceb855ce793735 Add in support for running a cross-shell directly in qemu (bug 807936, r=ted)
Marty Rosenberg <mrosenberg@mozilla.com>
parents:
diff changeset
     4
# as part of the compilation process will move the non-native executable to a new location, and replace it
1a53df18c076a7388496b9d78cceb855ce793735 Add in support for running a cross-shell directly in qemu (bug 807936, r=ted)
Marty Rosenberg <mrosenberg@mozilla.com>
parents:
diff changeset
     5
# with a script that will run it under qemu.
1a53df18c076a7388496b9d78cceb855ce793735 Add in support for running a cross-shell directly in qemu (bug 807936, r=ted)
Marty Rosenberg <mrosenberg@mozilla.com>
parents:
diff changeset
     6
while [[ -n $1 ]]; do
1a53df18c076a7388496b9d78cceb855ce793735 Add in support for running a cross-shell directly in qemu (bug 807936, r=ted)
Marty Rosenberg <mrosenberg@mozilla.com>
parents:
diff changeset
     7
    case $1 in
1a53df18c076a7388496b9d78cceb855ce793735 Add in support for running a cross-shell directly in qemu (bug 807936, r=ted)
Marty Rosenberg <mrosenberg@mozilla.com>
parents:
diff changeset
     8
        --qemu) QEMU="$2"; shift 2;;
1a53df18c076a7388496b9d78cceb855ce793735 Add in support for running a cross-shell directly in qemu (bug 807936, r=ted)
Marty Rosenberg <mrosenberg@mozilla.com>
parents:
diff changeset
     9
        --libdir) LIBDIR="$2"; shift 2;;
1a53df18c076a7388496b9d78cceb855ce793735 Add in support for running a cross-shell directly in qemu (bug 807936, r=ted)
Marty Rosenberg <mrosenberg@mozilla.com>
parents:
diff changeset
    10
        --ld) LD="$2"; shift 2;;
1a53df18c076a7388496b9d78cceb855ce793735 Add in support for running a cross-shell directly in qemu (bug 807936, r=ted)
Marty Rosenberg <mrosenberg@mozilla.com>
parents:
diff changeset
    11
        *) exe="$1"; shift;;
1a53df18c076a7388496b9d78cceb855ce793735 Add in support for running a cross-shell directly in qemu (bug 807936, r=ted)
Marty Rosenberg <mrosenberg@mozilla.com>
parents:
diff changeset
    12
    esac
1a53df18c076a7388496b9d78cceb855ce793735 Add in support for running a cross-shell directly in qemu (bug 807936, r=ted)
Marty Rosenberg <mrosenberg@mozilla.com>
parents:
diff changeset
    13
done
1a53df18c076a7388496b9d78cceb855ce793735 Add in support for running a cross-shell directly in qemu (bug 807936, r=ted)
Marty Rosenberg <mrosenberg@mozilla.com>
parents:
diff changeset
    14
if [[ -z $LIBDIR ]]; then
1a53df18c076a7388496b9d78cceb855ce793735 Add in support for running a cross-shell directly in qemu (bug 807936, r=ted)
Marty Rosenberg <mrosenberg@mozilla.com>
parents:
diff changeset
    15
    echo "You need to specify a directory for the cross libraries when you configure the shell"
1a53df18c076a7388496b9d78cceb855ce793735 Add in support for running a cross-shell directly in qemu (bug 807936, r=ted)
Marty Rosenberg <mrosenberg@mozilla.com>
parents:
diff changeset
    16
    echo "You can do this with --with-cross-lib="
1a53df18c076a7388496b9d78cceb855ce793735 Add in support for running a cross-shell directly in qemu (bug 807936, r=ted)
Marty Rosenberg <mrosenberg@mozilla.com>
parents:
diff changeset
    17
    exit 1
1a53df18c076a7388496b9d78cceb855ce793735 Add in support for running a cross-shell directly in qemu (bug 807936, r=ted)
Marty Rosenberg <mrosenberg@mozilla.com>
parents:
diff changeset
    18
fi
1a53df18c076a7388496b9d78cceb855ce793735 Add in support for running a cross-shell directly in qemu (bug 807936, r=ted)
Marty Rosenberg <mrosenberg@mozilla.com>
parents:
diff changeset
    19
LD=${LD:-$LIBDIR/ld-linux.so.3}
1a53df18c076a7388496b9d78cceb855ce793735 Add in support for running a cross-shell directly in qemu (bug 807936, r=ted)
Marty Rosenberg <mrosenberg@mozilla.com>
parents:
diff changeset
    20
mv $exe $exe.target
1a53df18c076a7388496b9d78cceb855ce793735 Add in support for running a cross-shell directly in qemu (bug 807936, r=ted)
Marty Rosenberg <mrosenberg@mozilla.com>
parents:
diff changeset
    21
# Just hardcode the path to the executable.  It'll be pretty obvious if it is doing the wrong thing.
1a53df18c076a7388496b9d78cceb855ce793735 Add in support for running a cross-shell directly in qemu (bug 807936, r=ted)
Marty Rosenberg <mrosenberg@mozilla.com>
parents:
diff changeset
    22
1a53df18c076a7388496b9d78cceb855ce793735 Add in support for running a cross-shell directly in qemu (bug 807936, r=ted)
Marty Rosenberg <mrosenberg@mozilla.com>
parents:
diff changeset
    23
echo $'#!/bin/bash\n' $QEMU -E LD_LIBRARY_PATH="${LIBDIR}" "$LD" "$(readlink -f "$exe.target")" '"$@"' >"$exe"
1a53df18c076a7388496b9d78cceb855ce793735 Add in support for running a cross-shell directly in qemu (bug 807936, r=ted)
Marty Rosenberg <mrosenberg@mozilla.com>
parents:
diff changeset
    24
chmod +x $exe