Skip to content

Commit

Permalink
improve GOOS=tamago test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
abarisani committed Aug 31, 2024
1 parent ff3c91e commit e6a7082
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/os/os_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1453,7 +1453,7 @@ func testChtimesOmit(t *testing.T, omitAt, omitMt bool) {
if !gotAtime.Equal(wantAtime) {
errormsg := fmt.Sprintf("atime mismatch, got: %q, want: %q", gotAtime, wantAtime)
switch runtime.GOOS {
case "plan9":
case "plan9", "tamago":
// Mtime is the time of the last change of content.
// Similarly, atime is set whenever the contents are
// accessed; also, it is set whenever mtime is set.
Expand Down Expand Up @@ -1531,7 +1531,7 @@ func testChtimes(t *testing.T, name string) {
if !pat.Before(at) {
errormsg := fmt.Sprintf("AccessTime didn't go backwards; was=%v, after=%v", at, pat)
switch runtime.GOOS {
case "plan9":
case "plan9", "tamago":
// Mtime is the time of the last change of
// content. Similarly, atime is set whenever
// the contents are accessed; also, it is set
Expand Down
2 changes: 1 addition & 1 deletion src/os/read_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func TestReadOnlyWriteFile(t *testing.T) {
if Getuid() == 0 {
t.Skipf("Root can write to read-only files anyway, so skip the read-only test.")
}
if runtime.GOOS == "wasip1" {
if runtime.GOOS == "wasip1" || runtime.GOOS == "tamago" {
t.Skip("no support for file permissions on " + runtime.GOOS)
}
t.Parallel()
Expand Down
4 changes: 2 additions & 2 deletions src/os/removeall_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ func TestRemoveReadOnlyDir(t *testing.T) {
// Issue #29983.
func TestRemoveAllButReadOnlyAndPathError(t *testing.T) {
switch runtime.GOOS {
case "js", "wasip1", "windows":
case "js", "wasip1", "windows", "tamago":
t.Skipf("skipping test on %s", runtime.GOOS)
}

Expand Down Expand Up @@ -421,7 +421,7 @@ func TestRemoveAllWithMoreErrorThanReqSize(t *testing.T) {
return
}
if err == nil {
if runtime.GOOS == "windows" || runtime.GOOS == "wasip1" {
if runtime.GOOS == "windows" || runtime.GOOS == "wasip1" || runtime.GOOS == "tamago" {
// Marking a directory as read-only in Windows does not prevent the RemoveAll
// from creating or removing files within it.
//
Expand Down
17 changes: 15 additions & 2 deletions src/os/testdata_tamago_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
//go:build tamago
package os
package os_test

import (
"embed"
"os"
"syscall"
)

//go:embed *.go exec/*
var src embed.FS

//go:embed testdata/*
var testdata embed.FS
func init() { CopyFS(".", testdata) }

func init() {
// cwd in TestDirFSRootDir must not be empty
os.MkdirAll("./1", 0777)
syscall.Chdir("./1")

os.CopyFS(".", src)
os.CopyFS(".", testdata)
}

0 comments on commit e6a7082

Please sign in to comment.