Make powercycle a library

Also make the pinging of the actual hardware optional.

This speeds up the --list and allows powercycle to run when its not on
the same network as the powercycle things (e.g. in the cloud for power.skia.org)

Bug: skia:
Change-Id: Ie85ebc5f970570afd84f7ea07a12f45b15f2cc41
Reviewed-on: https://skia-review.googlesource.com/17989
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Stephan Altmueller <stephana@google.com>
7 files changed
tree: fb48786489d61e6b3b694d19afe18286c401696d
  1. android_ingest/
  2. android_stats/
  3. appengine_scripts/
  4. autoroll/
  5. bash/
  6. blamer/
  7. chromeextensions/
  8. comments/
  9. compute_engine_scripts/
  10. contest/
  11. cq_watcher/
  12. ct/
  13. datahopper/
  14. datahopper_internal/
  15. debugger/
  16. doc/
  17. fiddle/
  18. flakiness/
  19. fuzzer/
  20. get_service_account/
  21. go/
  22. golden/
  23. grafana/
  24. imageinfo/
  25. infra/
  26. logmetrics/
  27. misc/
  28. pdfium/
  29. perdiff/
  30. perf/
  31. power/
  32. prober/
  33. prometheus/
  34. proxy/
  35. pulld/
  36. push/
  37. res/
  38. scripts/
  39. skfe/
  40. skolo/
  41. status/
  42. swarming_logger/
  43. task_scheduler/
  44. tools/
  45. tracedb/
  46. webtools/
  47. .gitattributes
  48. .gitignore
  49. codereview.settings
  50. DEPS
  51. launch.md
  52. LICENSE
  53. Makefile
  54. PRESUBMIT.py
  55. README.md
  56. run_unittests
  57. run_unittests.go
  58. STYLEGUIDE.md
  59. whitespace.txt
  60. whitespace2.txt
README.md

Skia-Buildbot Repository

This repo contains infrastructure code for Skia.

Getting the Source Code

The main source code repository is a Git repository hosted at https://skia.googlesource.com/buildbot. Although it is possible to check out this repository directly with git clone or using gclient fetch, it is preferred to use go get so that the code is arranged correctly for Go. If this is your first time working on Go code, read about the GOPATH environment variable. Make sure that $GOPATH/bin comes before /usr/bin in your PATH. If you have GOPATH set, run:

$ go get -u -t go.skia.org/infra/...

This fetches the repository into your $GOPATH directory along with all the Go dependencies. Note: go.skia.org is a custom import path and will only work if used like the examples here.

Install Node.js (not as root) and add the bin dir to your path. Optionally run npm install npm -g, as suggested by the npm getting started doc.

Install other dependencies:

$ sudo apt-get install python-django
$ go get github.com/kisielk/errcheck \
  golang.org/x/tools/cmd/goimports \
  github.com/luci/luci-go/client/cmd/isolate
$ npm install -g polylint bower

Build from GOPATH:

$ cd $GOPATH/src/go.skia.org/infra/
$ make all

Database Setup for Testing

Tests which use the database package's testutils require you to have a MySQL instance running with a database named “sk_testing” and users called “readwrite” and “test_root” with appropriate permissions for sk_testing. The ‘setup_test_db’ script in ‘go/database’ is included for convenience in setting up this test database and user.

Go tests require a local installation of MySQL. For a Debian based distro:

$ sudo apt-get install mysql-client mysql-server

Leave the root password blank.

Then, to set up local versions of the production databases:

$ cd $GOPATH/src/go.skia.org/infra/go/database
$ ./setup_test_db

Running unit tests

Install Cloud SDK.

Use this command to run the presubmit tests:

$ ./run_unittests --small