• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2
3# Second-stage init, used to set up devices and our job environment before
4# running tests.
5
6. /set-job-env-vars.sh
7
8set -ex
9
10# Set up any devices required by the jobs
11[ -z "$HWCI_KERNEL_MODULES" ] || (echo -n $HWCI_KERNEL_MODULES | xargs -d, -n1 /usr/sbin/modprobe)
12
13# Fix prefix confusion: the build installs to $CI_PROJECT_DIR, but we expect
14# it in /install
15ln -sf $CI_PROJECT_DIR/install /install
16export LD_LIBRARY_PATH=/install/lib
17export LIBGL_DRIVERS_PATH=/install/lib/dri
18
19# Store Mesa's disk cache under /tmp, rather than sending it out over NFS.
20export XDG_CACHE_HOME=/tmp
21
22# Make sure Python can find all our imports
23export PYTHONPATH=$(python3 -c "import sys;print(\":\".join(sys.path))")
24
25if [ "$HWCI_FREQ_MAX" = "true" ]; then
26  # Ensure initialization of the DRM device (needed by MSM)
27  head -0 /dev/dri/renderD128
28
29  # Disable GPU frequency scaling
30  DEVFREQ_GOVERNOR=`find /sys/devices -name governor | grep gpu || true`
31  test -z "$DEVFREQ_GOVERNOR" || echo performance > $DEVFREQ_GOVERNOR || true
32
33  # Disable CPU frequency scaling
34  echo performance | tee -a /sys/devices/system/cpu/cpufreq/policy*/scaling_governor || true
35
36  # Disable GPU runtime power management
37  GPU_AUTOSUSPEND=`find /sys/devices -name autosuspend_delay_ms | grep gpu | head -1`
38  test -z "$GPU_AUTOSUSPEND" || echo -1 > $GPU_AUTOSUSPEND || true
39fi
40
41# Start a little daemon to capture the first devcoredump we encounter.  (They
42# expire after 5 minutes, so we poll for them).
43./capture-devcoredump.sh &
44
45# If we want Xorg to be running for the test, then we start it up before the
46# HWCI_TEST_SCRIPT because we need to use xinit to start X (otherwise
47# without using -displayfd you can race with Xorg's startup), but xinit will eat
48# your client's return code
49if [ -n "$HWCI_START_XORG" ]; then
50  echo "touch /xorg-started; sleep 100000" > /xorg-script
51  env \
52    xinit /bin/sh /xorg-script -- /usr/bin/Xorg -noreset -s 0 -dpms -logfile /Xorg.0.log &
53
54  # Wait for xorg to be ready for connections.
55  for i in 1 2 3 4 5; do
56    if [ -e /xorg-started ]; then
57      break
58    fi
59    sleep 5
60  done
61  export DISPLAY=:0
62fi
63
64RESULT=fail
65if sh $HWCI_TEST_SCRIPT; then
66  RESULT=pass
67  rm -rf results/trace/$PIGLIT_REPLAY_DEVICE_NAME
68fi
69
70# upload artifacts
71MINIO=$(cat /proc/cmdline | tr ' ' '\n' | grep minio_results | cut -d '=' -f 2 || true)
72if [ -n "$MINIO" ]; then
73  tar -czf results.tar.gz results/;
74  ci-fairy minio login "$CI_JOB_JWT";
75  ci-fairy minio cp results.tar.gz minio://"$MINIO"/results.tar.gz;
76fi
77
78echo "hwci: mesa: $RESULT"
79