Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: runtime/observatory/HACKING.md

Issue 2079953002: Added HACKING.md to observatory (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Hacking Observatory
2
3 These instructions will guide you through the Observatory development and testin g workflow.
Cutch 2016/06/20 14:06:12 (here and elsewhere) lines must be <= 80 columns l
cbernaschina 2016/06/20 14:33:47 Done.
4
5 ## SDK Setup & Build
6 Getting ready to start.
7
8 Before starting hacking observatory follow [the instructions][1] to have a worki ng environment in which you are able to build and test the Dart SDK.
9
10 ## Run existing tests
11 Before hacking Observatory let's run the existing Observatory tests.
12
13 From the root of the sdk repository run:
14 ```
15 $ ./tools/test.py -mrelease service
16 ```
17
18 ## Develop with Dartium ~ Suggested
19 If you want to avoid to trigger a new compilation to JavaScript for each edit yo u do, you can use a modified version of Chromium named Dartium that will interpr et you dart code directly.
20
21 You can obtain Dartium in two different ways:
22 1. [Download the binaries][2]
23 2. [Build Dartium from the source code][3]
24
25 ## Serve Observatory
26 In order to avoid a complete build of the sdk for each change you do to Observat ory, we are going to __serve__ it directly.
27
28 Use __pub__ to __serve__ Observatory:
29 ```
30 [...]/runtime/observatory$ pub serve
31 ```
32
33 ## Open Observatory
34 You can open the development version of Observatory from Chrome/Chromium/__Darti um__ by navigating to [localhost:8080][4]
35
36 Every change you make to the Observatory source code will be visible by simply _ _refreshing__ the page in the browser.
37
38 ## Connect to a VM
39 Start a Dart VM with the ``--observe`` flag (as explained in the [get started gu ide][5]) and connect your Observatory instance to that VM.
40
41 ## Code Reviews
42 The development workflow of Dart (and Observatory) is based on code reviews.
43
44 Follow the [code review instructions][6] to be able to successfully submit your code.
45
46 The main reviewers for Observatory related CLs are:
47 - turnidge
48 - johnmccutchan
49 - rmacnak
50
51 ## Write a new service test
52 All the service tests are located in the ```tests/service``` folder.
53 Test file names follow the convention ```<description>_test.dart``` (e.g. ```a_b rief_description_test.dart```).
54
55 The test is generally structured in the following way.
56 ```dart
57 import 'package:test/test.dart';
58
59 main() {
60 // Some code that you need to test.
61 var a = 1 + 2;
62
63 // Some assertions to check the results.
64 expect(a, equal(3));
65 }
66 ```
67 See the official [test library][7] instructions;
68
69 The ```test_helper.dart``` file expose some functions that allow to run a part o f the code into another __VM__.
70
71 To test synchronous operations:
72 ```dart
73 import 'test_helper.dart';
74
75 code() {
76 // Write the code you want to be execute into another VM.
77 }
78
79 var tests = [
80 // A series of tests that you want to run against the above code.
81 (Isolate isolate) async {
82 await isolate.reload();
83 // Use the isolate to communicate to the VM.
84 }
85 ];
86
87 main(args) => runIsolateTestsSynchronous(args,
88 tests,
89 testeeConcurrent: code);
90 ```
91
92 In order to test asynchronous operations:
93 ```dart
94 import 'test_helper.dart';
95
96 code() async{
97 // Write the asynchronous code you want to be execute into another VM.
98 }
99
100 var tests = [
101 // A series of tests that you want to run against the above code.
102 (Isolate isolate) async {
103 await isolate.reload();
104 // Use the isolate to communicate to the VM.
105 }
106 ];
107
108 main(args) async => runIsolateTests(args,
109 tests,
110 testeeConcurrent: code);
111 ```
112
113 Both ```runIsolateTests``` and ```runIsolateTestsSynchronous``` have the followi ng named parameters:
114 - __testeeBefore__ (void()) a function that is going to be executed before the test
115 - __testeeConcurrent__ (void()) test that is going to be executed
116 - __pause_on_start__ (bool, default: false) pause the Isolate before the first instruction
117 - __pause_on_exit__ (bool, default: false) pause the Isolate after the last ins truction
118 - __pause_on_unhandled_exceptions__ (bool, default: false) pause the Isolate at an unhandled exception
119 - __trace_service__ (bool, default: false) trace VM service requests
120 - __trace_compiler__ (bool, default: false) trace compiler operations
121 - __verbose_vm__ (bool, default: false) verbose logging
122
123
124 Some common and reusable test are available from ```service_test_common.dart```:
125 - hasPausedFor
126 - hasStoppedAtBreakpoint
127 - hasStoppedWithUnhandledException
128 - hasStoppedAtExit
129 - hasPausedAtStart
130 - stoppedAtLine
131
132 and utility functions:
133 - subscribeToStream
134 - cancelStreamSubscription
135 - asyncStepOver
136 - setBreakpointAtLine
137 - resumeIsolate
138 - resumeAndAwaitEvent
139 - resumeIsolateAndAwaitEvent
140 - stepOver
141 - getClassFromRootLib
142 - rootLibraryFieldValue
143
144 ## Run your tests
145 See: __Run existing tests__
146
147 [1]: https://github.com/dart-lang/sdk/wiki/Building "Building the Dart SDK"
148 [2]: https://www.dartlang.org/tools/dartium/ "Download Dartium"
149 [3]: https://github.com/dart-lang/sdk/wiki/Building-Dartium "Build Dartium"
150 [4]: http://localhost:8080/ "Open Observatory"
151 [5]: https://dart-lang.github.io/observatory/get-started.html "Observatory get s tarted"
152 [6]: https://github.com/dart-lang/sdk/wiki/Code-review-workflow-with-GitHub-and- reitveld "Code Review"
153 [7]: https://pub.dartlang.org/packages/test "Test Library"
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698