tasks/system_probe.py
def test(
    ctx,
    packages=TEST_PACKAGES,
    skip_object_files=False,
    bundle_ebpf=False,
    output_path=None,
    runtime_compiled=False,
    skip_linters=False,
    run=None,
    windows=is_windows,
    parallel_build=True,
):
    """
    Run tests on eBPF parts
    If skip_object_files is set to True, this won't rebuild object files
    If output_path is set, we run `go test` with the flags `-c -o output_path`, which *compiles* the test suite
    into a single binary. This artifact is meant to be used in conjunction with kitchen tests.
    """
    if os.getenv("GOPATH") is None:
        raise Exit(
            code=1,
            message="GOPATH is not set, if you are running tests with sudo, you may need to use the -E option to "
            "preserve your environment",
        )

    if not skip_linters and not windows:
        clang_format(ctx)
        clang_tidy(ctx)

    if not skip_object_files and not windows:
        build_object_files(ctx, parallel_build=parallel_build)

    build_tags = [NPM_TAG]
    if not windows:
        build_tags.append(BPF_TAG)
        if bundle_ebpf:
            build_tags.append(BUNDLE_TAG)

    args = {
        "build_tags": ",".join(build_tags),
        "output_params": "-c -o " + output_path if output_path else "",
        "pkgs": packages,
        "run": "-run " + run if run else "",
    }

    _, _, env = get_build_flags(ctx)
    env['DD_SYSTEM_PROBE_BPF_DIR'] = os.path.normpath(os.path.join(os.getcwd(), "pkg", "ebpf", "bytecode", "build"))
    if runtime_compiled:
        env['DD_TESTS_RUNTIME_COMPILED'] = "1"

    cmd = 'go test -mod=mod -v -tags "{build_tags}" {output_params} {pkgs} {run}'
    if not windows and not output_path and not is_root():
        cmd = 'sudo -E ' + cmd

    ctx.run(cmd.format(**args), env=env)

    Run tests on eBPF parts
    If skip_object_files is set to True, this won't rebuild object files
    If output_path is set, we run `go test` with the flags `-c -o output_path`, which *compiles* the test suite
    into a single binary. This artifact is meant to be used in conjunction with kitchen tests.
    
Run tests on eBPF parts
If skip_object_files is set to True, this won't rebuild object files
If output_path is set, we run `go test` with the flags `-c -o output_path`, which *compiles* the test suite
into a single binary. This artifact is meant to be used in conjunction with kitchen tests.
Run tests on eBPF parts If skip_object_files is set to True this won ' t rebuild object files If output_path is set we run ` go test ` with the flags ` - c - o output_path ` which * compiles * the test suite into a single binary . This artifact is meant to be used in conjunction with kitchen tests .
def test(
    ctx,
    packages=TEST_PACKAGES,
    skip_object_files=False,
    bundle_ebpf=False,
    output_path=None,
    runtime_compiled=False,
    skip_linters=False,
    run=None,
    windows=is_windows,
    parallel_build=True,
):
    if os.getenv("GOPATH") is None:
        raise Exit(
            code=1,
            message="GOPATH is not set, if you are running tests with sudo, you may need to use the -E option to "
            "preserve your environment",
        )
    if not skip_linters and not windows:
        clang_format(ctx)
        clang_tidy(ctx)
    if not skip_object_files and not windows:
        build_object_files(ctx, parallel_build=parallel_build)
    build_tags = [NPM_TAG]
    if not windows:
        build_tags.append(BPF_TAG)
        if bundle_ebpf:
            build_tags.append(BUNDLE_TAG)
    args = {
        "build_tags": ",".join(build_tags),
        "output_params": "-c -o " + output_path if output_path else "",
        "pkgs": packages,
        "run": "-run " + run if run else "",
    }
    _, _, env = get_build_flags(ctx)
    env['DD_SYSTEM_PROBE_BPF_DIR'] = os.path.normpath(os.path.join(os.getcwd(), "pkg", "ebpf", "bytecode", "build"))
    if runtime_compiled:
        env['DD_TESTS_RUNTIME_COMPILED'] = "1"
    cmd = 'go test -mod=mod -v -tags "{build_tags}" {output_params} {pkgs} {run}'
    if not windows and not output_path and not is_root():
        cmd = 'sudo -E ' + cmd
    ctx.run(cmd.format(**args), env=env)
def test ( ctx , packages = TEST_PACKAGES , skip_object_files = False , bundle_ebpf = False , output_path = None , runtime_compiled = False , skip_linters = False , run = None , windows = is_windows , parallel_build = True , ) : if os . getenv ( "GOPATH" ) is None : raise Exit ( code = 1 , message = "GOPATH is not set, if you are running tests with sudo, you may need to use the -E option to " "preserve your environment" , ) if not skip_linters and not windows : clang_format ( ctx ) clang_tidy ( ctx ) if not skip_object_files and not windows : build_object_files ( ctx , parallel_build = parallel_build ) build_tags = [ NPM_TAG ] if not windows : build_tags . append ( BPF_TAG ) if bundle_ebpf : build_tags . append ( BUNDLE_TAG ) args = { "build_tags" : "," . join ( build_tags ) , "output_params" : "-c -o " + output_path if output_path else "" , "pkgs" : packages , "run" : "-run " + run if run else "" , } _ , _ , env = get_build_flags ( ctx ) env [ 'DD_SYSTEM_PROBE_BPF_DIR' ] = os . path . normpath ( os . path . join ( os . getcwd ( ) , "pkg" , "ebpf" , "bytecode" , "build" ) ) if runtime_compiled : env [ 'DD_TESTS_RUNTIME_COMPILED' ] = "1" cmd = 'go test -mod=mod -v -tags "{build_tags}" {output_params} {pkgs} {run}' if not windows and not output_path and not is_root ( ) : cmd = 'sudo -E ' + cmd ctx . run ( cmd . format ( ** args ) , env = env )
Run tests on eBPF parts
If skip_object_files is set to True, this won't rebuild object files
If output_path is set, we run `go test` with the flags `-c -o output_path`, which *compiles* the test suite
into a single binary.
Run tests on eBPF parts If skip_object_files is set to True this won ' t rebuild object files If output_path is set we run ` go test ` with the flags ` - c - o output_path ` which * compiles * the test suite into a single binary .
"""
    Run tests on eBPF parts
    If skip_object_files is set to True, this won't rebuild object files
    If output_path is set, we run `go test` with the flags `-c -o output_path`, which *compiles* the test suite
    into a single binary. This artifact is meant to be used in conjunction with kitchen tests.
    """
ctx
packages
skip_object_files
bundle_ebpf
output_path
runtime_compiled
skip_linters
run
windows
parallel_build