aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Dongge Liu <donggeliu@google.com>2022-01-31 11:47:36 +1100
committerGravatar GitHub <noreply@github.com>2022-01-31 11:47:36 +1100
commit3ad503f00173ebc9d6f214a9ee8145ece8ba0d7d (patch)
tree696fcc65588168ff8b3e035f13490cef40cbe624
parent1f7c15061f3da8b45f6ec4c90c2354960369ed1f (diff)
Integrating CodeIntelligenceTesting Go (#7191)
Integrating *CodeIntelligenceTesting* `Go` to support more informative instrumentation (for [this issue](https://github.com/google/oss-fuzz/issues/7164)): 1. A script to install the new `Go` * Bootstrap from the existing `Go` * Install `Go` from [CodeIntelligenceTesting](https://github.com/CodeIntelligenceTesting/go/tree/dev.libfuzzer.18) * Skip the built-in test case in CodeIntelligenceTesting because they take too long and one of them erroneously fails. 2. Create a new directory & `Dockerfile` dedicated to the new Go 3. Add the new base directory name to [base_images.py](https://github.com/google/oss-fuzz/blob/master/infra/build/functions/base_images.py)
-rw-r--r--infra/base-images/base-builder-go-codeintelligencetesting/Dockerfile20
-rw-r--r--infra/base-images/base-builder/Dockerfile1
-rwxr-xr-xinfra/base-images/base-builder/install_go_CodeIntelligenceTesting.sh36
-rw-r--r--infra/build/functions/base_images.py1
4 files changed, 58 insertions, 0 deletions
diff --git a/infra/base-images/base-builder-go-codeintelligencetesting/Dockerfile b/infra/base-images/base-builder-go-codeintelligencetesting/Dockerfile
new file mode 100644
index 00000000..b9de9fa9
--- /dev/null
+++ b/infra/base-images/base-builder-go-codeintelligencetesting/Dockerfile
@@ -0,0 +1,20 @@
+# Copyright 2021 Google LLC
+#
+# 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.
+#
+################################################################################
+
+FROM gcr.io/oss-fuzz-base/base-builder-go
+
+RUN install_go_CodeIntelligenceTesting.sh
+
diff --git a/infra/base-images/base-builder/Dockerfile b/infra/base-images/base-builder/Dockerfile
index 27f50b77..1ee07ffc 100644
--- a/infra/base-images/base-builder/Dockerfile
+++ b/infra/base-images/base-builder/Dockerfile
@@ -154,6 +154,7 @@ COPY cargo compile compile_afl compile_dataflow compile_libfuzzer compile_honggf
write_labels.py bazel_build_fuzz_tests \
# Go, java, and swift installation scripts.
install_go.sh \
+ install_go_CodeIntelligenceTesting.sh \
install_java.sh \
install_python.sh \
install_rust.sh \
diff --git a/infra/base-images/base-builder/install_go_CodeIntelligenceTesting.sh b/infra/base-images/base-builder/install_go_CodeIntelligenceTesting.sh
new file mode 100755
index 00000000..1be16141
--- /dev/null
+++ b/infra/base-images/base-builder/install_go_CodeIntelligenceTesting.sh
@@ -0,0 +1,36 @@
+#!/bin/bash -eux
+# Copyright 2021 Google LLC
+#
+# 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.
+#
+################################################################################
+
+# Install CodeIntelligenceTesting Go.
+## Require at least Go1.4 to boostrap.
+cd /tmp
+git clone --depth=1 -b dev.libfuzzer.18 https://github.com/CodeIntelligenceTesting/go.git .go-CodeIntelligenceTesting
+cd .go-CodeIntelligenceTesting/src
+# Disable tests, at least one of which erroneously fails.
+sed -i '/^exec .* tool dist test -rebuild "$@"/ s/./#&/' run.bash
+./all.bash
+
+# Replace original Go with the one from CodeIntelligenceTesting.
+rm -rf /root/.go
+mv -f /tmp/.go-CodeIntelligenceTesting /root/.go
+
+# Install go114-fuzz-build with the new Go.
+rm -rf "$GOPATH/"
+mkdir -p "$GOPATH/"
+go install github.com/mdempsky/go114-fuzz-build@latest
+ln -s "$GOPATH/bin/go114-fuzz-build" "$GOPATH/bin/go-fuzz"
+
diff --git a/infra/build/functions/base_images.py b/infra/build/functions/base_images.py
index 8ca98863..a6004ed1 100644
--- a/infra/build/functions/base_images.py
+++ b/infra/build/functions/base_images.py
@@ -25,6 +25,7 @@ BASE_IMAGES = [
'base-clang',
'base-builder',
'base-builder-go',
+ 'base-builder-go-codeintelligencetesting',
'base-builder-jvm',
'base-builder-python',
'base-builder-rust',