summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/rcutorture/bin/mktestid.sh
blob: 16f9907a4dae0b4df236645405726d9de1ec50ea (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
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0+
#
# Create a testid.txt file in the specified directory.
#
# Usage: mktestid.sh dirpath
#
# Copyright (C) Meta Platforms, Inc.  2025
#
# Author: Paul E. McKenney <paulmck@kernel.org>

resdir="$1"
if test -z "${resdir}" || ! test -d "${resdir}" || ! test -w "${resdir}"
then
	echo Path '"'${resdir}'"' not writeable directory, no ${resdir}/testid.txt.
	exit 1
fi
echo Build directory: `pwd` > ${resdir}/testid.txt
if test -d .git
then
	echo Current commit: `git rev-parse HEAD` >> ${resdir}/testid.txt
	echo >> ${resdir}/testid.txt
	echo ' ---' Output of "'"git status"'": >> ${resdir}/testid.txt
	git status >> ${resdir}/testid.txt
	echo >> ${resdir}/testid.txt
	echo >> ${resdir}/testid.txt
	echo ' ---' Output of "'"git diff HEAD"'": >> ${resdir}/testid.txt
	git diff HEAD >> ${resdir}/testid.txt
fi