mirror of https://github.com/google/oss-fuzz.git
[NFC] Minor SysSan improvements (#9149)
This commit is contained in:
parent
e43137d7ee
commit
695e99329f
|
@ -1,8 +1,8 @@
|
||||||
.POSIX:
|
.POSIX:
|
||||||
CXX = clang++
|
CXX = clang++
|
||||||
CFLAGS = -std=c++17 -Wall -Wextra -O3 -g3
|
CFLAGS = -std=c++17 -Wall -Wextra -O3 -g3 -Werror
|
||||||
|
|
||||||
all: clean SystemSan target target_file target_dns
|
all: SystemSan target target_file target_dns
|
||||||
|
|
||||||
SystemSan: SystemSan.cpp inspect_dns.cpp inspect_utils.cpp
|
SystemSan: SystemSan.cpp inspect_dns.cpp inspect_utils.cpp
|
||||||
$(CXX) $(CFLAGS) -lpthread -o $@ $^
|
$(CXX) $(CFLAGS) -lpthread -o $@ $^
|
||||||
|
|
|
@ -30,7 +30,7 @@ extern "C" int LLVMFuzzerTestOneInput(char* data, size_t size) {
|
||||||
|
|
||||||
struct addrinfo *result = NULL;
|
struct addrinfo *result = NULL;
|
||||||
|
|
||||||
int s = getaddrinfo(str.c_str(), NULL, NULL, &result);
|
getaddrinfo(str.c_str(), NULL, NULL, &result);
|
||||||
if (result) {
|
if (result) {
|
||||||
freeaddrinfo(result);
|
freeaddrinfo(result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -402,6 +402,14 @@ def run_tests(_=None, parallel=False, build_tests=True, nonbuild_tests=True):
|
||||||
return nonbuild_success and build_success
|
return nonbuild_success and build_success
|
||||||
|
|
||||||
|
|
||||||
|
def run_systemsan_tests(_=None):
|
||||||
|
"""Runs SystemSan unit tests."""
|
||||||
|
command = ['make', 'test']
|
||||||
|
return subprocess.run(command,
|
||||||
|
cwd='infra/experimental/SystemSan',
|
||||||
|
check=False).returncode == 0
|
||||||
|
|
||||||
|
|
||||||
def get_all_files():
|
def get_all_files():
|
||||||
"""Returns a list of absolute paths of files in this repo."""
|
"""Returns a list of absolute paths of files in this repo."""
|
||||||
get_all_files_command = ['git', 'ls-files']
|
get_all_files_command = ['git', 'ls-files']
|
||||||
|
@ -413,9 +421,10 @@ def main():
|
||||||
"""Check changes on a branch for common issues before submitting."""
|
"""Check changes on a branch for common issues before submitting."""
|
||||||
# Get program arguments.
|
# Get program arguments.
|
||||||
parser = argparse.ArgumentParser(description='Presubmit script for oss-fuzz.')
|
parser = argparse.ArgumentParser(description='Presubmit script for oss-fuzz.')
|
||||||
parser.add_argument('command',
|
parser.add_argument(
|
||||||
choices=['format', 'lint', 'license', 'infra-tests'],
|
'command',
|
||||||
nargs='?')
|
choices=['format', 'lint', 'license', 'infra-tests', 'systemsan-tests'],
|
||||||
|
nargs='?')
|
||||||
parser.add_argument('-a',
|
parser.add_argument('-a',
|
||||||
'--all-files',
|
'--all-files',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
|
@ -466,6 +475,10 @@ def main():
|
||||||
nonbuild_tests=(not args.skip_nonbuild_tests))
|
nonbuild_tests=(not args.skip_nonbuild_tests))
|
||||||
return bool_to_returncode(success)
|
return bool_to_returncode(success)
|
||||||
|
|
||||||
|
if args.command == 'systemsan-tests':
|
||||||
|
success = run_systemsan_tests(relevant_files)
|
||||||
|
return bool_to_returncode(success)
|
||||||
|
|
||||||
# Do all the checks (but no tests).
|
# Do all the checks (but no tests).
|
||||||
success = do_checks(relevant_files)
|
success = do_checks(relevant_files)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue