OSDN Git Service

Merge branch 'trunk' of git://gcc.gnu.org/git/gcc into rework
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / go.test / test / env.go
1 // [ $GOOS != nacl ] || exit 0  # NaCl runner does not expose environment
2 // $G $F.go && $L $F.$A && ./$A.out
3
4 // Copyright 2009 The Go Authors. All rights reserved.
5 // Use of this source code is governed by a BSD-style
6 // license that can be found in the LICENSE file.
7
8 package main
9
10 import os "os"
11
12 func main() {
13         ga, e0 := os.Getenverror("GOARCH")
14         if e0 != nil {
15                 print("$GOARCH: ", e0.String(), "\n")
16                 os.Exit(1)
17         }
18         if ga != "amd64" && ga != "386" && ga != "arm" {
19                 print("$GOARCH=", ga, "\n")
20                 os.Exit(1)
21         }
22         xxx, e1 := os.Getenverror("DOES_NOT_EXIST")
23         if e1 != os.ENOENV {
24                 print("$DOES_NOT_EXIST=", xxx, "; err = ", e1.String(), "\n")
25                 os.Exit(1)
26         }
27 }