Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ubuntu to jammy and python to 3.10 #1521

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/fuzzers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ jobs:
- name: Setup Python environment
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.10.4

# Copied from:
# https://docs.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Setup Python environment
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.10.4

# Copied from:
# https://docs.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ SHELL := /bin/bash
VENV_ACTIVATE := .venv/bin/activate

${VENV_ACTIVATE}: requirements.txt
python3.9 -m venv .venv || python3 -m venv .venv
python3.10 -m venv .venv || python3 -m venv .venv
source ${VENV_ACTIVATE} && python3 -m pip install --upgrade pip setuptools && python3 -m pip install -r requirements.txt

install-dependencies: ${VENV_ACTIVATE}
Expand Down
5 changes: 1 addition & 4 deletions analysis/benchmark_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,7 @@ def _relevant_column(self):
the analysis (e.g., 'edges_covered', or 'bugs_covered')."""
return 'edges_covered' if self.type == 'code' else 'bugs_covered'

@property
@functools.lru_cache()
# TODO(lszekeres): With python3.8+, replace above two decorators with:
# @functools.cached_property
@functools.cached_property
def _benchmark_df(self):
exp_df = self._experiment_df
return exp_df[exp_df.benchmark == self.name]
Expand Down
8 changes: 5 additions & 3 deletions analysis/data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Utility functions for data (frame) transformations."""
import pandas as pd

from analysis import stat_tests
from common import environment

Expand Down Expand Up @@ -85,7 +87,7 @@ def clobber_experiments_data(df, experiments):
experiment_pairs = experiment_data[['benchmark',
'fuzzer']].apply(tuple, axis=1)
to_include = experiment_data[~experiment_pairs.isin(covered_pairs)]
result = result.append(to_include)
result = pd.concat([result, to_include])
return result


Expand Down Expand Up @@ -221,15 +223,15 @@ def experiment_summary(experiment_snapshots_df):
def benchmark_rank_by_mean(benchmark_snapshot_df, key='edges_covered'):
"""Returns ranking of fuzzers based on mean coverage."""
assert benchmark_snapshot_df.time.nunique() == 1, 'Not a snapshot!'
means = benchmark_snapshot_df.groupby('fuzzer')[key].mean()
means = benchmark_snapshot_df.groupby('fuzzer')[key].mean().astype(int)
means.rename('mean cov', inplace=True)
return means.sort_values(ascending=False)


def benchmark_rank_by_median(benchmark_snapshot_df, key='edges_covered'):
"""Returns ranking of fuzzers based on median coverage."""
assert benchmark_snapshot_df.time.nunique() == 1, 'Not a snapshot!'
medians = benchmark_snapshot_df.groupby('fuzzer')[key].median()
medians = benchmark_snapshot_df.groupby('fuzzer')[key].median().astype(int)
medians.rename('median cov', inplace=True)
return medians.sort_values(ascending=False)

Expand Down
5 changes: 1 addition & 4 deletions analysis/experiment_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,7 @@ def description_link(commit, fuzzer):
df.index = df.index.map(lambda fuzzer: description_link(commit, fuzzer))
return df

