syzkaller/prog/rand_test.go

27 lines
550 B
Go

// Copyright 2018 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
package prog
import (
"math/rand"
"testing"
)
func TestNotEscaping(t *testing.T) {
r := newRand(nil, rand.NewSource(0))
s := &state{
files: map[string]bool{"./file0": true},
}
bound := 1000000
if testing.Short() {
bound = 1000
}
for i := 0; i < bound; i++ {
fn := r.filenameImpl(s)
if escapingFilename(fn) {
t.Errorf("sandbox escaping file name %q", fn)
}
}
}