Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
b3601a5c
Commit
b3601a5c
authored
Oct 21, 2010
by
Andrew Gerrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gobuilder: write build and benchmarking logs to disk
R=rsc CC=golang-dev
https://golang.org/cl/2637041
parent
7de5e6e8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
12 deletions
+25
-12
exec.go
misc/dashboard/builder/exec.go
+16
-5
hg.go
misc/dashboard/builder/hg.go
+1
-1
main.go
misc/dashboard/builder/main.go
+8
-6
No files found.
misc/dashboard/builder/exec.go
View file @
b3601a5c
...
...
@@ -3,6 +3,7 @@ package main
import
(
"bytes"
"exec"
"io"
"os"
"strings"
)
...
...
@@ -21,8 +22,9 @@ func run(envv []string, dir string, argv ...string) os.Error {
return
p
.
Close
()
}
// runLog runs a process and returns the combined stdout/stderr
func
runLog
(
envv
[]
string
,
dir
string
,
argv
...
string
)
(
output
string
,
exitStatus
int
,
err
os
.
Error
)
{
// runLog runs a process and returns the combined stdout/stderr,
// as well as writing it to logfile (if specified).
func
runLog
(
envv
[]
string
,
logfile
,
dir
string
,
argv
...
string
)
(
output
string
,
exitStatus
int
,
err
os
.
Error
)
{
bin
,
err
:=
pathLookup
(
argv
[
0
])
if
err
!=
nil
{
return
...
...
@@ -34,15 +36,24 @@ func runLog(envv []string, dir string, argv ...string) (output string, exitStatu
}
defer
p
.
Close
()
b
:=
new
(
bytes
.
Buffer
)
_
,
err
=
b
.
ReadFrom
(
p
.
Stdout
)
var
w
io
.
Writer
=
b
if
logfile
!=
""
{
f
,
err
:=
os
.
Open
(
logfile
,
os
.
O_WRONLY
|
os
.
O_CREATE
|
os
.
O_APPEND
,
0644
)
if
err
!=
nil
{
return
}
defer
f
.
Close
()
w
=
io
.
MultiWriter
(
f
,
b
)
}
_
,
err
=
io
.
Copy
(
w
,
p
.
Stdout
)
if
err
!=
nil
{
return
}
w
,
err
:=
p
.
Wait
(
0
)
w
ait
,
err
:=
p
.
Wait
(
0
)
if
err
!=
nil
{
return
}
return
b
.
String
(),
w
.
WaitStatus
.
ExitStatus
(),
nil
return
b
.
String
(),
w
ait
.
WaitStatus
.
ExitStatus
(),
nil
}
// Find bin in PATH if a relative or absolute path hasn't been specified
...
...
misc/dashboard/builder/hg.go
View file @
b3601a5c
...
...
@@ -45,7 +45,7 @@ func getCommit(rev string) (c Commit, err os.Error) {
func
getCommitParts
(
rev
string
)
(
parts
[]
string
,
err
os
.
Error
)
{
const
format
=
"{rev}>{node}>{author|escape}>{date}>{desc}"
s
,
_
,
err
:=
runLog
(
nil
,
goroot
,
s
,
_
,
err
:=
runLog
(
nil
,
""
,
goroot
,
"hg"
,
"log"
,
"-r"
,
rev
,
"-l"
,
"1"
,
"--template"
,
format
)
if
err
!=
nil
{
return
...
...
misc/dashboard/builder/main.go
View file @
b3601a5c
...
...
@@ -82,7 +82,7 @@ func main() {
if
*
buildRevision
!=
""
{
c
,
err
:=
getCommit
(
*
buildRevision
)
if
err
!=
nil
{
log
.
Exit
(
"Error finding revision:"
,
err
)
log
.
Exit
(
"Error finding revision:
"
,
err
)
}
for
_
,
b
:=
range
builders
{
if
err
:=
b
.
buildCommit
(
c
);
err
!=
nil
{
...
...
@@ -138,7 +138,8 @@ func runBenchmark(r BenchRequest) {
"GOARCH="
+
r
.
builder
.
goarch
,
"PATH="
+
bin
+
":"
+
os
.
Getenv
(
"PATH"
),
}
benchLog
,
_
,
err
:=
runLog
(
env
,
pkg
,
"gomake"
,
"bench"
)
logfile
:=
path
.
Join
(
r
.
path
,
"bench.log"
)
benchLog
,
_
,
err
:=
runLog
(
env
,
logfile
,
pkg
,
"gomake"
,
"bench"
)
if
err
!=
nil
{
log
.
Println
(
r
.
builder
.
name
,
"gomake bench:"
,
err
)
return
...
...
@@ -195,7 +196,6 @@ func (b *Builder) build() bool {
if
c
==
nil
{
return
false
}
log
.
Println
(
b
.
name
,
"building"
,
c
.
num
)
err
=
b
.
buildCommit
(
*
c
)
if
err
!=
nil
{
log
.
Println
(
err
)
...
...
@@ -233,6 +233,8 @@ func (b *Builder) buildCommit(c Commit) (err os.Error) {
}
}()
log
.
Println
(
b
.
name
,
"building"
,
c
.
num
)
// create place in which to do work
workpath
:=
path
.
Join
(
buildroot
,
b
.
name
+
"-"
+
strconv
.
Itoa
(
c
.
num
))
err
=
os
.
Mkdir
(
workpath
,
mkdirPerm
)
...
...
@@ -269,7 +271,8 @@ func (b *Builder) buildCommit(c Commit) (err os.Error) {
srcDir
:=
path
.
Join
(
workpath
,
"go"
,
"src"
)
// build
buildLog
,
status
,
err
:=
runLog
(
env
,
srcDir
,
*
buildCmd
)
logfile
:=
path
.
Join
(
workpath
,
"build.log"
)
buildLog
,
status
,
err
:=
runLog
(
env
,
logfile
,
srcDir
,
*
buildCmd
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"all.bash: %s"
,
err
)
}
...
...
@@ -311,8 +314,7 @@ func (b *Builder) buildCommit(c Commit) (err os.Error) {
if
err
!=
nil
{
return
fmt
.
Errorf
(
"tar: %s"
,
err
)
}
err
=
run
(
nil
,
workpath
,
"python"
,
path
.
Join
(
goroot
,
codePyScript
),
err
=
run
(
nil
,
workpath
,
path
.
Join
(
goroot
,
codePyScript
),
"-s"
,
release
,
"-p"
,
codeProject
,
"-u"
,
b
.
codeUsername
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment