diff options
author | 2015-10-08 16:41:55 +0000 | |
---|---|---|
committer | 2015-10-09 14:40:01 +0000 | |
commit | 2989c7ce1889b27ccda69b84d04d81e09fcaa311 (patch) | |
tree | f6b869eebf1ca7d516305c550a29485cad005607 /src | |
parent | 3caa2b2425172c1515c6df0a34c188987be7aa11 (diff) |
Remove dashboard
I've got the dashboard building independent of bazel and ready to import into
https://github.com/bazelbuild/dash.
--
MOS_MIGRATED_REVID=104969804
Diffstat (limited to 'src')
17 files changed, 0 insertions, 935 deletions
diff --git a/src/tools/dash/BUILD b/src/tools/dash/BUILD deleted file mode 100644 index a54a263ff0..0000000000 --- a/src/tools/dash/BUILD +++ /dev/null @@ -1,8 +0,0 @@ -load("/tools/build_rules/appengine/appengine", "appengine_war") - -appengine_war( - name = "dash", - data = ["//src/tools/dash/src/main/webapp"], - data_path = "/src/tools/dash/src/main/webapp", - jars = ["//src/tools/dash/src/main/java:java-bin_deploy.jar"], -) diff --git a/src/tools/dash/README.md b/src/tools/dash/README.md deleted file mode 100644 index 88a81a9b51..0000000000 --- a/src/tools/dash/README.md +++ /dev/null @@ -1,71 +0,0 @@ -# A Dashboard for Bazel - -This is a self-hosted dashboard for Bazel. In particular, this runs a server -that turns build results and logs into webpages. - -## Running the server - -Build and run the server: - -```bash -$ bazel build //src/tools/dash:dash -$ bazel-bin/src/tools/dash -``` - -Once you see the log message `INFO: Dev App Server is now running`, you -can visit [http://localhost:8080] to see the main page (which should say "No -builds, yet!"). - -This builds a .war file that can be deployed to AppEngine (although this -doc assumes you'll run it locally). - -_Note: as of this writing, there is no authentication, rate limiting, or other -protection for the dashboard. Anyone who can access the URL can read and write -data to it. You may want to specify the `--address` or `--host` option -(depending on AppEngine SDK version) when you run `dash` to bind the server to -an internal network address._ - -## Configuring Bazel to write results to the dashboard - -You will need to tell Bazel where to send build results. Run `bazel` with the -`--use_dash` and `--dash_url=http://localhost:8080` flags, for -example: - -```bash -$ bazel build --use_dash --dash_url=http://localhost:8080 //foo:bar -``` - -If you don't want to have to specify the flags for every build and test, add -the following lines to your .bazelrc (either in your home directory, -_~/.bazelrc_, or on a per-project basis): - -``` -build --use_dash -build --dash_url=http://localhost:8080 -``` - -Then build results will be sent to the dashboard by default. You can specify -`--use_dash=false` for a particular build if you don't want it sent. - -## Basic security - -Default security of the dashboard is to allow anyone to read and write to it. -Security can then be enforced using IP filtering. However, this is sometime -not sufficient and restricting who can write to the dashboard is generally -a good idea. Bazel supports that to some extent. A secret should be shared -between the Bazel's client and the dashboard. In the dashboard, the secret -can be specified using a `BAZEL_DASH_SECRET` environment variable. In Bazel, -you specify that secret by setting the `--dash_secret` flag which specify a -path to the file containing the secret. - -Example to run it with the development server with secret: - -``` -BAZEL_DASH_SECRET=secret bazel-bin/src/tools/dash & -echo secret >/path/to/secret -bazel test --use_dash --dash_url=http://localhost:8080 --dash_secret=/path/to/secret //test/... -``` - -Please email the -[mailing list](https://groups.google.com/forum/#!forum/bazel-discuss) -with any questions or concerns. diff --git a/src/tools/dash/src/main/java/BUILD b/src/tools/dash/src/main/java/BUILD deleted file mode 100644 index f153a32e7c..0000000000 --- a/src/tools/dash/src/main/java/BUILD +++ /dev/null @@ -1,19 +0,0 @@ -java_binary( - name = "java-bin", - main_class = "does.not.exist", - visibility = ["//src/tools/dash:__pkg__"], - runtime_deps = [":servlets"], -) - -java_library( - name = "servlets", - srcs = glob(["**/*.java"]), - visibility = ["//src/tools/dash/src/test/java/com/google/devtools/dash:__pkg__"], - deps = [ - "@appengine-java//:api", - "//external:javax/servlet/api", - "//src/main/protobuf:proto_dash", - "//third_party:apache_velocity", - "//third_party:guava", - ], -) diff --git a/src/tools/dash/src/main/java/com/google/devtools/dash/BuildViewServlet.java b/src/tools/dash/src/main/java/com/google/devtools/dash/BuildViewServlet.java deleted file mode 100644 index 0f67fc2219..0000000000 --- a/src/tools/dash/src/main/java/com/google/devtools/dash/BuildViewServlet.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2015 The Bazel Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.google.devtools.dash; - -import com.google.appengine.api.datastore.Blob; -import com.google.appengine.api.datastore.DatastoreService; -import com.google.appengine.api.datastore.DatastoreServiceFactory; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.PreparedQuery; -import com.google.appengine.api.datastore.Query; -import com.google.appengine.api.datastore.Query.FilterOperator; -import com.google.appengine.api.datastore.Query.FilterPredicate; -import com.google.common.html.HtmlEscapers; -import com.google.devtools.build.lib.bazel.dash.DashProtos.BuildData; - -import org.apache.velocity.Template; -import org.apache.velocity.VelocityContext; -import org.apache.velocity.app.VelocityEngine; - -import java.io.IOException; -import java.io.StringWriter; - -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * Handles HTTP gets of builds/tests. - */ -public class BuildViewServlet extends HttpServlet { - private DatastoreService datastore; - - public BuildViewServlet() { - super(); - datastore = DatastoreServiceFactory.getDatastoreService(); - } - - @Override - public void doGet(HttpServletRequest req, HttpServletResponse response) throws IOException { - DashRequest request; - try { - request = new DashRequest(req); - } catch (DashRequest.DashRequestException e) { - // TODO(kchodorow): make an error page. - response.setContentType("text/html"); - response.getWriter().println("Error: " + HtmlEscapers.htmlEscaper().escape(e.getMessage())); - return; - } - - BuildData.Builder data = BuildData.newBuilder(); - Query query = new Query(DashRequest.KEY_KIND).setFilter(new FilterPredicate( - DashRequest.BUILD_ID, FilterOperator.EQUAL, request.getBuildId())); - PreparedQuery preparedQuery = datastore.prepare(query); - for (Entity result : preparedQuery.asIterable()) { - data.mergeFrom(BuildData.parseFrom( - ((Blob) result.getProperty(DashRequest.BUILD_DATA)).getBytes())); - } - - VelocityEngine velocityEngine = new VelocityEngine(); - velocityEngine.init(); - Template template = velocityEngine.getTemplate("result.html"); - VelocityContext context = new VelocityContext(); - - context.put("build_data", data); - - StringWriter writer = new StringWriter(); - template.merge(context, writer); - response.setContentType("text/html"); - response.getWriter().println(writer.toString()); - } -} diff --git a/src/tools/dash/src/main/java/com/google/devtools/dash/DashRequest.java b/src/tools/dash/src/main/java/com/google/devtools/dash/DashRequest.java deleted file mode 100644 index 5211ed45a2..0000000000 --- a/src/tools/dash/src/main/java/com/google/devtools/dash/DashRequest.java +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2015 The Bazel Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.google.devtools.dash; - -import com.google.appengine.api.datastore.Blob; -import com.google.appengine.api.datastore.Entity; -import com.google.common.io.ByteStreams; - -import java.io.IOException; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.servlet.http.HttpServletRequest; - -/** - * Parent class for dash-related servlets. - */ -class DashRequest { - public static final String KEY_KIND = "build"; - - public static final String BUILD_ID = "build_id"; - public static final String PAGE_NAME = "page_name"; - public static final String BUILD_DATA = "build_data"; - - // URI is something like "/result/d2c64e09-df4e-461d-869e-33f014488655". - private static final Pattern URI_REGEX = Pattern.compile( - "/(\\w+)/([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})"); - - private final String pageName; - private final String buildId; - private final Blob blob; - - DashRequest(HttpServletRequest request) throws DashRequestException { - Matcher matcher = URI_REGEX.matcher(request.getRequestURI()); - if (matcher.find()) { - pageName = matcher.group(1); - buildId = matcher.group(2); - } else { - throw new DashRequestException("Invalid URI pattern: " + request.getRequestURI()); - } - try { - // Requests are capped at 32MB (see - // https://cloud.google.com/appengine/docs/quotas?csw=1#Requests). - blob = new Blob(ByteStreams.toByteArray(request.getInputStream())); - } catch (IOException e) { - throw new DashRequestException("Could not read request body: " + e.getMessage()); - } - } - - public String getBuildId() { - return buildId; - } - - public Entity getEntity() { - Entity entity = new Entity(DashRequest.KEY_KIND); - entity.setProperty(BUILD_ID, buildId); - entity.setProperty(PAGE_NAME, pageName); - entity.setProperty(BUILD_DATA, blob); - return entity; - } - - static class DashRequestException extends Exception { - public DashRequestException(String message) { - super(message); - } - } -} diff --git a/src/tools/dash/src/main/java/com/google/devtools/dash/StoreServlet.java b/src/tools/dash/src/main/java/com/google/devtools/dash/StoreServlet.java deleted file mode 100644 index 2a00ffb46c..0000000000 --- a/src/tools/dash/src/main/java/com/google/devtools/dash/StoreServlet.java +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2015 The Bazel Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.google.devtools.dash; - -import com.google.appengine.api.datastore.DatastoreService; -import com.google.appengine.api.datastore.DatastoreServiceFactory; - -import java.io.IOException; - -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * Handles storing a test result. - */ -public class StoreServlet extends HttpServlet { - private static final String DASH_SECRET_HEADER = "bazel-dash-secret"; - private static final String SECRET_PARAMETER = "BAZEL_DASH_SECRET"; - - private DatastoreService datastore; - - public StoreServlet() { - super(); - datastore = DatastoreServiceFactory.getDatastoreService(); - } - - @Override - public void doPost(HttpServletRequest req, HttpServletResponse response) throws IOException { - DashRequest request; - if (!doAuthentication(req, response)) { - return; - } - try { - request = new DashRequest(req); - } catch (DashRequest.DashRequestException e) { - response.setContentType("text/json"); - response.getWriter().println( - "{ \"error\": \"" + e.getMessage().replaceAll("\"", "") + "\" }"); - return; - } - - datastore.put(request.getEntity()); - - response.setContentType("text/json"); - response.getWriter().println("{ \"ok\": true }"); - } - - private boolean doAuthentication(HttpServletRequest req, HttpServletResponse response) - throws IOException { - // Authentication using a common secret - String secret = System.getenv(SECRET_PARAMETER); - if (secret != null && !secret.isEmpty()) { - String providedSecret = req.getHeader(DASH_SECRET_HEADER); - if (providedSecret == null || !secureCompare(secret, providedSecret)) { - response.sendError(HttpServletResponse.SC_FORBIDDEN); - return false; - } - } - return true; - } - - // Constant time string comparison. Assume that v1 and v2 are not null. - private boolean secureCompare(String v1, String v2) { - if (v1.length() != v2.length()) { - return false; - } - - int diff = 0; - for (int i = 0; i < v1.length(); i++) { - diff |= v1.charAt(i) ^ v2.charAt(i); - } - return diff == 0; - } -} diff --git a/src/tools/dash/src/main/webapp/BUILD b/src/tools/dash/src/main/webapp/BUILD deleted file mode 100644 index a4f46de041..0000000000 --- a/src/tools/dash/src/main/webapp/BUILD +++ /dev/null @@ -1,8 +0,0 @@ -filegroup( - name = "webapp", - srcs = glob( - ["**"], - exclude = ["BUILD"], - ), - visibility = ["//src/tools/dash:__pkg__"], -) diff --git a/src/tools/dash/src/main/webapp/WEB-INF/appengine-web.xml b/src/tools/dash/src/main/webapp/WEB-INF/appengine-web.xml deleted file mode 100644 index 7118a0ed20..0000000000 --- a/src/tools/dash/src/main/webapp/WEB-INF/appengine-web.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<appengine-web-app xmlns="http://appengine.google.com/ns/1.0"> - <application>dash-of-bazel</application> - <version>1</version> - <threadsafe>true</threadsafe> -</appengine-web-app> diff --git a/src/tools/dash/src/main/webapp/WEB-INF/web.xml b/src/tools/dash/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index a4b6daffee..0000000000 --- a/src/tools/dash/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE web-app PUBLIC -"-//Oracle Corporation//DTD Web Application 2.3//EN" -"http://java.sun.com/dtd/web-app_2_3.dtd"> - -<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5"> - <servlet> - <servlet-name>build</servlet-name> - <servlet-class>com.google.devtools.dash.BuildViewServlet</servlet-class> - </servlet> - <servlet> - <servlet-name>store</servlet-name> - <servlet-class>com.google.devtools.dash.StoreServlet</servlet-class> - </servlet> - - <servlet-mapping> - <servlet-name>build</servlet-name> - <url-pattern>/result/*</url-pattern> - </servlet-mapping> - <servlet-mapping> - <servlet-name>store</servlet-name> - <url-pattern>/start/*</url-pattern> - </servlet-mapping> - <servlet-mapping> - <servlet-name>store</servlet-name> - <url-pattern>/options/*</url-pattern> - </servlet-mapping> - <servlet-mapping> - <servlet-name>store</servlet-name> - <url-pattern>/targets/*</url-pattern> - </servlet-mapping> - <servlet-mapping> - <servlet-name>store</servlet-name> - <url-pattern>/test/*</url-pattern> - </servlet-mapping> - - <welcome-file-list> - <welcome-file>index.html</welcome-file> - </welcome-file-list> -</web-app> diff --git a/src/tools/dash/src/main/webapp/dashboard.css b/src/tools/dash/src/main/webapp/dashboard.css deleted file mode 100644 index d3d3904b11..0000000000 --- a/src/tools/dash/src/main/webapp/dashboard.css +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Base structure - */ - -/* Move down content because we have a fixed navbar that is 50px tall */ -body { - padding-top: 50px; -} - - -/* - * Global add-ons - */ - -.sub-header { - padding-bottom: 10px; - border-bottom: 1px solid #eee; -} - -/* - * Top navigation - * Hide default border to remove 1px line. - */ -.navbar-fixed-top { - border: 0; -} - -/* - * Sidebar - */ - -/* Hide for mobile, show later */ -.sidebar { - display: none; -} -@media (min-width: 768px) { - .sidebar { - position: fixed; - top: 51px; - bottom: 0; - left: 0; - z-index: 1000; - display: block; - padding: 20px; - overflow-x: hidden; - overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */ - background-color: #f5f5f5; - border-right: 1px solid #eee; - } -} - -/* Sidebar navigation */ -.nav-sidebar { - margin-right: -21px; /* 20px padding + 1px border */ - margin-bottom: 20px; - margin-left: -20px; -} -.nav-sidebar > li > a { - padding-right: 20px; - padding-left: 20px; -} -.nav-sidebar > .active > a, -.nav-sidebar > .active > a:hover, -.nav-sidebar > .active > a:focus { - color: #fff; - background-color: #428bca; -} - - -/* - * Main content - */ - -.main { - padding: 20px; -} -@media (min-width: 768px) { - .main { - padding-right: 40px; - padding-left: 40px; - } -} -.main .page-header { - margin-top: 0; -} - - -/* - * Placeholder dashboard ideas - */ - -.placeholders { - margin-bottom: 30px; - text-align: center; -} -.placeholders h4 { - margin-bottom: 0; -} -.placeholder { - margin-bottom: 20px; -} -.placeholder img { - display: inline-block; - border-radius: 50%; -} - -code { - color: #00A388; - background-color: transparent; -} diff --git a/src/tools/dash/src/main/webapp/favicon.ico b/src/tools/dash/src/main/webapp/favicon.ico Binary files differdeleted file mode 100644 index a37c760980..0000000000 --- a/src/tools/dash/src/main/webapp/favicon.ico +++ /dev/null diff --git a/src/tools/dash/src/main/webapp/index.html b/src/tools/dash/src/main/webapp/index.html deleted file mode 100644 index db1b6af926..0000000000 --- a/src/tools/dash/src/main/webapp/index.html +++ /dev/null @@ -1,69 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> - <!-- TODO(kchodorow): make this and result.html inherit from a parent template. --> - <head> - <meta charset="utf-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge"> - <meta name="viewport" content="width=device-width, initial-scale=1"> - <!-- The above 3 meta tags *must* come first in the head; any other head content must come - *after* these tags --> - <meta name="description" content=""> - <meta name="author" content=""> - <link rel="icon" href="/favicon.ico"> - - <title>Build $build_data.getBuildId()</title> - - <!-- Bootstrap core CSS --> - <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" - rel="stylesheet"> - - <!-- Custom styles for this template --> - <link href="/dashboard.css" rel="stylesheet"> - - <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> - <!--[if lt IE 9]> - <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> - <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> - <![endif]--> - </head> - - <body> - - <nav class="navbar navbar-inverse navbar-fixed-top"> - <div class="container-fluid"> - <div class="navbar-header"> - <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" - data-target="#navbar" aria-expanded="false" aria-controls="navbar"> - <span class="sr-only">Toggle navigation</span> - <span class="icon-bar"></span> - <span class="icon-bar"></span> - <span class="icon-bar"></span> - </button> - <a class="navbar-brand" href="#">Dash of Bazel</a> - </div> - <div id="navbar" class="navbar-collapse collapse"> - <ul class="nav navbar-nav navbar-right"> - <li><a href="/">Dashboard</a></li> - <!-- TODO(kchodorow): link to a bazel.io documentation. --> - <li><a href="#todo">Help</a></li> - </ul> - <form class="navbar-form navbar-right"> - <!-- TODO(kchodorow): add fulltext search. --> - <input type="text" class="form-control" placeholder="Search..."> - </form> - </div> - </div> - </nav> - - <div class="container-fluid"> - <!-- TODO(kchodorow): add a list of existing builds. --> - <h2>No builds, yet!</h2> - </div> - - <!-- Bootstrap core JavaScript - ================================================== --> - <!-- Placed at the end of the document so the pages load faster --> - <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> - <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> - </body> -</html> diff --git a/src/tools/dash/src/main/webapp/result.html b/src/tools/dash/src/main/webapp/result.html deleted file mode 100644 index a55e282613..0000000000 --- a/src/tools/dash/src/main/webapp/result.html +++ /dev/null @@ -1,158 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> -<head> - <meta charset="utf-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge"> - <meta name="viewport" content="width=device-width, initial-scale=1"> - <!-- The above 3 meta tags *must* come first in the head; any other head content must come - *after* these tags --> - <meta name="description" content=""> - <meta name="author" content=""> - <link rel="icon" href="/favicon.ico"> - - <title>Build $build_data.getBuildId()</title> - - <!-- Bootstrap core CSS --> - <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" - rel="stylesheet"> - - <!-- Custom styles for this template --> - <link href="/dashboard.css" rel="stylesheet"> - - <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> - <!--[if lt IE 9]> - <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> - <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> - <![endif]--> -</head> - -<body> - -<nav class="navbar navbar-inverse navbar-fixed-top"> - <div class="container-fluid"> - <div class="navbar-header"> - <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" - data-target="#navbar" aria-expanded="false" aria-controls="navbar"> - <span class="sr-only">Toggle navigation</span> - <span class="icon-bar"></span> - <span class="icon-bar"></span> - <span class="icon-bar"></span> - </button> - <a class="navbar-brand" href="#">$build_data.getBuildId()</a> - </div> - <div id="navbar" class="navbar-collapse collapse"> - <ul class="nav navbar-nav navbar-right"> - <li><a href="/">Dashboard</a></li> - <!-- TODO(kchodorow): link to a bazel.io documentation. --> - <li><a href="#">Help</a></li> - </ul> - <form class="navbar-form navbar-right"> - <!-- TODO(kchodorow): add fulltext search. --> - <input type="text" class="form-control" placeholder="Search..."> - </form> - </div> - </div> -</nav> - -<div class="container-fluid"> - <div class="row"> - <div class="col-sm-3 col-md-2 sidebar"> - <ul class="nav nav-sidebar"> - <li class="active"> - <a href="#results"> - Results <span class="sr-only">(current)</span> - </a> - </li> - <li><a href="#command-line">Command line</a></li> - <li><a href="#env">Environment</a></li> - </ul> - </div> - - <div id="results" class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main"> - <h1 class="page-header">bazel $build_data.getCommandName() results</h1> - <div class="table-responsive"> - <table class="table table-striped"> - <thead> - <tr> - <th>Target</th> - <th>Status</th> - </tr> - </thead> - <tbody> - #foreach ( $result in $build_data.getTargetsList() ) - <tr> - #if ( $result.hasTestData() ) - #if ( $result.getTestData().getPassed() ) - <td style="color:#79BD8F;">$result.getLabel()</td> - <td style="color:#79BD8F;">Passed</td> - #else - <td> - <div onclick="$('#log-$velocityCount').toggle();"> - <code style="color:#FF6138; cursor: pointer;">$result.getLabel()</code> - </div> - <pre id="log-$velocityCount" style="display: none;">$result.getTestData().getLog().getContents().toStringUtf8()</pre> - #if ( $result.getTestData().getTruncated() ) - <div>Truncated after 1MB, see local log for full output.</div> - #end - </td> - <td style="color:#FF6138; cursor: pointer;">Failed</td> - #end - #else - <td> - <div> - <code style="color: black; background-color: transparent;">$result.getLabel()</code> - </div> - </td> - <td>Built</td> - #end - </tr> - #end - </tbody> - </table> - </div> - </div> - - <div id="command-line" class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main"> - <h1>bazel command line</h1> - <div> - <code> -bazel -#foreach( $option in $build_data.getCommandLine().getStartupOptionsList()) - #foreach ($value in $option.getValueList())--$option.getName()=$value #end -#end -$build_data.getCommandName() -#foreach( $option in $build_data.getCommandLine().getOptionsList()) - #foreach ($value int $option.getValueList())--$option.getName()=$value #end -#end -#foreach( $residue in $build_data.getCommandLine().getResidueList())$residue #end - </code> - </div> - </div> - - <div id="env" class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main"> - <h1>bazel environment</h1> - <div> - <table> - <tr> - <th>Name</th> - <th>Value</th> - </tr> - #foreach( $env in $build_data.getClientEnvList()) - <tr> - <td><code>$env.getName()</code></td> - <td><code>$env.getValue()</code></td> - </tr> - #end - </pre> - </div> - </div> - </div> -</div> - -<!-- Bootstrap core JavaScript -================================================== --> -<!-- Placed at the end of the document so the pages load faster --> -<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> -<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> -</body> -</html> diff --git a/src/tools/dash/src/test/java/com/google/devtools/dash/AllTests.java b/src/tools/dash/src/test/java/com/google/devtools/dash/AllTests.java deleted file mode 100644 index ada5bab041..0000000000 --- a/src/tools/dash/src/test/java/com/google/devtools/dash/AllTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2015 The Bazel Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.google.devtools.dash; - -import com.google.devtools.build.lib.testutil.ClasspathSuite; - -import org.junit.runner.RunWith; - -/** - * Runs all tests. - */ -@RunWith(ClasspathSuite.class) -public class AllTests { -} diff --git a/src/tools/dash/src/test/java/com/google/devtools/dash/BUILD b/src/tools/dash/src/test/java/com/google/devtools/dash/BUILD deleted file mode 100644 index d65b06c9c1..0000000000 --- a/src/tools/dash/src/test/java/com/google/devtools/dash/BUILD +++ /dev/null @@ -1,34 +0,0 @@ -java_library( - name = "AllTests", - srcs = ["AllTests.java"], - deps = [ - "//src/test/java:testutil", - "//third_party:junit4", - ], -) - -java_library( - name = "util", - srcs = ["ProtoInputStream.java"], - deps = [ - "//external:javax/servlet/api", - "//third_party:protobuf", - ], -) - -java_test( - name = "dash", - srcs = [ - "DashRequestTest.java", - ], - runtime_deps = [":AllTests"], - deps = [ - "@appengine-java//:jars", - "@easymock//jar", - ":util", - "//src/main/protobuf:proto_dash", - "//src/tools/dash/src/main/java:servlets", - "//third_party:junit4", - "//third_party:truth", - ], -) diff --git a/src/tools/dash/src/test/java/com/google/devtools/dash/DashRequestTest.java b/src/tools/dash/src/test/java/com/google/devtools/dash/DashRequestTest.java deleted file mode 100644 index b19c493e84..0000000000 --- a/src/tools/dash/src/test/java/com/google/devtools/dash/DashRequestTest.java +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright 2015 The Bazel Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.google.devtools.dash; - -import static com.google.common.truth.Truth.assertThat; -import static org.easymock.EasyMock.createMock; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.replay; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - -import com.google.appengine.api.datastore.Blob; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig; -import com.google.appengine.tools.development.testing.LocalServiceTestHelper; -import com.google.devtools.build.lib.bazel.dash.DashProtos; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -import javax.servlet.http.HttpServletRequest; - -/** - * Tests for {@link DashRequest}. - */ -@RunWith(JUnit4.class) -public class DashRequestTest { - - private final LocalServiceTestHelper helper = - new LocalServiceTestHelper(new LocalDatastoreServiceTestConfig()); - private HttpServletRequest request; - - @Before - public void setUp() { - helper.setUp(); - request = createMock(HttpServletRequest.class); - } - - @After - public void tearDown() { - helper.tearDown(); - } - - @Test - public void testUriParsing() throws Exception { - final String buildId = "3b9a81d9-0ed3-48d2-84c6-6296aecc21e6"; - final DashProtos.BuildData data = DashProtos.BuildData.newBuilder().setBuildId(buildId).build(); - expect(request.getRequestURI()).andReturn("/result/3b9a81d9-0ed3-48d2-84c6-6296aecc21e6"); - expect(request.getInputStream()).andReturn(new ProtoInputStream(data)); - replay(request); - - DashRequest dashRequest = new DashRequest(request); - assertEquals(buildId, dashRequest.getBuildId()); - Entity entity = dashRequest.getEntity(); - assertEquals(buildId, entity.getProperty(DashRequest.BUILD_ID)); - assertEquals("result", entity.getProperty(DashRequest.PAGE_NAME)); - assertEquals(data, DashProtos.BuildData.parseFrom( - ((Blob) entity.getProperty(DashRequest.BUILD_DATA)).getBytes())); - } - - private void uriError(String uri) { - expect(request.getRequestURI()).andReturn(uri).times(2); - replay(request); - - try { - new DashRequest(request); - fail("Should have thrown"); - } catch (DashRequest.DashRequestException e) { - assertThat(e.getMessage()).contains("Invalid URI pattern: " + uri); - } - } - - @Test - public void testInvalidUuid() { - uriError("/result/3b9a81d9-0ed3-48d2"); - } - - @Test - public void testMissingPageName() { - uriError("/3b9a81d9-0ed3-48d2-84c6-6296aecc21e6"); - } - -} diff --git a/src/tools/dash/src/test/java/com/google/devtools/dash/ProtoInputStream.java b/src/tools/dash/src/test/java/com/google/devtools/dash/ProtoInputStream.java deleted file mode 100644 index 5dbbc6d4b7..0000000000 --- a/src/tools/dash/src/test/java/com/google/devtools/dash/ProtoInputStream.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2015 The Bazel Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package com.google.devtools.dash; - -import com.google.protobuf.Message; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; - -import javax.servlet.ServletInputStream; - -/** - * Input stream for testing. - */ -public class ProtoInputStream extends ServletInputStream { - InputStream stream; - - ProtoInputStream(Message message) { - stream = new ByteArrayInputStream(message.toByteArray()); - } - - @Override - public int read() throws IOException { - return stream.read(); - } - -} |