aboutsummaryrefslogtreecommitdiffhomepage
path: root/infra/base-images/base-builder/compile
diff options
context:
space:
mode:
authorGravatar Max Moroz <dor3s1@gmail.com>2018-06-14 15:00:46 -0700
committerGravatar GitHub <noreply@github.com>2018-06-14 15:00:46 -0700
commit20e55ce3b1cea30a33a72d46aba3691c28aa3ebd (patch)
treeb65eef78774a6f3b1556dcd501f08f87f6556469 /infra/base-images/base-builder/compile
parent0eb8fca03f0630eeddaa6cebf6d7f0bc8187ac2e (diff)
[infra] Enable clange code coverage reports generation for local runs. (#1494)
* [infra] Enable clange code coverage reports generation for local runs. * Use runner image and move corpus management to the helper.py . * Clean up, delete unnecessary stuff, add comments. * Run fuzz targets in parallel. Do not exit in case of an error. * Address review feedback, except of the threading thing. * Fix a typo. * Use ThreadPool implementatino available in standard python2.7 package. * Add dry run support + no corpus download option. * Fix flags handling + add log output in case of an error. * Append arguments for fuzz target instead of replacing them. * Remove dry run functionality as it currently errors out after two runs. * Fix some spacing in the code. * Update documentation regarding new code coverage script.
Diffstat (limited to 'infra/base-images/base-builder/compile')
-rwxr-xr-xinfra/base-images/base-builder/compile11
1 files changed, 11 insertions, 0 deletions
diff --git a/infra/base-images/base-builder/compile b/infra/base-images/base-builder/compile
index 51572cec..705b2ada 100755
--- a/infra/base-images/base-builder/compile
+++ b/infra/base-images/base-builder/compile
@@ -65,10 +65,21 @@ echo "CXXFLAGS=$CXXFLAGS"
echo "---------------------------------------------------------------"
BUILD_CMD="bash -eux $SRC/build.sh"
+
+# We need to preserve source code files for generating a code coverage report.
+# We need exact files that were compiled, so copy both $SRC and $WORK dirs.
+COPY_SOURCES_CMD="cp -r $SRC $WORK $OUT"
+
if [ "${BUILD_UID-0}" -ne "0" ]; then
adduser -u $BUILD_UID --disabled-password --gecos '' builder
chown -R builder $SRC $OUT $WORK
su -c "$BUILD_CMD" builder
+ if [ "$SANITIZER" = "profile" ]; then
+ su -c "$COPY_SOURCES_CMD" builder
+ fi
else
$BUILD_CMD
+ if [ "$SANITIZER" = "profile" ]; then
+ $COPY_SOURCES_CMD
+ fi
fi