| 1 | // Copyright 2017 Google Inc. All Rights Reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package pprofscip-go gomod github.com/google/pprof . `github.com/google/pprof/fuzz`/ |
| 16 | |
| 17 | import ( |
| 18 | "osscip-go gomod github.com/golang/go/src go1.24.0 os/" |
| 19 | "runtimescip-go gomod github.com/golang/go/src go1.24.0 runtime/" |
| 20 | "testingscip-go gomod github.com/golang/go/src go1.24.0 testing/" |
| 21 | |
| 22 | "github.com/google/pprof/profilescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/" |
| 23 | ) |
| 24 | |
| 25 | func TestParseDatascip-go gomod github.com/google/pprof . `github.com/google/pprof/fuzz`/TestParseData().(t *testingscip-go gomod github.com/golang/go/src go1.24.0 testing/.Tscip-go gomod github.com/golang/go/src go1.24.0 testing/T#) { |
| 26 | if runtimescip-go gomod github.com/golang/go/src go1.24.0 runtime/.GOOSscip-go gomod github.com/golang/go/src go1.24.0 runtime/GOOS. == "nacl" { |
| 27 | t.Skipscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Skip().("no direct filesystem access on Nacl") |
| 28 | } |
| 29 | |
| 30 | const path = "testdata/" |
| 31 | files, err := osscip-go gomod github.com/golang/go/src go1.24.0 os/.ReadDirscip-go gomod github.com/golang/go/src go1.24.0 os/ReadDir().(path) |
| 32 | if err != nil { |
| 33 | t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("Problem reading directory %s : %v", path, err) |
| 34 | } |
| 35 | for _, f := range files { |
| 36 | file := path + f.Namescip-go gomod github.com/golang/go/src go1.24.0 `io/fs`/DirEntry#Name().() |
| 37 | inbytes, err := osscip-go gomod github.com/golang/go/src go1.24.0 os/.ReadFilescip-go gomod github.com/golang/go/src go1.24.0 os/ReadFile().(file) |
| 38 | if err != nil { |
| 39 | t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("Problem reading file: %s : %v", file, err) |
| 40 | continue |
| 41 | } |
| 42 | profilescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/.ParseDatascip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/ParseData().(inbytes) |
| 43 | } |
| 44 | } |