• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1RUN: %cpp_compiler %S/SimpleTest.cpp -o %t-SimpleTest
2
3RUN: rm -rf %t/SUB1
4RUN: mkdir -p %t/SUB1/SUB2/SUB3
5RUN: echo a > %t/SUB1/a
6RUN: echo b > %t/SUB1/SUB2/b
7RUN: echo c > %t/SUB1/SUB2/SUB3/c
8RUN: %run %t-SimpleTest %t/SUB1 -runs=0 2>&1 | FileCheck %s --check-prefix=SUBDIRS
9SUBDIRS: INFO: seed corpus: files: 3 min: 2b max: 2b total: 6b
10RUN: echo -n zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz > %t/SUB1/f64
11RUN: cat %t/SUB1/f64 %t/SUB1/f64 %t/SUB1/f64 %t/SUB1/f64 > %t/SUB1/f256
12RUN: cat %t/SUB1/f256 %t/SUB1/f256 %t/SUB1/f256 %t/SUB1/f256 > %t/SUB1/f1024
13RUN: cat %t/SUB1/f1024 %t/SUB1/f1024 %t/SUB1/f1024 %t/SUB1/f1024 > %t/SUB1/f4096
14RUN: cat %t/SUB1/f4096 %t/SUB1/f4096 > %t/SUB1/f8192
15RUN: %run %t-SimpleTest %t/SUB1 -runs=0 2>&1 | FileCheck %s --check-prefix=LONG
16LONG: INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 8192 bytes
17RUN: rm -rf %t/SUB1
18
19# Verify error message prints to console when directory does not exist
20RUN: rm -rf %t.dir && mkdir -p %t.dir
21RUN: not %run %t-SimpleTest -artifact_prefix=%t.dir/NONEXISTENT_DIR/ 2>&1 | FileCheck %s --check-prefix=NONEXISTENT_DIR_RGX
22RUN: not %run %t-SimpleTest -artifact_prefix=%t.dir/NONEXISTENT_DIR/myprefix 2>&1 | FileCheck %s --check-prefix=NONEXISTENT_DIR_RGX
23RUN: not %run %t-SimpleTest -features_dir=%t.dir/NONEXISTENT_DIR/ 2>&1 | FileCheck %s --check-prefix=NONEXISTENT_DIR_RGX
24RUN: not %run %t-SimpleTest %t.dir/NONEXISTENT_DIR 2>&1 | FileCheck %s --check-prefix=NONEXISTENT_DIR_RGX
25RUN: not %run %t-SimpleTest -exact_artifact_path=%t.dir/NONEXISTENT_DIR/myprefix 2>&1 | FileCheck %s --check-prefix=NONEXISTENT_DIR_RGX
26NONEXISTENT_DIR_RGX: ERROR: The required directory "{{.*/NONEXISTENT_DIR/?}}" does not exist
27
28# Verify error message prints to console when given directory is an empty
29# string
30RUN: not %run %t-SimpleTest "" 2>&1 | FileCheck %s --check-prefix=INVALID_DIR_RGX
31INVALID_DIR_RGX: ERROR: Provided directory path is an empty string
32
33# Verify error message prints to console when directory creation fails
34# For platforms without functioning chmod (i.e. Windows), use a forbidden
35# character in the directory name.
36RUN: rm -rf %t.dir && mkdir -p %t.dir/access_restricted
37RUN: chmod u-w %t.dir/access_restricted || true
38RUN: not %run %t-SimpleTest -create_missing_dirs=1 %t.dir/access_restricted/?corpus? 2>&1 | FileCheck %s --check-prefix=DIR_CREATION_FAILURE
39DIR_CREATION_FAILURE: ERROR: Failed to create directory "{{.*/access_restricted/\?corpus\?}}"
40
41# Verify directories and sub-directories are created when -create_missing_dirs=1
42RUN: not %run %t-SimpleTest -create_missing_dirs=1 -artifact_prefix=%t.dir/subdira/./././artifacts/ -features_dir=%t.dir/subdirb/dummy_dir/././../subdirb/features/ %t.dir/subdirc/corpus
43RUN: test -e %t.dir/subdira/artifacts/
44RUN: test -e %t.dir/subdirb/subdirb/features/
45RUN: test -e %t.dir/subdirc/corpus/
46RUN: test -e %t.dir/subdirb/dummy_dir
47
48# Verify directories and sub-directories are created for exact_artifact_path
49# when -create_missing_dirs=1
50RUN: not %run %t-SimpleTest -create_missing_dirs=1 -exact_artifact_path=%t.dir/subdird/exact_artifacts/abc
51RUN: test -e %t.dir/subdird/exact_artifacts/abc
52
53# Verify directories and sub-directories are created for artifact_prefix when
54# it's referring to a file name prefix and -create_missing_dirs=1
55RUN: not %run %t-SimpleTest -create_missing_dirs=1 -artifact_prefix=%t.dir/subdire/myprefix
56RUN: test -e %t.dir/subdire/ && not test -e %t.dir/subdire/myprefix
57
58# Verify directories are created when referring to relative paths and
59# -create_missing_dirs=1
60RUN: cd %t.dir && not %run %t-SimpleTest -create_missing_dirs=1 -artifact_prefix=cwd_artifacts/ -features_dir=cwd_features/subdirtest/ ./cwd_corpus
61RUN: test -e %t.dir/cwd_artifacts/
62RUN: test -e %t.dir/cwd_features/subdirtest/
63RUN: test -e %t.dir/cwd_corpus/
64