mktestid.sh 866 B

1234567891011121314151617181920212223242526272829
  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. resdir="$1"
  12. if test -z "${resdir}" || ! test -d "${resdir}" || ! test -w "${resdir}"
  13. then
  14. echo Path '"'${resdir}'"' not writeable directory, no ${resdir}/testid.txt.
  15. exit 1
  16. fi
  17. echo Build directory: `pwd` > ${resdir}/testid.txt
  18. if test -d .git
  19. then
  20. echo Current commit: `git show --oneline --no-patch HEAD` >> ${resdir}/testid.txt
  21. echo >> ${resdir}/testid.txt
  22. echo ' ---' Output of "'"git status"'": >> ${resdir}/testid.txt
  23. git status >> ${resdir}/testid.txt
  24. echo >> ${resdir}/testid.txt
  25. echo >> ${resdir}/testid.txt
  26. echo ' ---' Output of "'"git diff HEAD"'": >> ${resdir}/testid.txt
  27. git diff HEAD >> ${resdir}/testid.txt
  28. fi