Reader will now check BlockLog

This commit is contained in:
Caleb Gardner
2021-01-20 14:10:14 -06:00
parent 8dba30e24f
commit dd08d3516d
4 changed files with 14 additions and 22 deletions
+3 -8
View File
@@ -3,6 +3,7 @@ package squashfs
import (
"fmt"
"io"
"math"
"net/http"
"os"
"os/exec"
@@ -69,19 +70,13 @@ func TestAppImage(t *testing.T) {
}
defer aiFil.Close()
stat, _ := aiFil.Stat()
os.RemoveAll(wd + "/testing/firefox")
ai := goappimage.NewAppImage(wd + "/testing/" + appImageName)
rdr, err := NewSquashfsReader(io.NewSectionReader(aiFil, ai.Offset, stat.Size()-ai.Offset))
if err != nil {
t.Fatal(err)
}
desktop := rdr.GetFileAtPath("*.desktop")
if desktop == nil {
t.Fatal("Problema!")
}
os.Remove(wd + "/testing/cura.desktop")
deskFil, _ := os.Create(wd + "/testing/cura.desktop")
io.Copy(deskFil, desktop.Sys().(io.Reader))
fmt.Println(rdr.super.BlockLog, strconv.FormatInt(int64(rdr.super.BlockSize), 2))
fmt.Println(math.Log2(float64(rdr.super.BlockSize)))
t.Fatal("No problemo!")
}