1
0
mirror of https://github.com/taigrr/gopher-os synced 2025-01-18 04:43:13 -08:00

Fix broken unit tests

This commit is contained in:
Achilleas Anagnostopoulos
2017-07-08 13:02:15 +01:00
parent ffb8f86a9c
commit b1084c1362
4 changed files with 18 additions and 48 deletions

View File

@@ -199,15 +199,17 @@ func (cons *VgaTextConsole) DriverVersion() (uint16, uint16, uint16) {
// DriverInit initializes this driver.
func (cons *VgaTextConsole) DriverInit() *kernel.Error { return nil }
func init() {
ProbeFuncs = append(ProbeFuncs, func() device.Driver {
var drv device.Driver
// probeForVgaTextConsole checks for the presence of a vga text console.
func probeForVgaTextConsole() device.Driver {
var drv device.Driver
fbInfo := getFramebufferInfoFn()
if fbInfo.Type == multiboot.FramebufferTypeEGA {
drv = NewVgaTextConsole(fbInfo.Width, fbInfo.Height, uintptr(fbInfo.PhysAddr))
}
fbInfo := getFramebufferInfoFn()
if fbInfo.Type == multiboot.FramebufferTypeEGA {
drv = NewVgaTextConsole(fbInfo.Width, fbInfo.Height, uintptr(fbInfo.PhysAddr))
}
return drv
})
return drv
}
func init() {
ProbeFuncs = append(ProbeFuncs, probeForVgaTextConsole)
}

View File

@@ -5,7 +5,6 @@ import (
"gopheros/kernel/cpu"
"gopheros/kernel/hal/multiboot"
"image/color"
"reflect"
"testing"
"unsafe"
)
@@ -330,22 +329,6 @@ func TestVgaTextProbe(t *testing.T) {
getFramebufferInfoFn = multiboot.GetFramebufferInfo
}()
var (
expProbePtr = reflect.ValueOf(probeForVgaTextConsole).Pointer()
foundProbe bool
)
for _, probeFn := range HWProbes() {
if reflect.ValueOf(probeFn).Pointer() == expProbePtr {
foundProbe = true
break
}
}
if !foundProbe {
t.Fatal("expected probeForVgaTextConsole to be part of the probes returned by HWProbes")
}
getFramebufferInfoFn = func() *multiboot.FramebufferInfo {
return &multiboot.FramebufferInfo{
Width: 80,