Nessuna descrizione

fuzz_test.go 572B

123456789101112131415161718192021222324252627282930
  1. package pprof
  2. import (
  3. "io/ioutil"
  4. "runtime"
  5. "testing"
  6. "github.com/google/pprof/profile"
  7. )
  8. func TestParseData(t *testing.T) {
  9. if runtime.GOOS == "nacl" {
  10. t.Skip("no direct filesystem access on Nacl")
  11. }
  12. const path = "testdata/"
  13. files, err := ioutil.ReadDir(path)
  14. if err != nil {
  15. t.Errorf("Problem reading directory %s : %v", path, err)
  16. }
  17. for _, f := range files {
  18. file := path + f.Name()
  19. inbytes, err := ioutil.ReadFile(file)
  20. if err != nil {
  21. t.Errorf("Problem reading file: %s : %v", file, err)
  22. continue
  23. }
  24. profile.ParseData(inbytes)
  25. }
  26. }