tools/memory-model/scripts/cmplitmushist.sh

Source file repositories/reference/linux-study-clean/tools/memory-model/scripts/cmplitmushist.sh

File Facts

System
Linux kernel
Corpus path
tools/memory-model/scripts/cmplitmushist.sh
Extension
.sh
Size
3314 bytes
Lines
133
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: tools
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

#!/bin/sh
# SPDX-License-Identifier: GPL-2.0+
#
# Compares .out and .out.new files for each name on standard input,
# one full pathname per line.  Outputs comparison results followed by
# a summary.
#
# sh cmplitmushist.sh

T=/tmp/cmplitmushist.sh.$$
trap 'rm -rf $T' 0
mkdir $T

# comparetest oldpath newpath
badmacnam=0
timedout=0
perfect=0
obsline=0
noobsline=0
obsresult=0
badcompare=0
comparetest () {
	if grep -q ': Unknown macro ' $1 || grep -q ': Unknown macro ' $2
	then
		if grep -q ': Unknown macro ' $1
		then
			badname=`grep ': Unknown macro ' $1 |
				sed -e 's/^.*: Unknown macro //' |
				sed -e 's/ (User error).*$//'`
			echo 'Current LKMM version does not know "'$badname'"' $1
		fi
		if grep -q ': Unknown macro ' $2
		then
			badname=`grep ': Unknown macro ' $2 |
				sed -e 's/^.*: Unknown macro //' |
				sed -e 's/ (User error).*$//'`
			echo 'Current LKMM version does not know "'$badname'"' $2
		fi
		badmacnam=`expr "$badmacnam" + 1`
		return 0
	elif grep -q '^Command exited with non-zero status 124' $1 ||
	     grep -q '^Command exited with non-zero status 124' $2
	then
		if grep -q '^Command exited with non-zero status 124' $1 &&
		   grep -q '^Command exited with non-zero status 124' $2
		then
			echo Both runs timed out: $2
		elif grep -q '^Command exited with non-zero status 124' $1
		then
			echo Old run timed out: $2
		elif grep -q '^Command exited with non-zero status 124' $2
		then
			echo New run timed out: $2
		fi
		timedout=`expr "$timedout" + 1`
		return 0
	fi
	grep -v 'maxresident)k\|minor)pagefaults\|^Time' $1 > $T/oldout
	grep -v 'maxresident)k\|minor)pagefaults\|^Time' $2 > $T/newout
	if cmp -s $T/oldout $T/newout && grep -q '^Observation' $1
	then
		echo Exact output match: $2
		perfect=`expr "$perfect" + 1`
		return 0
	fi

	grep '^Observation' $1 > $T/oldout
	grep '^Observation' $2 > $T/newout
	if test -s $T/oldout -o -s $T/newout
	then

Annotation

Implementation Notes