Commit 7fc64a2a authored by Russ Cox's avatar Russ Cox

cmd/dist: redirect acid output to file to separate from errors

If runtime's proc.c does not compile, cmd/dist used to show
the compile errors in a sea of acid output, making them impossible
to find. Change the command invocation to write the acid output
to a file, so that the errors are the only thing shown on failure.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7221082
parent ca727f11
...@@ -205,7 +205,7 @@ mkzasm(char *dir, char *file) ...@@ -205,7 +205,7 @@ mkzasm(char *dir, char *file)
fatal("unknown $GOOS/$GOARCH in mkzasm"); fatal("unknown $GOOS/$GOARCH in mkzasm");
ok: ok:
// Run 6c -D GOOS_goos -D GOARCH_goarch -I workdir -a proc.c // Run 6c -D GOOS_goos -D GOARCH_goarch -I workdir -a -n -o workdir/proc.acid proc.c
// to get acid [sic] output. // to get acid [sic] output.
vreset(&argv); vreset(&argv);
vadd(&argv, bpathf(&b, "%s/%sc", tooldir, gochar)); vadd(&argv, bpathf(&b, "%s/%sc", tooldir, gochar));
...@@ -216,8 +216,12 @@ ok: ...@@ -216,8 +216,12 @@ ok:
vadd(&argv, "-I"); vadd(&argv, "-I");
vadd(&argv, bprintf(&b, "%s", workdir)); vadd(&argv, bprintf(&b, "%s", workdir));
vadd(&argv, "-a"); vadd(&argv, "-a");
vadd(&argv, "-n");
vadd(&argv, "-o");
vadd(&argv, bpathf(&b, "%s/proc.acid", workdir));
vadd(&argv, "proc.c"); vadd(&argv, "proc.c");
runv(&in, dir, CheckExit, &argv); runv(nil, dir, CheckExit, &argv);
readfile(&in, bpathf(&b, "%s/proc.acid", workdir));
// Convert input like // Convert input like
// aggr G // aggr G
...@@ -288,11 +292,12 @@ mkzruntimedefs(char *dir, char *file) ...@@ -288,11 +292,12 @@ mkzruntimedefs(char *dir, char *file)
{ {
int i, skip; int i, skip;
char *p; char *p;
Buf in, b, out; Buf in, b, b1, out;
Vec argv, lines, fields, seen; Vec argv, lines, fields, seen;
binit(&in); binit(&in);
binit(&b); binit(&b);
binit(&b1);
binit(&out); binit(&out);
vinit(&argv); vinit(&argv);
vinit(&lines); vinit(&lines);
...@@ -308,7 +313,7 @@ mkzruntimedefs(char *dir, char *file) ...@@ -308,7 +313,7 @@ mkzruntimedefs(char *dir, char *file)
); );
// Run 6c -D GOOS_goos -D GOARCH_goarch -I workdir -q // Run 6c -D GOOS_goos -D GOARCH_goarch -I workdir -q -n -o workdir/runtimedefs
// on each of the runtimedefs C files. // on each of the runtimedefs C files.
vadd(&argv, bpathf(&b, "%s/%sc", tooldir, gochar)); vadd(&argv, bpathf(&b, "%s/%sc", tooldir, gochar));
vadd(&argv, "-D"); vadd(&argv, "-D");
...@@ -318,11 +323,15 @@ mkzruntimedefs(char *dir, char *file) ...@@ -318,11 +323,15 @@ mkzruntimedefs(char *dir, char *file)
vadd(&argv, "-I"); vadd(&argv, "-I");
vadd(&argv, bprintf(&b, "%s", workdir)); vadd(&argv, bprintf(&b, "%s", workdir));
vadd(&argv, "-q"); vadd(&argv, "-q");
vadd(&argv, "-n");
vadd(&argv, "-o");
vadd(&argv, bpathf(&b, "%s/runtimedefs", workdir));
vadd(&argv, ""); vadd(&argv, "");
p = argv.p[argv.len-1]; p = argv.p[argv.len-1];
for(i=0; i<nelem(runtimedefs); i++) { for(i=0; i<nelem(runtimedefs); i++) {
argv.p[argv.len-1] = runtimedefs[i]; argv.p[argv.len-1] = runtimedefs[i];
runv(&b, dir, CheckExit, &argv); runv(nil, dir, CheckExit, &argv);
readfile(&b, bpathf(&b1, "%s/runtimedefs", workdir));
bwriteb(&in, &b); bwriteb(&in, &b);
} }
argv.p[argv.len-1] = p; argv.p[argv.len-1] = p;
...@@ -364,6 +373,7 @@ mkzruntimedefs(char *dir, char *file) ...@@ -364,6 +373,7 @@ mkzruntimedefs(char *dir, char *file)
bfree(&in); bfree(&in);
bfree(&b); bfree(&b);
bfree(&b1);
bfree(&out); bfree(&out);
vfree(&argv); vfree(&argv);
vfree(&lines); vfree(&lines);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment