mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-21 04:49:04 +00:00
os: Chmod: don't test on wasi yet, wasi-libc does not yet support it
Lets "tinygo test -target wasi os" compile, if not pass. For https://github.com/tinygo-org/tinygo/issues/2369
This commit is contained in:
@@ -0,0 +1,27 @@
|
|||||||
|
// +build !baremetal,!js,!wasi
|
||||||
|
|
||||||
|
// TODO: Move this into os_test.go (as upstream has it) when wasi supports chmod
|
||||||
|
|
||||||
|
package os_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
. "os"
|
||||||
|
"runtime"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestChmod(t *testing.T) {
|
||||||
|
f := newFile("TestChmod", t)
|
||||||
|
defer Remove(f.Name())
|
||||||
|
defer f.Close()
|
||||||
|
// Creation mode is read write
|
||||||
|
|
||||||
|
fm := FileMode(0456)
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
fm = FileMode(0444) // read-only file
|
||||||
|
}
|
||||||
|
if err := Chmod(f.Name(), fm); err != nil {
|
||||||
|
t.Fatalf("chmod %s %#o: %s", f.Name(), fm, err)
|
||||||
|
}
|
||||||
|
checkMode(t, f.Name(), fm)
|
||||||
|
}
|
||||||
@@ -34,22 +34,6 @@ func checkMode(t *testing.T, path string, mode FileMode) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestChmod(t *testing.T) {
|
|
||||||
f := newFile("TestChmod", t)
|
|
||||||
defer Remove(f.Name())
|
|
||||||
defer f.Close()
|
|
||||||
// Creation mode is read write
|
|
||||||
|
|
||||||
fm := FileMode(0456)
|
|
||||||
if runtime.GOOS == "windows" {
|
|
||||||
fm = FileMode(0444) // read-only file
|
|
||||||
}
|
|
||||||
if err := Chmod(f.Name(), fm); err != nil {
|
|
||||||
t.Fatalf("chmod %s %#o: %s", f.Name(), fm, err)
|
|
||||||
}
|
|
||||||
checkMode(t, f.Name(), fm)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestReadAt(t *testing.T) {
|
func TestReadAt(t *testing.T) {
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
t.Log("TODO: implement Pread for Windows")
|
t.Log("TODO: implement Pread for Windows")
|
||||||
|
|||||||
Reference in New Issue
Block a user