summaryrefslogtreecommitdiff
path: root/deqp-run
blob: 63f59a6bd47ecc1d6ad07b346924fdce80409378 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/bin/bash

die() {
	echo "$1"
	exit 255
}

readonly -A CHROMEOS_DEQP_BIN=(
	[vk]=/usr/local/deqp/external/vulkancts/modules/vulkan/deqp-vk
	[egl]=/usr/local/deqp/modules/egl/deqp-egl
	[gles2]=/usr/local/deqp/modules/gles2/deqp-gles2
	[gles3]=/usr/local/deqp/modules/gles3/deqp-gles3
	[gles31]=/usr/local/deqp/modules/gles31/deqp-gles31
)

readonly -A LINUX_DEQP_BIN=(
	[vk]=build/external/vulkancts/modules/vulkan/deqp-vk
	[egl]=build/modules/egl/deqp-egl
	[gles2]=build/modules/gles2/deqp-gles2
	[gles3]=build/modules/gles3/deqp-gles3
	[gles31]=build/modules/gles31/deqp-gles31
)
readonly -A CHROMEOS_DEQP_CASELIST=(
	[vk]=/usr/local/deqp/caselists/vk.txt.zst
	[egl]=/usr/local/deqp/caselists/egl.txt.zst
	[gles2]=/usr/local/deqp/caselists/gles2.txt.zst
	[gles3]=/usr/local/deqp/caselists/gles3.txt.zst
	[gles31]=/usr/local/deqp/caselists/gles31.txt.zst
)

readonly -A LINUX_DEQP_CASELIST=(
	[vk]=external/vulkancts/mustpass/main/vk-default.txt
	[egl]=android/cts/master/egl-master.txt
	[gles2]=android/cts/main/gles2-master.txt
	[gles3]=android/cts/main/gles3-master.txt
	[gles31]=android/cts/main/gles31-master.txt
)

readonly CHROMEOS_TESTLOG_TO_XML=/usr/local/deqp/executor/testlog-to-xml

readonly LINUX_TESTLOG_TO_XML=build/executor/testlog-to-xml

readonly -a DEQP_OPTIONS=(
	--deqp-surface-width=256
	--deqp-surface-height=256
	--deqp-surface-type=pbuffer
	--deqp-gl-config-name=rgba8888d24s8ms0
	--deqp-visibility=hidden
)

mode=execute
if [[ $1 == --cmd ]]; then
	mode=print-command
	shift
fi

if [[ $# -eq 1 ]]; then
	if [[ $1 == dEQP-* ]]; then
		single_test="$1"

		api="${1%%.*}"
		api="${api#dEQP-}"
		api="${api,,}"
	else
		api="$1"
	fi

	case "${api}" in
	vk|egl|gles2|gles3|gles31)
		# shellcheck source=/etc/os-release
		source <(grep '^ID=' /etc/os-release)
		if [[ $ID == chromeos ]]; then
			DEQP_BIN="${CHROMEOS_DEQP_BIN[$api]}"
			CASELIST="${CHROMEOS_DEQP_CASELIST[$api]}"
			TESTLOG_TO_XML="${CHROMEOS_TESTLOG_TO_XML}"
		else
			DEQP_BIN="${LINUX_DEQP_BIN[$api]}"
			CASELIST="${LINUX_DEQP_CASELIST[$api]}"
			TESTLOG_TO_XML="${LINUX_TESTLOG_TO_XML}"
		fi
		;;
	*)
		die "Argument must be one of vk|egl|gles2|gles3|gles31 or a dEQP-* test name"
		;;
	esac
else
	DEQP_BIN="$1"
	CASELIST="$2"
	TESTLOG_TO_XML="$3"
fi

if [[ ! -x $DEQP_BIN ]]; then
	die "deqp binary '$DEQP_BIN' does not exist or is not executable"
fi
DEQP_BIN="$(realpath "${DEQP_BIN}")"

if [[ -n $single_test ]]; then
	cd "$(dirname "${DEQP_BIN}")" || die "can't cd"
	if [[ $mode == print-command ]]; then
		echo "${DEQP_BIN}" "${DEQP_OPTIONS[@]}" -n "${single_test}"
		exit
	fi
	exec "${DEQP_BIN}" "${DEQP_OPTIONS[@]}" -n "${single_test}"
fi

if [[ ! -r $CASELIST ]]; then
	die "Caselist '$CASELIST' does not exist or is not readable"
fi
CASELIST="$(realpath "${CASELIST}")"

if [[ ! -x $TESTLOG_TO_XML ]]; then
	die "testlog-to-xml binary '$TESTLOG_TO_XML' does not exist or is not executable"
fi
TESTLOG_TO_XML="$(realpath "${TESTLOG_TO_XML}")"

if [[ -e $OUTPUT_DIR ]]; then
	die "Output directory '$OUTPUT_DIR' already exists"
fi
OUTPUT_DIR=$(basename "${DEQP_BIN}")

DEQP_RUNNER_ARGS=(
	--caselist "${CASELIST}"
	--deqp "${DEQP_BIN}"
	--testlog-to-xml "${TESTLOG_TO_XML}"
	--timeout 360
	--output "${OUTPUT_DIR}"
)

if [[ $mode == print-command ]]; then
	echo deqp-runner run "${DEQP_RUNNER_ARGS[@]}" -- "${DEQP_OPTIONS[@]}"
	exit
fi
exec deqp-runner run "${DEQP_RUNNER_ARGS[@]}" -- "${DEQP_OPTIONS[@]}"