@property
@functools.lru_cache()
# TODO(lszekeres): With python3.8+, replace above two decorators with:
# @functools.cached_property
@functools.cached_property
def _experiment_snapshots_df(self):
"""Data frame containing only the time snapshots, for each benchmark,
based on which we do further analysis, i.e., statistical tests and
Expand Down
2 changes: 1 addition & 1 deletion analysis/test_data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,4 +355,4 @@ def test_experiment_rank_by_average_normalized_score():
pd_test.assert_series_equal(ranking,
expected_ranking,
check_names=False,
check_less_precise=True)
rtol=10**-3)
46 changes: 14 additions & 32 deletions docker/base-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,47 +12,29 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM ubuntu:xenial
FROM ubuntu:jammy

# Build Python 3.8.6 from source because pandas doesn't support xenial's
# Python3 version (3.5.2).
ENV PYTHON_VERSION 3.8.6
RUN apt-get update -y && apt-get install -y \
build-essential \
# Python 3.10.4 is the default version in Ubuntu 22.04 (Jammy Jellyfish).
RUN apt-get update && apt-get install -y \
rsync \
curl \
zlib1g-dev \
libncurses5-dev \
libgdbm-dev \
libnss3-dev \
libssl-dev \
libreadline-dev \
libffi-dev \
virtualenv \
libbz2-dev \
liblzma-dev \
libsqlite3-dev

RUN cd /tmp/ && \
curl -O https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz && \
tar -xvf Python-$PYTHON_VERSION.tar.xz && \
cd Python-$PYTHON_VERSION && \
./configure --enable-loadable-sqlite-extensions --enable-optimizations && \
make -j install && \
rm -r /tmp/Python-$PYTHON_VERSION.tar.xz /tmp/Python-$PYTHON_VERSION
liblzma-dev

# Install common python dependencies.
COPY ./requirements.txt /
RUN pip3 install -r /requirements.txt

# Install google-cloud-sdk.
RUN apt-get update -y && apt-get install -y \
# Install google-cloud-cli (named google-cloud-sdk prior to version 371.0.0).
RUN apt-get update && \
apt-get install -y \
apt-transport-https \
lsb-release
RUN CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)" && \
echo "deb https://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" \
ca-certificates \
gnupg

RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" \
| tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg \
| apt-key add - && \
apt-get update -y && \
apt-get install -y google-cloud-sdk
| apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && \
apt-get update && \
apt-get install -y google-cloud-cli
5 changes: 0 additions & 5 deletions docker/benchmark-builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ ENV FUZZER $fuzzer
ENV BENCHMARK $benchmark
ENV DEBUG_BUILDER $debug_builder

# Copy latest python3 from base-image into local.
COPY --from=base-image /usr/local/bin/python3* /usr/local/bin/
COPY --from=base-image /usr/local/lib/python3.8 /usr/local/lib/python3.8
COPY --from=base-image /usr/local/include/python3.8 /usr/local/include/python3.8
COPY --from=base-image /usr/local/lib/python3.8/site-packages /usr/local/lib/python3.8/site-packages

# Copy the entire fuzzers directory tree to allow for module dependencies.
COPY fuzzers $SRC/fuzzers
Expand Down
4 changes: 2 additions & 2 deletions docker/gcb/base-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ images:
steps:
- args:
- pull
- ubuntu:xenial
- ubuntu:jammy
env:
- DOCKER_BUILDKIT=1
id: pull-ubuntu-xenial
id: pull-ubuntu-jammy
name: docker:19.03.12
- args:
- build
Expand Down
2 changes: 1 addition & 1 deletion docker/generate_makefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def get_rules_for_image(name, image):
section += ' .' + dep
section += '\n'
if 'base-' in name:
section += '\tdocker pull ubuntu:xenial\n'
section += '\tdocker pull ubuntu:jammy\n'
section += '\tdocker build \\\n'
section += '\t--tag ' + os.path.join(BASE_TAG, image['tag']) + ' \\\n'
section += '\t--build-arg BUILDKIT_INLINE_CACHE=1 \\\n'
Expand Down
10 changes: 0 additions & 10 deletions experiment/build/generate_cloudbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,6 @@ def create_cloudbuild_spec(image_templates,
"""
cloudbuild_spec = {'steps': [], 'images': []}

# Workaround for bug https://github.com/moby/moby/issues/40262.
# This is only needed for base-image as it inherits from ubuntu:xenial.
if build_base_images:
cloudbuild_spec['steps'].append({
'id': 'pull-ubuntu-xenial',
'env': ['DOCKER_BUILDKIT=1'],
'name': DOCKER_IMAGE,
'args': ['pull', 'ubuntu:xenial'],
})

for image_name, image_specs in image_templates.items():
step = {
'id': image_name,
Expand Down
10 changes: 0 additions & 10 deletions experiment/build/test_generate_cloudbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ def test_generate_cloudbuild_spec_build_base_image(experiment):

expected_spec = {
'steps': [{
'id': 'pull-ubuntu-xenial',
'env': ['DOCKER_BUILDKIT=1'],
'name': 'docker:19.03.12',
'args': ['pull', 'ubuntu:xenial']
}, {
'id': 'base-image',
'env': ['DOCKER_BUILDKIT=1'],
'name': 'docker:19.03.12',
Expand Down Expand Up @@ -79,11 +74,6 @@ def test_generate_cloudbuild_spec_other_registry(experiment):

expected_spec = {
'steps': [{
'id': 'pull-ubuntu-xenial',
'env': ['DOCKER_BUILDKIT=1'],
'name': 'docker:19.03.12',
'args': ['pull', 'ubuntu:xenial']
}, {
'id': 'base-image',
'env': ['DOCKER_BUILDKIT=1'],
'name': 'docker:19.03.12',
Expand Down
20 changes: 10 additions & 10 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@ google-auth==1.30.1
google-cloud-error-reporting==1.1.2
google-cloud-logging==1.15.1
google-cloud-secret-manager==2.4.0
clusterfuzz==0.0.1a0
clusterfuzz==2.5.6
Jinja2==2.11.3
numpy==1.22.0
numpy==1.23.3
MarkupSafe==2.0.1
Orange3==3.28.0
pandas==1.2.4
pandas==1.5.0
psutil==5.9.0
psycopg2-binary==2.8.4
pyfakefs==3.7.1
pytest==6.1.2
psycopg2-binary==2.9.4
pyfakefs==5.0.0
pytest==7.1.3
python-dateutil==2.8.1
pytz==2019.3
pytz==2022.4
PyYAML==5.4
redis==3.5.3
rq==1.4.3
scikit-posthocs==0.6.2
scipy==1.6.2
seaborn==0.11.1
scipy==1.9.2
seaborn==0.12.0
sqlalchemy==1.3.19
protobuf==3.20.1

# Needed for development.
pylint==2.7.4
pytype==2021.4.15
pytype==2022.9.27
yapf==0.30.0