aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/csource
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-09-06 10:54:14 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-09-06 10:56:09 +0200
commit596466b38cd4e2de23df479ffd78dece9966d875 (patch)
treeade7a76b932f6311f505c4615755a56997411035 /pkg/csource
parent873745f2ff183dcbc303a504683ccaa3a472a635 (diff)
pkg/runtest: fixes for fuchsia
Add simple fuchsia program, the one that is run during image testing. Fix csource errno printing for fuchsia. Fix creation of executable files (chmod is not implemented on fuchsia). Check that we get signal/coverage from all syscalls.
Diffstat (limited to 'pkg/csource')
-rw-r--r--pkg/csource/csource.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/pkg/csource/csource.go b/pkg/csource/csource.go
index 69be3ff2a..49431f655 100644
--- a/pkg/csource/csource.go
+++ b/pkg/csource/csource.go
@@ -247,7 +247,13 @@ func (ctx *context) emitCall(w *bytes.Buffer, call prog.ExecCall, ci int, haveCo
}
fmt.Fprintf(w, ");\n")
if trace {
- fmt.Fprintf(w, "\tprintf(\"### call=%v errno=%%u\\n\", res == -1 ? errno : 0);\n", ci)
+ cast := ""
+ if !native && !strings.HasPrefix(callName, "syz_") {
+ // Potentially we casted a function returning int to a function returning long.
+ // So instead of long -1 we can get 0x00000000ffffffff. Sign extend it to long.
+ cast = "(long)(int)"
+ }
+ fmt.Fprintf(w, "\tprintf(\"### call=%v errno=%%u\\n\", %vres == -1 ? errno : 0);\n", ci, cast)
}
}