gvisor.dev/gvisor@v0.0.0-20240520182842-f9d4d51c7e0f/test/secfuzz/BUILD (about)

     1  load("//tools:defs.bzl", "go_library")
     2  
     3  package(
     4      default_applicable_licenses = ["//:license"],
     5      licenses = ["notice"],
     6  )
     7  
     8  go_library(
     9      name = "secfuzz",
    10      testonly = 1,
    11      srcs = [
    12          "secfuzz.go",
    13          "secfuzz_covermeup.go",
    14          "secfuzz_nocoverageguidance.go",
    15      ],
    16      visibility = [
    17          "//:sandbox",
    18      ],
    19      deps = [
    20          "//pkg/abi/linux",
    21          "//pkg/abi/sentry",
    22          "//pkg/atomicbitops",
    23          "//pkg/bpf",
    24          "//pkg/seccomp",
    25          "//pkg/sync",
    26      ],
    27  )
    28  
    29  genrule(
    30      name = "secfuzz_covermeup",
    31      srcs = ["secfuzz_covermeup.tmpl.go"],
    32      outs = ["secfuzz_covermeup.go"],
    33      cmd = (
    34          "  while IFS= read -r line; do" +
    35          "    if echo \"$$line\" | grep -q 'GENERATED_LINES_INSERTED_HERE_THIS_IS_A_LOAD_BEARING_COMMENT'; then" +
    36          "      while IFS= read -r i; do" +
    37          "        echo -e \"\\\\tcase $$(( $$i + 1 )):\";" +
    38          "        echo -e \"\\\\t\\\\tif covered[$$i] {\";" +
    39          "        echo -e \"\\\\t\\\\t\\\\tfuzzee.coverage[$$i].Store(true)\";" +
    40          "        echo -e \"\\\\t\\\\t}\";" +
    41          "        echo -e \"\\\\t\\\\tfallthrough\";" +
    42          "      done < <(awk 'BEGIN{for (i = 4095; i >= 1; i --) print i}');" +
    43          "    else" +
    44          "      echo \"$$line\";" +
    45          "    fi;" +
    46          "  done" +
    47          "  < $(location :secfuzz_covermeup.tmpl.go)" +
    48          "  > $@"
    49      ),
    50  )