xref: /linux/tools/testing/selftests/rcutorture/bin/mktestid.sh (revision 2db4df0c09eeb209726261f43fc556360b38ec99)
1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0+
3#
4# Create a testid.txt file in the specified directory.
5#
6# Usage: mktestid.sh dirpath
7#
8# Copyright (C) Meta Platforms, Inc.  2025
9#
10# Author: Paul E. McKenney <paulmck@kernel.org>
11
12resdir="$1"
13if test -z "${resdir}" || ! test -d "${resdir}" || ! test -w "${resdir}"
14then
15	echo Path '"'${resdir}'"' not writeable directory, no ${resdir}/testid.txt.
16	exit 1
17fi
18echo Build directory: `pwd` > ${resdir}/testid.txt
19if test -d .git
20then
21	echo Current commit: `git rev-parse HEAD` >> ${resdir}/testid.txt
22	echo >> ${resdir}/testid.txt
23	echo ' ---' Output of "'"git status"'": >> ${resdir}/testid.txt
24	git status >> ${resdir}/testid.txt
25	echo >> ${resdir}/testid.txt
26	echo >> ${resdir}/testid.txt
27	echo ' ---' Output of "'"git diff HEAD"'": >> ${resdir}/testid.txt
28	git diff HEAD >> ${resdir}/testid.txt
29fi
30