aboutsummaryrefslogtreecommitdiff
path: root/src/os
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2021-02-19 11:56:01 -0800
committerRobert Griesemer <gri@golang.org>2021-02-19 11:56:04 -0800
commit7cdfa4969a5a13cd4b81daa2acad7574a14dfb2e (patch)
tree3a41635aa3c11fb75f6b25599804a1dc38736812 /src/os
parent6521c7b3786a69bc6ad3840ef2e3ba2088ad1cae (diff)
parent06b86e98031aacdd6f0499799cc4f50200ecfd18 (diff)
downloadgo-7cdfa4969a5a13cd4b81daa2acad7574a14dfb2e.tar.xz
[dev.typeparams] all: merge master (06b86e9) into dev.typeparams
Merge List: + 2021-02-19 06b86e9803 cmd/compile: fix check to avoid creating new closure function when typechecking inline body + 2021-02-19 9322eec8a2 codereview.cfg: add codereview.cfg for master branch + 2021-02-19 02e5a8fdfc runtime: ignore SPWRITE in syscall functions + 2021-02-19 fa18f224c3 runtime/pprof: disable TestMorestack on macOS under race detector + 2021-02-19 01eb70e3dd os: fix hex exit code print on 32-bit windows + 2021-02-19 49add6ad90 runtime: fix spurious stack overflow detection + 2021-02-19 fce2a94d84 cmd/compile: fix buglet in inlined info abstract function dwarf-gen + 2021-02-19 7764ee5614 runtime: fix invalid nil g check for for mips64x + 2021-02-19 87f425da14 cmd/go/internal/mvs: split Reqs into narrower per-function interfaces + 2021-02-19 4da0188c6c cmd/go/internal/modget: split resolveCandidates into two methods + 2021-02-19 5f2e24efb3 cmd/internal/diff: skip over Cygwin warning in diff output + 2021-02-19 ee7038f6a5 net: disable Windows netsh tests when netsh won't run + 2021-02-19 40765ffa95 os/exec: disable failing LookPathTest on windows/arm64 + 2021-02-19 b445d6ea34 runtime/pprof: expect tests to pass on macOS + 2021-02-19 b110a43628 runtime: delete gosave (dead code) + 2021-02-19 474d5f4f4d math: remove most 387 implementations + 2021-02-19 c7c6c113be runtime: convert windows/arm64 assembly + 2021-02-19 3527caa7d6 runtime: initial windows/arm64 implementation files + 2021-02-19 427bd7599d runtime: generate windows/arm64 callback asm + 2021-02-19 f6c4b4bf96 syscall: add windows/arm64 support + 2021-02-19 ac024a0c7b cmd/vendor: get golang.org/x/sys@beda7e5e158 + 2021-02-19 a3b97e7628 test: disable nilptr on windows/arm64 + 2021-02-19 985d087782 cmd/link: add windows/arm64 support + 2021-02-19 95a44d2409 cmd/internal/objfile: recognize Windows ARM64 executables + 2021-02-19 0ca0551f02 debug/pe: recognize arm64 executables + 2021-02-19 0c633125f2 cmd/dist: add windows/arm64 support + 2021-02-19 bb6efb9609 build: set GOPATH consistently in run.bash, run.bat, run.rc + 2021-02-19 a1222b7535 cmd/link: add debug print in deadcode + 2021-02-19 1c659f2525 cmd/link: clean up windows PE generation + 2021-02-19 b6379f190b syscall: clean up windows a bit + 2021-02-19 09e059afb1 runtime: enable framepointer on all arm64 + 2021-02-19 b19e7b518e runtime: clean up windows a bit + 2021-02-19 5421c37a1d runtime: fix windows/arm externalthreadhandler + 2021-02-19 91cc484ea9 runtime: fix time on windows/arm under WINE + 2021-02-19 38672d3dcf runtime: crash earlier on windows for runtime.abort + 2021-02-19 a1e9148e3d runtime: print hex numbers with hex prefixes in traceback debug + 2021-02-19 75e273fc2c runtime: fix windows/arm CONTEXT_CONTROL + 2021-02-19 76ab626bfc runtime: factor common code out of defs_windows_*.go + 2021-02-19 ece954d8b8 runtime: find g in Windows profiler using SP + 2021-02-19 a54f7fc0fd runtime: do not treat asmcgocall as a topofstack on g0 + 2021-02-19 776ee4079a runtime: do not treat morestack as a topofstack + 2021-02-19 5ecd9e34df runtime: do not treat mcall as a topofstack + 2021-02-19 54da3ab385 runtime: use TOPFRAME to identify top-of-frame functions + 2021-02-19 fbe74dbf42 runtime: use FuncInfo SPWRITE flag to identify untraceable profile samples + 2021-02-19 4dd77bdc91 cmd/asm, cmd/link, runtime: introduce FuncInfo flag bits + 2021-02-19 aa0388f2ed runtime: remove unnecessary writes to gp.sched.g + 2021-02-19 6fe8981620 cmd/internal/obj/riscv: fix JMP name<>(SB) + 2021-02-19 01f05d8ff1 runtime: unify asmcgocall and systemstack traceback setup + 2021-02-19 229695a283 runtime: clean up funcID assignment + 2021-02-19 c80da0a33a runtime: handle nil gp in cpuprof + 2021-02-19 a78879ac67 runtime: move sys.DefaultGoroot to runtime.defaultGOROOT + 2021-02-19 8ac23a1f15 runtime: document, clean up internal/sys + 2021-02-19 678568a5cf runtime: delete windows setlasterror (unused) + 2021-02-19 0d94f989d1 runtime: clean up system calls during cgo callback init + 2021-02-19 e7ee3c1fa8 os: report Windows exit status in hex Change-Id: Ib27e232dabac0604b588f27749bd8ad45a281fe3
Diffstat (limited to 'src/os')
-rw-r--r--src/os/exec/lp_windows_test.go19
-rw-r--r--src/os/exec_posix.go7
-rw-r--r--src/os/str.go36
3 files changed, 52 insertions, 10 deletions
diff --git a/src/os/exec/lp_windows_test.go b/src/os/exec/lp_windows_test.go
index c6f3d5d406..56cb54f800 100644
--- a/src/os/exec/lp_windows_test.go
+++ b/src/os/exec/lp_windows_test.go
@@ -143,7 +143,7 @@ func (test lookPathTest) run(t *testing.T, tmpdir, printpathExe string) {
if errCmd == nil && errLP == nil {
// both succeeded
if should != have {
- t.Fatalf("test=%+v failed: expected to find %q, but found %q", test, should, have)
+ t.Fatalf("test=%+v:\ncmd /c ran: %s\nlookpath found: %s", test, should, have)
}
return
}
@@ -316,12 +316,17 @@ func TestLookPath(t *testing.T) {
// Run all tests.
for i, test := range lookPathTests {
- dir := filepath.Join(tmp, "d"+strconv.Itoa(i))
- err := os.Mkdir(dir, 0700)
- if err != nil {
- t.Fatal("Mkdir failed: ", err)
- }
- test.run(t, dir, printpathExe)
+ t.Run(fmt.Sprint(i), func(t *testing.T) {
+ if i == 16 {
+ t.Skip("golang.org/issue/44379")
+ }
+ dir := filepath.Join(tmp, "d"+strconv.Itoa(i))
+ err := os.Mkdir(dir, 0700)
+ if err != nil {
+ t.Fatal("Mkdir failed: ", err)
+ }
+ test.run(t, dir, printpathExe)
+ })
}
}
diff --git a/src/os/exec_posix.go b/src/os/exec_posix.go
index 7ecddaed37..8aa1e5e499 100644
--- a/src/os/exec_posix.go
+++ b/src/os/exec_posix.go
@@ -102,7 +102,12 @@ func (p *ProcessState) String() string {
res := ""
switch {
case status.Exited():
- res = "exit status " + itoa(status.ExitStatus())
+ code := status.ExitStatus()
+ if runtime.GOOS == "windows" && uint(code) >= 1<<16 { // windows uses large hex numbers
+ res = "exit status " + uitox(uint(code))
+ } else { // unix systems use small decimal integers
+ res = "exit status " + itoa(code) // unix
+ }
case status.Signaled():
res = "signal: " + status.Signal().String()
case status.Stopped():
diff --git a/src/os/str.go b/src/os/str.go
index cba9fa3e8d..9bfcc15aa8 100644
--- a/src/os/str.go
+++ b/src/os/str.go
@@ -6,7 +6,7 @@
package os
-// Convert integer to decimal string
+// itoa converts val (an int) to a decimal string.
func itoa(val int) string {
if val < 0 {
return "-" + uitoa(uint(-val))
@@ -14,7 +14,7 @@ func itoa(val int) string {
return uitoa(uint(val))
}
-// Convert unsigned integer to decimal string
+// uitoa converts val (a uint) to a decimal string.
func uitoa(val uint) string {
if val == 0 { // avoid string allocation
return "0"
@@ -31,3 +31,35 @@ func uitoa(val uint) string {
buf[i] = byte('0' + val)
return string(buf[i:])
}
+
+// itox converts val (an int) to a hexdecimal string.
+func itox(val int) string {
+ if val < 0 {
+ return "-" + uitox(uint(-val))
+ }
+ return uitox(uint(val))
+}
+
+const hex = "0123456789abcdef"
+
+// uitox converts val (a uint) to a hexdecimal string.
+func uitox(val uint) string {
+ if val == 0 { // avoid string allocation
+ return "0x0"
+ }
+ var buf [20]byte // big enough for 64bit value base 16 + 0x
+ i := len(buf) - 1
+ for val >= 16 {
+ q := val / 16
+ buf[i] = hex[val%16]
+ i--
+ val = q
+ }
+ // val < 16
+ buf[i] = hex[val%16]
+ i--
+ buf[i] = 'x'
+ i--
+ buf[i] = '0'
+ return string(buf[i:])
+}