var sysdir = func() (sd *sysDir) {
switch runtime.GOOS {
+ case "android":
+ sd = &sysDir{
+ "/system/etc",
+ []string{
+ "audio_policy.conf",
+ "system_fonts.xml",
+ },
+ }
case "windows":
sd = &sysDir{
Getenv("SystemRoot") + "\\system32\\drivers\\etc",
// On Unix, override $TMPDIR in case the user
// has it set to an NFS-mounted directory.
dir := ""
- if runtime.GOOS != "windows" {
+ if runtime.GOOS != "android" && runtime.GOOS != "windows" {
dir = "/tmp"
}
f, err := ioutil.TempFile(dir, "_Go_"+testName)
// big directory that doesn't change often.
dir := "/usr/bin"
switch runtime.GOOS {
- case "windows":
- dir = Getenv("SystemRoot") + "\\system32"
+ case "android":
+ dir = "/system/bin"
case "plan9":
dir = "/bin"
+ case "windows":
+ dir = Getenv("SystemRoot") + "\\system32"
}
file, err := Open(dir)
if err != nil {
func TestSymlink(t *testing.T) {
switch runtime.GOOS {
- case "windows", "plan9", "nacl":
+ case "android", "nacl", "plan9", "windows":
t.Skipf("skipping on %s", runtime.GOOS)
}
from, to := "symlinktestfrom", "symlinktestto"
}
func TestStartProcess(t *testing.T) {
- if runtime.GOOS == "nacl" {
- t.Skip("skipping on nacl")
+ switch runtime.GOOS {
+ case "android", "nacl":
+ t.Skipf("skipping on %s", runtime.GOOS)
}
var dir, cmd string
// These are chosen carefully not to be symlinks on a Mac
// (unlike, say, /var, /etc, and /tmp).
dirs := []string{"/", "/usr/bin"}
- // /usr/bin does not usually exist on Plan 9.
- if runtime.GOOS == "plan9" {
+ // /usr/bin does not usually exist on Plan 9 or Android.
+ switch runtime.GOOS {
+ case "android":
+ dirs = []string{"/", "/system/bin"}
+ case "plan9":
dirs = []string{"/", "/usr"}
}
for mode := 0; mode < 2; mode++ {
func TestHostname(t *testing.T) {
// There is no other way to fetch hostname on windows, but via winapi.
- // On Plan 9 it is can be taken from #c/sysname as Hostname() does.
+ // On Plan 9 it can be taken from #c/sysname as Hostname() does.
switch runtime.GOOS {
- case "windows", "plan9", "nacl":
+ case "android", "nacl", "plan9", "windows":
t.Skipf("skipping on %s", runtime.GOOS)
}
}
func testKillProcess(t *testing.T, processKiller func(p *Process)) {
- if runtime.GOOS == "nacl" {
- t.Skip("skipping on nacl")
+ switch runtime.GOOS {
+ case "android", "nacl":
+ t.Skipf("skipping on %s", runtime.GOOS)
}
dir, err := ioutil.TempDir("", "go-build")