aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/ifuzz/ifuzz_test.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-11-20 17:30:23 +0100
committerDmitry Vyukov <dvyukov@google.com>2020-11-21 08:46:20 +0100
commit5405d2e2ed019de7452677eacfc7de9562a8ea12 (patch)
tree7b2f9f488a4b57ce9a40e4d16bc263c2f00d8e48 /pkg/ifuzz/ifuzz_test.go
parent9bc78a846441516a33a7fd3b245380f463ba88ed (diff)
pkg/ifuzz: invert ifuzz and ifuzzimpl
ifuzzimpl imports the public interface package ifuzz and prog package needs to import ifuzzimpl (implementation guts that nobody outside of ifuzz should care about). This is not right. Invert everything so that prog package only needs to import ifuzz and ifuzz imports ifuzzimpl.
Diffstat (limited to 'pkg/ifuzz/ifuzz_test.go')
-rw-r--r--pkg/ifuzz/ifuzz_test.go19
1 files changed, 8 insertions, 11 deletions
diff --git a/pkg/ifuzz/ifuzz_test.go b/pkg/ifuzz/ifuzz_test.go
index 5d02f8d1e..70177b5ef 100644
--- a/pkg/ifuzz/ifuzz_test.go
+++ b/pkg/ifuzz/ifuzz_test.go
@@ -1,7 +1,7 @@
// Copyright 2017 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 ifuzz_test
+package ifuzz
import (
"encoding/hex"
@@ -10,13 +10,10 @@ import (
"testing"
"time"
- "github.com/google/syzkaller/pkg/ifuzz"
"github.com/google/syzkaller/pkg/ifuzz/ifuzzimpl"
- _ "github.com/google/syzkaller/pkg/ifuzz/powerpc/generated"
- _ "github.com/google/syzkaller/pkg/ifuzz/x86/generated"
)
-var allArches = []string{ifuzz.ArchX86, ifuzz.ArchPowerPC}
+var allArches = []string{ArchX86, ArchPowerPC}
func TestMode(t *testing.T) {
for _, arch := range allArches {
@@ -27,11 +24,11 @@ func TestMode(t *testing.T) {
}
func testMode(t *testing.T, arch string) {
- all := make(map[ifuzz.Insn]bool)
- for mode := 0; mode < ifuzz.ModeLast; mode++ {
+ all := make(map[ifuzzimpl.Insn]bool)
+ for mode := ifuzzimpl.Mode(0); mode < ifuzzimpl.ModeLast; mode++ {
for priv := 0; priv < 2; priv++ {
for exec := 0; exec < 2; exec++ {
- cfg := &ifuzz.Config{
+ cfg := &Config{
Arch: arch,
Mode: mode,
Priv: priv != 0,
@@ -57,7 +54,7 @@ func TestDecode(t *testing.T) {
}
func testDecode(t *testing.T, arch string) {
- insnset := ifuzzimpl.Types[arch]
+ insnset := ifuzzimpl.Arches[arch]
xedEnabled := false
if _, err := insnset.DecodeExt(0, nil); err == nil {
xedEnabled = true
@@ -70,8 +67,8 @@ func testDecode(t *testing.T, arch string) {
r := rand.New(rand.NewSource(seed))
for repeat := 0; repeat < 10; repeat++ {
- for mode := 0; mode < ifuzz.ModeLast; mode++ {
- cfg := &ifuzz.Config{
+ for mode := ifuzzimpl.Mode(0); mode < ifuzzimpl.ModeLast; mode++ {
+ cfg := &Config{
Arch: arch,
Mode: mode,
Priv: true,