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

Upgrade to python3.10 #1493

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 7 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 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions common/gcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import enum
import posixpath
import subprocess
from typing import List
from typing import List, Optional

from common import experiment_utils
from common import logs
Expand Down Expand Up @@ -47,7 +47,7 @@ class InstanceType(enum.Enum):
def create_instance(instance_name: str,
instance_type: InstanceType,
config: dict,
startup_script: str = None,
startup_script: Optional[str] = None,
preemptible: bool = False,
**kwargs) -> bool:
"""Creates a GCE instance with name, |instance_name|, type, |instance_type|
Expand Down Expand Up @@ -126,12 +126,12 @@ def set_default_project(cloud_project: str):
['gcloud', 'config', 'set', 'project', cloud_project])


def run_local_instance(startup_script: str = None) -> bool:
def run_local_instance(startup_script: Optional[str] = None) -> bool:
"""Does the equivalent of "create_instance" for local experiments, runs
|startup_script| in the background."""
command = ['/bin/bash', startup_script]
subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
return new_process.ProcessResult(0, '', False)
return new_process.ProcessResult(0, '', False).retcode == 0


def create_instance_template(template_name, docker_image, env, project, zone):
Expand Down
6 changes: 3 additions & 3 deletions common/new_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import signal
import subprocess
import threading
from typing import List
from typing import List, Optional

from common import logs

Expand Down Expand Up @@ -72,10 +72,10 @@ def execute( # pylint: disable=too-many-locals,too-many-branches
command: List[str],
*args,
expect_zero: bool = True,
timeout: int = None,
timeout: Optional[int] = None,
write_to_stdout=False,
# If not set, will default to PIPE.
output_file=None,
output_file: Optional[int] = None,
# Not True by default because we can't always set group on processes.
kill_children: bool = False,
**kwargs) -> ProcessResult:
Expand Down
10 changes: 5 additions & 5 deletions docs/reference/benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

from common import benchmark_utils
from common import filesystem
from common import fuzzer_config
from common import fuzzer_utils as common_fuzzer_utils
from common import oss_fuzz
from common import utils
from fuzzers import utils as fuzzer_utils

Expand Down Expand Up @@ -68,10 +68,10 @@ def get_real_benchmark_name(benchmark):
if not os.path.isdir(os.path.join(benchmarks_dir, real_benchmark)):
continue

if not benchmark_utils.is_oss_fuzz(real_benchmark):
if not benchmark_utils.is_oss_fuzz_benchmark(real_benchmark):
continue

config = oss_fuzz.get_config(real_benchmark)
config = fuzzer_config.get_config(real_benchmark)
if config['project'] == benchmark:
return real_benchmark

Expand Down Expand Up @@ -126,8 +126,8 @@ def get_binary_size_mb(fuzz_target_path):

def get_fuzz_target(benchmark, benchmark_path):
"""Returns the fuzz target and its path for |benchmark|."""
if benchmark_utils.is_oss_fuzz(benchmark):
fuzz_target = oss_fuzz.get_config(benchmark)['fuzz_target']
if benchmark_utils.is_oss_fuzz_benchmark(benchmark):
fuzz_target = fuzzer_config.get_config(benchmark)['fuzz_target']
else:
fuzz_target = common_fuzzer_utils.DEFAULT_FUZZ_TARGET_NAME

Expand Down
22 changes: 11 additions & 11 deletions experiment/run_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import sys
import tarfile
import tempfile
from typing import Dict, List
from typing import Dict, List, Optional

import jinja2
import yaml
Expand Down Expand Up @@ -235,16 +235,16 @@ def start_experiment( # pylint: disable=too-many-arguments
config_filename: str,
benchmarks: List[str],
fuzzers: List[str],
description: str = None,
no_seeds=False,
no_dictionaries=False,
oss_fuzz_corpus=False,
allow_uncommitted_changes=False,
concurrent_builds=None,
measurers_cpus=None,
runners_cpus=None,
region_coverage=False,
custom_seed_corpus_dir=None):
description: Optional[str] = None,
no_seeds: bool = False,
no_dictionaries: bool = False,
oss_fuzz_corpus: bool = False,
allow_uncommitted_changes: bool = False,
concurrent_builds: Optional[int] = None,
measurers_cpus: Optional[int] = None,
runners_cpus: Optional[int] = None,
region_coverage: bool = False,
custom_seed_corpus_dir: Optional[str] = None):
"""Start a fuzzer benchmarking experiment."""
if not allow_uncommitted_changes:
check_no_uncommitted_changes()
Expand Down
4 changes: 1 addition & 3 deletions presubmit.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,12 @@ def pytype(paths: List[Path]) -> bool:
"""Run pytype on |path| if it is a python file. Return False if it fails
type checking."""
paths = [path for path in paths if is_python(path)]
if not paths:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this (and the print below) an intentional change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. We don't need this early bail out. The print wasn't intended though.

return True

base_command = ['python3', '-m', 'pytype']
success = True

# TODO(metzman): Change this to the parallel pytype when the path issue is
# solved.
print(paths)
for path in paths:
command = base_command[:]
command.append(path)
Expand Down
14 changes: 7 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@ google-cloud-logging==1.15.1
google-cloud-secret-manager==2.4.0
clusterfuzz==0.0.1a0
Jinja2==2.11.3
numpy==1.22.0
numpy==1.23.3
MarkupSafe==2.0.1
Orange3==3.28.0
pandas==1.2.4
psutil==5.9.0
psycopg2-binary==2.8.4
pyfakefs==3.7.1
pytest==6.1.2
psycopg2-binary==2.9.3
pyfakefs==4.7.0
pytest==7.1.3
python-dateutil==2.8.1
pytz==2019.3
pytz==2020.1
PyYAML==5.4
redis==3.5.3
rq==1.4.3
scikit-posthocs==0.6.2
scipy==1.6.2
scipy==1.9.1
seaborn==0.11.1
sqlalchemy==1.3.19
protobuf==3.20.1

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