Added sandcastle pre-commit
Test Plan: Lately we have been breaking our builds too often. This changes adds the capability to schedule tests in sandcastle for every diff created. This will help us increase the pre-commit testing bar. This patch will dispatch signals to sandcastle to start running tests on the diff. The test failures are reported to the user via email. The user can also manually check the progress of test in sandcastle via the URL provided. Reviewers: sdong, rven Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D53001
This commit is contained in:
parent
202be23e46
commit
a300d9928e
@ -10,13 +10,112 @@ class FacebookArcanistConfiguration extends ArcanistConfiguration {
|
||||
ArcanistBaseWorkflow $workflow,
|
||||
$error_code) {
|
||||
if ($command == 'diff' && !$workflow->isRawDiffSource()) {
|
||||
$this->maybePushToJenkins($workflow);
|
||||
$this->startTestsInJenkins($workflow);
|
||||
$this->startTestsInSandcastle($workflow);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/* Run tests in sandcastle */
|
||||
function getSteps($diffID, $username) {
|
||||
$arcrc_content = exec("cat ~/.arcrc | base64 -w0");
|
||||
|
||||
$setup = array(
|
||||
"name" => "Setup arcrc",
|
||||
"shell" => "echo " . $arcrc_content . " | base64 --decode > ~/.arcrc",
|
||||
"user" => "root"
|
||||
);
|
||||
|
||||
$fix_permission = array(
|
||||
"name" => "Fix environment",
|
||||
"shell" => "chmod 600 ~/.arcrc",
|
||||
"user" => "root"
|
||||
);
|
||||
|
||||
$fix_git_ignore = array(
|
||||
"name" => "Fix git ignore",
|
||||
"shell" => "echo fbcode >> .git/info/exclude",
|
||||
"user" => "root"
|
||||
);
|
||||
|
||||
$patch = array(
|
||||
"name" => "Patch " . $diffID,
|
||||
"shell" => "HTTPS_PROXY=fwdproxy:8080 arc --arcrc-file ~/.arcrc "
|
||||
. "patch D" . $diffID . " || rm -f ~/.arcrc",
|
||||
"user" => "root"
|
||||
);
|
||||
|
||||
$cleanup = array(
|
||||
"name" => "Arc cleanup",
|
||||
"shell" => "rm -f ~/.arcrc",
|
||||
"user" => "root"
|
||||
);
|
||||
|
||||
$steps[] = $setup;
|
||||
$steps[] = $fix_permission;
|
||||
$steps[] = $fix_git_ignore;
|
||||
$steps[] = $patch;
|
||||
$steps[] = $cleanup;
|
||||
|
||||
$tests = array(
|
||||
"unit", "clang_unit", "tsan", "asan", "valgrind"
|
||||
);
|
||||
|
||||
foreach ($tests as $test) {
|
||||
$run_test = array(
|
||||
"name" => "Run " . $test,
|
||||
"shell" => "EMAIL=" . $username . "@fb.com "
|
||||
. "./build_tools/rocksdb-lego-determinator " . $test,
|
||||
"user" => "root",
|
||||
"determinator" => true
|
||||
);
|
||||
|
||||
$steps[] = $run_test;
|
||||
}
|
||||
|
||||
return $steps;
|
||||
}
|
||||
|
||||
function startTestsInSandcastle($workflow) {
|
||||
$diffID = $workflow->getDiffId();
|
||||
$username = exec("whoami");
|
||||
|
||||
if ($diffID == null || $username == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$arg = array(
|
||||
"name" => "RocksDB diff D" . $diffID . "testing for " . $username,
|
||||
"steps" => $this->getSteps($diffID, $username)
|
||||
);
|
||||
|
||||
$url = 'https://interngraph.intern.facebook.com/sandcastle/generate?'
|
||||
.'command=SandcastleUniversalCommand'
|
||||
.'&vcs=rocksdb-git&revision=origin%2Fmaster&type=lego'
|
||||
.'&user=krad&alias=ci-util'
|
||||
.'&command-args=' . urlencode(json_encode($arg));
|
||||
|
||||
$cmd = 'https_proxy= HTTPS_PROXY= curl -s -k -F app=659387027470559 '
|
||||
. '-F token=AeO_3f2Ya3TujjnxGD4 "' . $url . '"';
|
||||
|
||||
echo "\n====================================================== \n";
|
||||
echo "Scheduling sandcastle job for D" . $diffID . " for " . $username;
|
||||
echo "\n";
|
||||
echo "Please follow the URL for details on the job. \n";
|
||||
echo "An email will be sent to " . $username . "@fb.com on failure. \n";
|
||||
echo "\n";
|
||||
echo "Job details: \n";
|
||||
|
||||
$output = shell_exec($cmd);
|
||||
|
||||
echo $output;
|
||||
|
||||
echo "\n====================================================== \n";
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/* Send off builds to jenkins */
|
||||
function maybePushToJenkins($workflow) {
|
||||
function startTestsInJenkins($workflow) {
|
||||
$diffID = $workflow->getDiffID();
|
||||
if ($diffID === null) {
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user