-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
318 changed files
with
2,051 additions
and
9,267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
#!/usr/bin/env python3 | ||
# | ||
# pre-push hook to check that commits are signed before pushing | ||
# | ||
|
||
import os | ||
import sys | ||
import subprocess | ||
|
||
|
||
# Functions | ||
|
||
|
||
def s(x): | ||
try: | ||
return x.decode("utf-8") | ||
except AttributeError: | ||
return x | ||
|
||
|
||
def getCmndOutput(cmnd, allowToFail=False): | ||
result = subprocess.run(cmnd, stdout=subprocess.PIPE, | ||
stderr = subprocess.STDOUT) | ||
output = s(result.stdout) | ||
if result.returncode != 0 and not allowToFail: | ||
print("Error, the command "+str(cmnd)+" returned error code "+str(result.returncode)\ | ||
+" with the stderr message:\n\n"+str(result.stderr)\ | ||
+"\n\nReturned output was:\n\n"+output) | ||
exit(1) | ||
return output | ||
|
||
|
||
def getCmndLineArgsFrmSysArgv(sysArgv): | ||
cmndLineArgs = sysArgv[1:] | ||
remoteName = cmndLineArgs[0] | ||
remoteURL = cmndLineArgs[1] | ||
#print("remoteName = "+str(remoteName)) | ||
#print("remoteURL = "+str(remoteURL)) | ||
return (remoteName, remoteURL) | ||
|
||
|
||
def getVersionInfoFromStdinStr(stdinStr): | ||
if stdinStr: | ||
stdinArray = stdinStr.split(" ") | ||
#print("stdinArray = "+str(stdinArray)) | ||
localRef = stdinArray[0] | ||
localObjectName = stdinArray[1] | ||
remoteRef = stdinArray[2] | ||
remoteObjectName = stdinArray[3] | ||
#print("localRef = "+localRef) | ||
#print("localObjectName = "+localObjectName) | ||
#print("remoteRef = "+remoteRef) | ||
#print("remoteObjectName = "+remoteObjectName) | ||
localCommit = localObjectName | ||
remoteCommit = remoteObjectName | ||
else: | ||
localCommit = None | ||
remoteCommit = None | ||
# | ||
return (localCommit, remoteCommit) | ||
|
||
|
||
def getUpstreamRemoteBranch(): | ||
upstreamRemoteBranchPropName = "user.upstreamremotebranch" | ||
upstreamRemoteBranch = getCmndOutput(["git", "config", "--get", | ||
upstreamRemoteBranchPropName], allowToFail=True).strip() | ||
if not upstreamRemoteBranch: | ||
print("Error: The git repo config var '"+upstreamRemoteBranchPropName+"'"\ | ||
+" is not set!\n\n"\ | ||
+"Please set it in your local repo with:\n\n"\ | ||
+" git config "+upstreamRemoteBranchPropName+" <remoteName>/<branchName>") | ||
exit(1) | ||
return upstreamRemoteBranch | ||
|
||
|
||
def getAdjustedReferenceVersion(remoteCommit): | ||
if remoteCommit == "0000000000000000000000000000000000000000": | ||
#print("Adjusted remote ref for remote commit: "+remoteCommit) | ||
return getUpstreamRemoteBranch() | ||
return remoteCommit | ||
|
||
|
||
def getVersionRangeInfoFromStdinStr(stdinStr): | ||
(localCommit, remoteCommit) = getVersionInfoFromStdinStr(stdinStr) | ||
remoteReferenceVersion = getAdjustedReferenceVersion(remoteCommit) | ||
return (localCommit, remoteReferenceVersion) | ||
|
||
|
||
def getCommitsListToBeTested(localCommit, remoteReferenceVersion): | ||
if remoteReferenceVersion: | ||
gitCommitsStr = getCmndOutput(["git", "rev-list", | ||
remoteReferenceVersion+".."+localCommit]).strip() | ||
#print("gitCommits = '"+gitCommits+"'") | ||
else: | ||
gitCommitsStr = None | ||
# Return an array of the commits | ||
if gitCommitsStr: | ||
return str(gitCommitsStr).split("\n") | ||
return [] | ||
|
||
|
||
def checkCommitOkay(commit): | ||
commitMsg = getCmndOutput(["git", "log", "-1", "--pretty=format:\"%B\"", commit]) | ||
if not "Signed-off-by:" in commitMsg: | ||
print("Error: Commit "+commit+" does not have a Signed-off-by line!") | ||
return False | ||
return True | ||
|
||
|
||
def checkCommitsAreOkay(gitCommitsList, upstreamRemoteBranch): | ||
foundBadCommit = False | ||
if gitCommitsList: | ||
for commit in gitCommitsList: | ||
if not checkCommitOkay(commit): | ||
foundBadCommit = True | ||
if foundBadCommit: | ||
print("\nNOTE: These commits can be signed off by running:\n\n"\ | ||
" git rebase --signoff "+upstreamRemoteBranch+"\n") | ||
return False | ||
return True | ||
|
||
|
||
def abortIfOnlyDoingTesting(): | ||
prePushHookTesting = os.environ.get("PRE_PUSH_HOOK_TESTING", "0") | ||
if prePushHookTesting == "1": | ||
print("Aborting pre-push because PRE_PUSH_HOOK_TESTING="+str(prePushHookTesting)) | ||
exit(1) | ||
|
||
|
||
# | ||
# Main | ||
# | ||
|
||
# Get the branch name at the top in case it is not set! | ||
upstreamRemoteBranch = getUpstreamRemoteBranch() | ||
|
||
(remoteName, remoteURL) = getCmndLineArgsFrmSysArgv(sys.argv) | ||
|
||
stdinStr = sys.stdin.read().strip() | ||
(localCommit, remoteReferenceVersion) = getVersionRangeInfoFromStdinStr(stdinStr) | ||
gitCommitsList = getCommitsListToBeTested(localCommit, remoteReferenceVersion) | ||
|
||
allCommitsAreOkay = checkCommitsAreOkay(gitCommitsList, upstreamRemoteBranch) | ||
|
||
abortIfOnlyDoingTesting() | ||
|
||
# Final return pass/fail | ||
if not allCommitsAreOkay: exit(1) | ||
exit(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env python | ||
#!/usr/bin/env python3 | ||
|
||
import commands | ||
import os | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/bin/bash | ||
|
||
if [ -d CMakeFiles ] ; then | ||
rm -r CMakeFiles | ||
fi | ||
if [ -e CMakeCache.txt ] ; then | ||
rm CMakeCache.txt | ||
fi | ||
|
||
if [ "$TRIBITS_BASE_DIR" == "" ] ; then | ||
_ABS_FILE_PATH=`readlink -f $0` | ||
_SCRIPT_DIR=`dirname $_ABS_FILE_PATH` | ||
TRIBITS_BASE_DIR=$_SCRIPT_DIR/../.. | ||
fi | ||
|
||
tribits_install_test_dir=/tmp/rabartl/tribits_install_tests | ||
if [ -d "${tribits_install_test_dir}" ] ; then | ||
echo "Makedir ${tribits_install_test_dir}" | ||
mkdir ${tribits_install_test_dir} | ||
fi | ||
|
||
${TRIBITS_BASE_DIR}/dev_testing/generic/do-configure-mpi-debug \ | ||
-DDART_TESTING_TIMEOUT=200 \ | ||
-DCTEST_PARALLEL_LEVEL=16 \ | ||
-DTriBITS_CTEST_DRIVER_COVERAGE_TESTS=TRUE \ | ||
-DTriBITS_CTEST_DRIVER_MEMORY_TESTS=TRUE \ | ||
-DTriBITS_ENABLE_CONFIGURE_TIMING=ON \ | ||
-DTriBITS_ENABLE_PACKAGE_CONFIGURE_TIMING=ON \ | ||
-DTribitsExProj_INSTALL_BASE_DIR=${tribits_install_test_dir} \ | ||
-DTribitsExProj_INSTALL_OWNING_GROUP=wg-sems-users-son \ | ||
-DTriBITS_ENABLE_REAL_GIT_CLONE_TESTS=ON \ | ||
-DTriBITS_SHOW_TEST_START_END_DATE_TIME=ON \ | ||
"$@" | ||
|
||
#-DTriBITS_CTEST_DRIVER_COVERAGE_TESTS=TRUE \ | ||
#-DTriBITS_CTEST_DRIVER_MEMORY_TESTS=TRUE \ | ||
|
||
#-DTriBITS_ENABLE_DOC_GENERATION_TESTS=ON | ||
|
||
# To submit to testing.sandia.gov/cdash set: | ||
# | ||
# -DTriBITS_CTEST_DRIVER_SUBMIT_TO=TESTING_SANDIA_CDASH | ||
|
||
# To submit to testing-dev.sandia.gov/cdash set: | ||
# | ||
# -DTriBITS_CTEST_DRIVER_SUBMIT_TO=TESTING_DEV_SANDIA_CDASH | ||
|
||
# To submit to exp.cdash.org set: | ||
# | ||
# -DTriBITS_CTEST_DRIVER_SUBMIT_TO=EXP_CDASH | ||
|
||
# To submit to arbitrary CDash site (e.g. testing-dev.sandia.gov/cdash) set: | ||
# | ||
# -DTriBITS_CTEST_DRIVER_SUBMIT_TO=CUSTOM | ||
# -DTriBITS_CTEST_DRIVER_SUBMIT_DROP_SITE=testing-dev.sandia.gov | ||
# -DTriBITS_CTEST_DRIVER_SUBMIT_DROP_LOCATION="/cdash/submit.php?project=TribitsExProj" | ||
|
||
# NOTE: Add -DTriBITS_ENABLE_REAL_GIT_CLONE_TESTS=ON to test cloning TriBITS | ||
# Example repos and testing the clone features of the various tools. To get | ||
# this to work on SNL machines, one may need to switch from | ||
# 'https://github.com/' to '[email protected]:' using: | ||
# | ||
# export [email protected]:tribits/ | ||
# | ||
# before configuring. | ||
# | ||
# NOTE: The directory /tmp/tribits_install_tests above was created beforehand with: | ||
# | ||
# $ mkdir /tmp/tribits_install_tests | ||
# | ||
# One can allow another user to create the directory with a shared group for | ||
# more testing. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module purge | ||
module load aue/cmake/3.27.7 | ||
module load aue/ninja/1.11.1 | ||
module load aue/clang/16.0.6 | ||
module load aue/openmpi/4.1.6-clang-16.0.6 | ||
|
||
export PATH=${HOME}/.local/bin:${PATH} | ||
export [email protected]:tribits/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module purge | ||
module load aue/cmake/3.27.7 | ||
module load aue/ninja/1.11.1 | ||
module load aue/gcc/10.3.0 | ||
module load aue/openmpi/4.1.6-gcc-10.3.0 | ||
|
||
export [email protected]:tribits/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env python | ||
#!/usr/bin/env python3 | ||
|
||
include_files_to_remove = [ | ||
"AddSubdirectories", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.