Skip to content

Commit

Permalink
Be a little more assertive with how we use JSON and Curl. Also only c…
Browse files Browse the repository at this point in the history
…heck for environment variables when codespeed is true
  • Loading branch information
staticfloat committed Jul 16, 2013
1 parent bb5e7ab commit e5101d2
Showing 1 changed file with 31 additions and 24 deletions.
55 changes: 31 additions & 24 deletions test/perf/perfutil.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,42 @@ const ntrials = 5
print_output = isempty(ARGS)
codespeed = length(ARGS) > 0 && ARGS[1] == "codespeed"

using JSON
using Curl

# Ensure that we've got the environment variables we want:
if !haskey(ENV, "JULIA_FLAVOR")
error( "You must provide the JULIA_FLAVOR environment variable identifying this julia build!" )
try
Pkg.init()
Pkg.add("JSON")
Pkg.add("Curl")
end

if !haskey(ENV, "JULIA_BRANCH")
error( "You must provide the JULIA_BRANCH environment variable identifying the branch this julia build grows on!" )
end
if( codespeed )
using JSON
using Curl

if !haskey(ENV, "JULIA_COMMIT_DATE")
error( "You must provide the JULIA_COMMIT_DATE environment variable in the form YYYY-MM-DD HH:MM:SS[TZ]" )
end
# Ensure that we've got the environment variables we want:
if !haskey(ENV, "JULIA_FLAVOR")
error( "You must provide the JULIA_FLAVOR environment variable identifying this julia build!" )
end

# Setup codespeed data dict for submissions to codespeed's JSON endpoint. These parameters
# are constant across all benchmarks, so we'll just let them sit here for now
csdata = Dict()
#csdata["commitid"] = Base.BUILD_INFO.commit
csdata["commitid"] = Base.VERSION_COMMIT
csdata["project"] = "Julia"
#csdata["branch"] = Base.BUILD_INFO.branch
csdata["branch"] = ENV["JULIA_BRANCH"]
csdata["executable"] = ENV["JULIA_FLAVOR"]
csdata["environment"] = chomp(readall(`hostname`))
#csdata["result_date"] = join( split(Base.BUILD_INFO.date_string)[1:2], " " ) #Cut the timezone out
csdata["result_date"] = join( split(ENV["JULIA_COMMIT_DATE"])[1:2], " " ) #Cut the timezone out
if !haskey(ENV, "JULIA_BRANCH")
error( "You must provide the JULIA_BRANCH environment variable identifying the branch this julia build grows on!" )
end

if !haskey(ENV, "JULIA_COMMIT_DATE")
error( "You must provide the JULIA_COMMIT_DATE environment variable in the form YYYY-MM-DD HH:MM:SS[TZ]" )
end

# Setup codespeed data dict for submissions to codespeed's JSON endpoint. These parameters
# are constant across all benchmarks, so we'll just let them sit here for now
csdata = Dict()
#csdata["commitid"] = Base.BUILD_INFO.commit
csdata["commitid"] = Base.VERSION_COMMIT
csdata["project"] = "Julia"
#csdata["branch"] = Base.BUILD_INFO.branch
csdata["branch"] = ENV["JULIA_BRANCH"]
csdata["executable"] = ENV["JULIA_FLAVOR"]
csdata["environment"] = chomp(readall(`hostname`))
#csdata["result_date"] = join( split(Base.BUILD_INFO.date_string)[1:2], " " ) #Cut the timezone out
csdata["result_date"] = join( split(ENV["JULIA_COMMIT_DATE"])[1:2], " " ) #Cut the timezone out
end

# Takes in the raw array of values in vals, along with the benchmark name, description, unit and whether less is better
function submit_to_codespeed(vals,name,desc,unit,unit_title,lessisbetter=true)
Expand Down

0 comments on commit e5101d2

Please sign in to comment.