Skip to content
Merged
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
14 changes: 11 additions & 3 deletions tasks/fuzz_infra.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def get_slack_channel_for_directory(directory_path: str) -> str:
first_owner = owners[0].lower()

# Map the owner to a slack channel
return GITHUB_SLACK_MAP.get(first_owner, DEFAULT_FUZZING_SLACK_CHANNEL)
return GITHUB_SLACK_MAP.get(first_owner, DEFAULT_FUZZING_SLACK_CHANNEL).replace("#", "")
Copy link
Member

Choose a reason for hiding this comment

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

Do you confirm this is necessary? I think both can work when calling the slack api.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, this is forwarded to workflow automation, and as of today, it's not handling it very well.
We plan to also clean that up on the api side, but that's a safe cleanup to do here.


except Exception as e:
print(
Expand Down Expand Up @@ -77,14 +77,22 @@ def build_and_upload_fuzz(ctx, team="chaos-platform", core_count=2, duration=360
with ctx.cd(directory):
# eg: convert "/path/to/fuzz/target" to "datadog-agent-path-to-fuzz-target".
# It's a unique identifier for the fuzz target.
# We also append the function name to the package name to make sure that every function inside the same package
# has a unique target name. This allows us to have different inputs for different functions in the same package.
rel = directory.removeprefix("/go/src/github.com/DataDog/datadog-agent/")
pkgname = "datadog-agent-"
pkgname += "-".join(rel.split('/'))[:max_pkg_name_length]
pkgname += f"-{func}"
build_file = "fuzz.test"

print(f'Building {pkgname}/{func} for {git_sha}...')
fuzz_build_cmd = f'go test . -c -fuzz={func}$ -o {build_file} -cover -tags=test,linux_bpf'
ctx.run(fuzz_build_cmd)
fuzz_build_cmd = f'go test . -c -fuzz={func}$ -o {build_file} -cover -tags=test,linux_bpf,nvml,amd64'
try:
ctx.run(fuzz_build_cmd)
except Exception as e:
print(f'❌ Failed to build {pkgname}: {e}... Skipping this fuzz target')
continue

build_full_path = directory + "/" + build_file
if not os.path.exists(build_full_path):
print(
Expand Down