mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-08-31 14:13:39 +00:00

The kvm.sh script places a testid.txt file in the top-level results directory in order to identify the tree and commit that was tested. This works well, but there are scripts other than kvm.sh that also create results directories, and it would be good for them to also identify exactly what was tested. This commit therefore extracts the testid.txt generation to a new mktestid.sh script so that it can be easily used elsewhere. Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Signed-off-by: Neeraj Upadhyay (AMD) <neeraj.upadhyay@kernel.org>
30 lines
850 B
Bash
Executable File
30 lines
850 B
Bash
Executable File
#!/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
|