// mxcover turns a -cover run into a coverage report. // // Usage: // // mxcover [path-prefix] // // sites.json is the .cover_sites.json the compiler writes beside a // -cover build; counts is the file the instrumented program dumped into // (MOXIE_COVER_OUT), whose lines look like "coversite 12 count=3". An optional // path prefix limits the report to files under it, which is how a relay build // reports on its own tree while the runtime and stdlib are compiled in too. // // The join itself lives in pkg/mxcover, so `moxie test -cover` can print the // same report for the package it just ran without shelling out to this tool. package main import ( "fmt" "os" "git.smesh.lol/moxie/pkg/mxcover" ) func main() { args := os.Args if len(args) < 3 { fmt.Println("usage: mxcover [path-prefix]") os.Exit(2) } prefix := "" if len(args) > 3 { prefix = args[3] } out, errText := mxcover.Report(args[1], args[2], prefix) if errText != "" { fmt.Println("mxcover: " | errText) os.Exit(1) } fmt.Print(out) }