#!/bin/sh
#
# Check decoding of fault injected exit_group syscall.
#
# Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
# Copyright (c) 2016-2018 The strace developers.
# All rights reserved.
#
# SPDX-License-Identifier: GPL-2.0-or-later

. "./scno_tampering.sh"

test_with()
{
	> "$LOG" || fail_ "failed to write $LOG"

	$STRACE -o "$LOG" "$@"
	rc=$?
	[ $rc -eq 42 ] ||
		dump_log_and_fail_with "$STRACE $* failed with code $rc"

	match_diff
}

test_with -eexit,exit_group -efault=exit_group:error=ENOSYS ../answer

test_with -eexit,exit_group -efault=exit_group:error=ENOSYS \
	  -efault=\!process:error=1 ../answer

test_with -eexit,exit_group -efault=all:error=ENOSYS \
	  -efault=exit:error=1:when=2+ ../answer

test_with -eexit,exit_group -efault=exit_group:error=ENOSYS \
	  -efault=\!%desc,%file,%memory,%process,%signal,%network,%ipc:error=1 ../answer
