tests/reverse: replace os.ReadDir to support older Go versions
This commit is contained in:
parent
e2d3834b1c
commit
eeb267950a
|
@ -3,7 +3,6 @@ package reverse
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
|
||||||
"runtime"
|
"runtime"
|
||||||
"syscall"
|
"syscall"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -28,21 +27,17 @@ func doTestOneFileSystem(t *testing.T, plaintextnames bool) {
|
||||||
// Copied from inomap
|
// Copied from inomap
|
||||||
const maxPassthruIno = 1<<48 - 1
|
const maxPassthruIno = 1<<48 - 1
|
||||||
|
|
||||||
entries, err := os.ReadDir(mnt)
|
entries, err := ioutil.ReadDir(mnt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
mountpoints := []string{}
|
mountpoints := []string{}
|
||||||
for _, e := range entries {
|
for _, e := range entries {
|
||||||
i, err := e.Info()
|
|
||||||
if err != nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if !e.IsDir() {
|
if !e.IsDir() {
|
||||||
// We are only interested in directories
|
// We are only interested in directories
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
st := i.Sys().(*syscall.Stat_t)
|
st := e.Sys().(*syscall.Stat_t)
|
||||||
// The inode numbers of files with a different device number are remapped
|
// The inode numbers of files with a different device number are remapped
|
||||||
// to something above maxPassthruIno
|
// to something above maxPassthruIno
|
||||||
if st.Ino > maxPassthruIno {
|
if st.Ino > maxPassthruIno {
|
||||||
|
@ -53,7 +48,7 @@ func doTestOneFileSystem(t *testing.T, plaintextnames bool) {
|
||||||
t.Skip("no mountpoints found, nothing to test")
|
t.Skip("no mountpoints found, nothing to test")
|
||||||
}
|
}
|
||||||
for _, m := range mountpoints {
|
for _, m := range mountpoints {
|
||||||
e, err := os.ReadDir(mnt + "/" + m)
|
e, err := ioutil.ReadDir(mnt + "/" + m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue