-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Isolate the buck OSS commands inside test_buck (#34378)
Summary: This isolates and parallelize all the BUCK related work inside a `test_buck` job, so it's immediately clear where a failure happend. I've also added a couple of minor improvements: - Don't clone okbuck just to consume a script. I've copied the script over instead. - Removed unnecessary `buck_cache_key` This should reduce ~5 minute of build time from Test Android which was already beyond 10 minutes. ## Changelog [Internal] - Isolate the buck OSS commands inside test_buck Pull Request resolved: #34378 Test Plan: Let's wait for a `test_buck` and `test_android` output. Reviewed By: cipolleschi Differential Revision: D38580359 Pulled By: cortinico fbshipit-source-id: 8b3915bbc28b4a7a169011fe9047f402c2d1f6ee
- Loading branch information
1 parent
e0be14a
commit 4699a39
Showing
3 changed files
with
142 additions
and
88 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# | ||
# This source code is licensed under the MIT license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
# Get script directory | ||
prog="$0" | ||
while [ -h "${prog}" ]; do | ||
newProg=$(/bin/ls -ld "${prog}") | ||
newProg=$(expr "${newProg}" : ".* -> \(.*\)$") | ||
if expr "x${newProg}" : 'x/' >/dev/null; then | ||
prog="${newProg}" | ||
else | ||
progdir=$(dirname "${prog}") | ||
prog="${progdir}/${newProg}" | ||
fi | ||
done | ||
DIR=$(dirname "${prog}") | ||
|
||
# We download saxon from Maven Central rather than copying it over. | ||
curl https://repo1.maven.org/maven2/net/sf/saxon/Saxon-HE/9.7.0-11/Saxon-HE-9.7.0-11.jar --output "$DIR/saxon.jar" | ||
|
||
# Perform conversion | ||
java -jar "$DIR/saxon.jar" -xsl:"$DIR/buckToJunit.xsl" -s:"$1" -o:"$2" |
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,58 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
Copyright (C) 2015 The Android Open Source Project | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
xmlns:func="com.google.gerrit" xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||
exclude-result-prefixes="func" version="2.0"> | ||
<xsl:output method="xml" omit-xml-declaration="no" indent="yes" encoding="UTF-8"/> | ||
<xsl:strip-space elements="*"/> | ||
|
||
<xsl:template match="/tests"> | ||
<xsl:result-document method="xml"> | ||
<testsuites> | ||
<xsl:apply-templates/> | ||
</testsuites> | ||
</xsl:result-document> | ||
</xsl:template> | ||
|
||
<xsl:template match="test"> | ||
<xsl:variable name="testCount" select="count(testresult)"/> | ||
<xsl:variable name="nonEmptyStacks" select="count(testresult[stacktrace != ''])"/> | ||
<xsl:variable name="failures" | ||
select="count(testresult[contains(stacktrace, 'java.lang.AssertionError')])"/> | ||
<xsl:variable name="errors" select="$nonEmptyStacks - $failures"/> | ||
<testsuite failures="{$failures}" time="{func:toMS(@time)}" errors="{$errors}" skipped="0" | ||
tests="{$testCount}" name="{@name}"> | ||
<xsl:apply-templates/> | ||
</testsuite> | ||
</xsl:template> | ||
|
||
<xsl:template match="testresult"> | ||
<testcase time="{func:toMS(@time)}" classname="{../@name}" name="{@name}"> | ||
<xsl:apply-templates/> | ||
</testcase> | ||
</xsl:template> | ||
|
||
<xsl:template match="message"/> | ||
|
||
<xsl:template match="stacktrace[. != '']"> | ||
<failure message="{../message}" type="{substring-before(., ':')}"> | ||
<xsl:value-of select="."/> | ||
</failure> | ||
</xsl:template> | ||
|
||
<xsl:function name="func:toMS"> | ||
<xsl:param name="sec" as="xs:decimal"/> | ||
<xsl:value-of select="$sec div 1000"/> | ||
</xsl:function> | ||
</xsl:stylesheet> |