github.com/cockroachdb/pebble@v0.0.0-20231214172447-ab4952c5f87b/sstable/testdata/make-table.go (about) 1 // Copyright 2023 The LevelDB-Go and Pebble Authors. All rights reserved. Use 2 // of this source code is governed by a BSD-style license that can be found in 3 // the LICENSE file. 4 5 package main 6 7 import ( 8 "fmt" 9 "os" 10 "path/filepath" 11 12 "github.com/cockroachdb/pebble/sstable" 13 "github.com/cockroachdb/pebble/vfs" 14 ) 15 16 func main() { 17 // The test fixture code opens "testdata/h.txt" so we have to move up. 18 dir, err := os.Getwd() 19 if err != nil { 20 panic(err) 21 } 22 if filepath.Base(dir) != "testdata" { 23 panic("This program must be run from sstable/testdata") 24 } 25 if err := os.Chdir(filepath.Dir(dir)); err != nil { 26 panic(err) 27 } 28 for _, fixture := range sstable.TestFixtures { 29 fmt.Printf("Generating %s\n", fixture.Filename) 30 if err := fixture.Build(vfs.Default, filepath.Join("testdata", fixture.Filename)); err != nil { 31 panic(err) 32 } 33 } 34 }