Lines Matching full:project
78 class Project: class
79 """Class representing a project that is in OSS-Fuzz or an external project
100 """Returns path to the project Dockerfile."""
105 """Returns project language."""
110 project_yaml_path = os.path.join(self.path, 'project.yaml')
118 logging.warning('Language not specified in project.yaml.')
123 """Returns the out dir for the project. Creates it if needed."""
128 """Returns the out dir for the project. Creates it if needed."""
133 """Returns the out dir for the project. Creates it if needed."""
199 project = getattr(parsed_args, 'project', None)
200 if not project:
206 parsed_args.project = Project(parsed_args.project, is_external)
213 help='Is project external?',
225 'generate', help='Generate files for new project.')
226 generate_parser.add_argument('project')
231 help='Project language.')
236 build_image_parser.add_argument('project')
250 'build_fuzzers', help='Build fuzzers for a project.')
256 build_fuzzers_parser.add_argument('project')
281 check_build_parser.add_argument('project',
282 help='name of the project or path (external)')
296 run_fuzzer_parser.add_argument('project',
297 help='name of the project or path (external)')
304 'coverage', help='Generate code coverage report for the project.')
309 'build/corpus/<project>/<fuzz_target>/')
321 coverage_parser.add_argument('project',
322 help='name of the project or path (external)')
330 'download_corpora', help='Download all corpora for a project.')
334 'project', help='name of the project or path (external)')
341 reproduce_parser.add_argument('project',
342 help='name of the project or path (external)')
353 shell_parser.add_argument('project',
354 help='name of the project or path (external)')
373 def check_project_exists(project): argument
374 """Checks if a project exists."""
375 if os.path.exists(project.path):
378 if project.is_external:
379 descriptive_project_name = project.path
381 descriptive_project_name = project.name
387 def _check_fuzzer_exists(project, fuzzer_name): argument
390 command.extend(['-v', '%s:/out' % project.out])
415 def _get_project_build_subdir(project, subdir_name): argument
416 """Creates the |subdir_name| subdirectory of the |project| subdirectory in
418 directory = os.path.join(BUILD_DIR, subdir_name, project)
425 def _get_out_dir(project=''): argument
426 """Creates and returns path to /out directory for the given project (if
428 return _get_project_build_subdir(project, 'out')
467 def build_image_impl(project, cache=True, pull=False): argument
469 image_name = project.name
477 if not check_project_exists(project):
479 dockerfile_path = project.dockerfile_path
480 docker_build_dir = project.path
483 if pull and not pull_images(project.language):
519 def _workdir_from_dockerfile(project): argument
520 """Parses WORKDIR from the Dockerfile for the given project."""
521 with open(project.dockerfile_path) as file_handle:
524 return workdir_from_lines(lines, default=os.path.join('/src', project.name))
599 if build_image_impl(args.project, cache=args.cache, pull=pull):
606 project, argument
615 if not build_image_impl(project):
621 # Clean old and possibly conflicting artifacts in project's out directory.
624 '%s:/out' % project.out, '-t',
625 'gcr.io/oss-fuzz/%s' % project.name, '/bin/bash', '-c', 'rm -rf /out/*'
630 '%s:/work' % project.work, '-t',
631 'gcr.io/oss-fuzz/%s' % project.name, '/bin/bash', '-c', 'rm -rf /work/*'
644 if project.language:
645 env.append('FUZZING_LANGUAGE=' + project.language)
652 workdir = _workdir_from_dockerfile(project)
670 '%s:/out' % project.out, '-v',
671 '%s:/work' % project.work, '-t',
672 'gcr.io/oss-fuzz/%s' % project.name
685 return build_fuzzers_impl(args.project,
704 if not check_project_exists(args.project):
708 not _check_fuzzer_exists(args.project, args.fuzzer_name)):
711 fuzzing_language = args.project.language
714 logging.warning('Language not specified in project.yaml. Defaulting to %s.',
728 '-v', '%s:/out' % args.project.out, '-t', BASE_RUNNER_IMAGE
745 def _get_fuzz_targets(project): argument
746 """Returns names of fuzz targest build in the project's /out directory."""
748 for name in os.listdir(project.out):
756 path = os.path.join(project.out, name)
765 def _get_latest_corpus(project, fuzz_target, base_corpus_dir): argument
771 if not fuzz_target.startswith(project.name + '_'):
772 fuzz_target = '%s_%s' % (project.name, fuzz_target)
774 corpus_backup_url = CORPUS_BACKUP_URL_FORMAT.format(project_name=project.name,
799 corpus_url = CORPUS_URL_FORMAT.format(project_name=project.name,
806 """Downloads most recent corpora from GCS for the given project."""
807 if not check_project_exists(args.project):
821 fuzz_targets = _get_fuzz_targets(args.project)
823 corpus_dir = args.project.corpus
827 _get_latest_corpus(args.project, fuzz_target, corpus_dir)
834 logging.info('Downloading corpora for %s project to %s.', args.project.name,
848 if not check_project_exists(args.project):
851 if args.project.language not in constants.LANGUAGES_WITH_COVERAGE_SUPPORT:
853 'Project is written in %s, coverage for it is not supported yet.',
854 args.project.language)
858 not args.project.is_external):
864 'FUZZING_LANGUAGE=%s' % args.project.language,
865 'PROJECT=%s' % args.project.name,
887 run_args.extend(['-v', '%s:/corpus' % args.project.corpus])
891 '%s:/out' % args.project.out,
911 if not check_project_exists(args.project):
914 if not _check_fuzzer_exists(args.project, args.fuzzer_name):
941 '%s:/out' % args.project.out,
952 """Reproduces a specific test case from a specific project."""
953 return reproduce_impl(args.project, args.fuzzer_name, args.valgrind, args.e,
958 project, argument
967 if not check_project_exists(project):
970 if not _check_fuzzer_exists(project, fuzzer_name):
989 '%s:/out' % project.out,
1003 """Validates |project_name| is a valid OSS-Fuzz project name."""
1006 'Project name needs to be less than or equal to %d characters.',
1011 logging.info('Invalid project name: %s.', project_name)
1019 logging.error('Invalid project language %s.', language)
1051 """Generates empty project files."""
1052 return _generate_impl(args.project, args.language)
1067 def _generate_impl(project, language): argument
1069 if project.is_external:
1070 # External project.
1073 # Internal project.
1074 if not _validate_project_name(project.name):
1081 directory = project.build_integration_path
1088 'project_name': project.name,
1100 if not build_image_impl(args.project):
1109 if args.project.name != 'base-runner-debug':
1110 env.append('FUZZING_LANGUAGE=' + args.project.language)
1115 if is_base_image(args.project.name):
1120 out_dir = args.project.out
1132 '%s:/work' % args.project.work, '-t',
1133 'gcr.io/%s/%s' % (image_project, args.project.name), '/bin/bash'