VaKeR CYBER ARMY
Logo of a company Server : Apache/2.4.41 (Ubuntu)
System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Directory :  /usr/local/lib/node_modules/mediasoup/worker/deps/lcov/test/bin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/local/lib/node_modules/mediasoup/worker/deps/lcov/test/bin/test_run
#!/usr/bin/env bash
#
# Copyright IBM Corp. 2017
#
# Usage: test_run <testname> <cmdline>
#
# Announce a test case, run it, and record the resulting output in the
# test log file. Must be run after testsuite_init.
#

TOPDIR=$(realpath $(dirname $0)/..) && source "$TOPDIR/bin/common"
EXCERPTLEN=10
TESTNAME="$1"
shift

TIME=$(which time 2>/dev/null)
if [ ! -z "$TIME" ] ; then
	TIME="$TIME -v -o $TIMEFILE"
	if ! $TIME true 2>/dev/null ; then
		TIME=""
	fi
fi

t_announce "$TESTNAME"

let POS=$(stat -c %s "$LOGFILE")+1

t_detail "COMMAND" "\"$*\"" >>"$LOGFILE"
t_detail "OUTPUT" "" >>"$LOGFILE"

# Run command
$TIME bash -c "$*" 2>&1 | t_indent >>"$LOGFILE"
RC=$?

# Evaluate output of time command
ELAPSED=
RESIDENT=
SIGNAL=
if [ ! -z "$TIME" ] ; then
	while read LINE ; do
		case "$LINE" in
		"Command terminated by signal"*) SIGNAL=${LINE##* } ;;
		"Elapsed"*) ELAPSED=$(elapsed_to_ms ${LINE##* }) ;;
		"Maximum resident"*) RESIDENT=${LINE##* } ;;
		"Exit status"*) RC=${LINE##* } ;;
		esac
	done < "$TIMEFILE"
	rm -f "$TIMEFILE"
fi

t_detail "EXITCODE" "$RC" >>"$LOGFILE"

# Show result
if [ $RC -eq 0 -a -z "$SIGNAL" ] ; then
	RESULT="pass"
	t_pass "$TESTNAME"
else
	if [ -z "$SIGNAL" ] ; then
		RESULT="fail"
		t_fail "$TESTNAME"
	else
		RESULT="kill"
		t_kill "$TESTNAME"
	fi
fi

if [ ! -z "$SIGNAL" ] ; then
	t_detail "SIGNAL" "$SIGNAL" >>"$LOGFILE"
fi

if [ ! -z "$ELAPSED" ] ; then
	echo -n " (time $(($ELAPSED/1000)).$(($ELAPSED%1000/100))s, "
	echo "elapsed $TESTNAME $ELAPSED" >> "$COUNTFILE"
fi

if [ ! -z "$RESIDENT" ] ; then
	echo -n "mem $(($RESIDENT/1024)).$((($RESIDENT%1024)/100))MB)"
	echo "resident $TESTNAME $RESIDENT" >> "$COUNTFILE"
fi

echo

# Show log excerpt on failure or if requested
if [ $RC -ne 0 -o "$V" == "1" ] ; then
	LEN=$(tail -c "+$POS" "$LOGFILE" | wc -l)
	if [ "$LEN" -gt "$EXCERPTLEN" -a "$V" != "1" ] ; then
		tail -c "+$POS" "$LOGFILE" | head -n $EXCERPTLEN | t_indent
		let LEN=$LEN-$EXCERPTLEN
		echo "    ..."
		echo "    Skipping $LEN more lines (see $LOGFILE)"
	else
		tail -c "+$POS" "$LOGFILE" | t_indent
	fi
fi

# Log more details
[ ! -z "$ELAPSED" ] && t_detail "TIME" "${ELAPSED}ms" >>"$LOGFILE"
[ ! -z "$RESIDENT" ] && t_detail "MEM" "${RESIDENT}kB" >>"$LOGFILE"
t_detail "RESULT" "$RESULT" >> "$LOGFILE"

VaKeR 2022