File: test_curl_encoding.sh

package info (click to toggle)
openscap 1.4.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 125,040 kB
  • sloc: xml: 527,109; ansic: 91,390; sh: 19,789; python: 2,515; perl: 444; makefile: 49
file content (33 lines) | stat: -rwxr-xr-x 669 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/env bash

set -e -o pipefail

. $builddir/tests/test_common.sh

function curl_accept_encoding {
	# --fetch-remote-resources uses internet
	require_internet || return 255

	local DF="${srcdir}/ds.xml"
	local RF="results.xml"
	local LOG="verbose.log"

	$OSCAP xccdf --verbose=DEVEL eval --fetch-remote-resources --results $RF $DF 2>$LOG || echo "OK"

	case $(uname) in
		FreeBSD)
			grep -iE "Accept-Encoding.*gzip" "$LOG"
			;;
		*)
			grep -iP "Accept-Encoding.*gzip" "$LOG"
			;;
	esac || die "Couldn't assert gzip encoding in the log: $(grep -i 'curl header' $LOG)"

	return 0
}

test_init

test_run "cURL: Accept-Encoding" curl_accept_encoding

test_exit