Skip to content

Commit 0b90ff7

Browse files
Eugene OstroukhovMyles Borins
Eugene Ostroukhov
authored and
Myles Borins
committed
inspector: introduce a smoke test
This test executes a simple debug session over the inspector protocol. PR-URL: #8429 Reviewed-By: ofrobots - Ali Ijaz Sheikh <[email protected]>
1 parent 3222b66 commit 0b90ff7

10 files changed

+630
-6
lines changed

Makefile

+5-2
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ test: all
119119
$(MAKE) build-addons
120120
$(MAKE) cctest
121121
$(PYTHON) tools/test.py --mode=release -J \
122-
addons doctool known_issues message pseudo-tty parallel sequential
122+
addons doctool inspector known_issues message pseudo-tty parallel sequential
123123
$(MAKE) lint
124124

125125
test-parallel: all
@@ -193,7 +193,7 @@ test-all-valgrind: test-build
193193
$(PYTHON) tools/test.py --mode=debug,release --valgrind
194194

195195
CI_NATIVE_SUITES := addons
196-
CI_JS_SUITES := doctool known_issues message parallel pseudo-tty sequential
196+
CI_JS_SUITES := doctool inspector known_issues message parallel pseudo-tty sequential
197197

198198
# Build and test addons without building anything else
199199
test-ci-native: | test/addons/.buildstamp
@@ -233,6 +233,9 @@ test-internet: all
233233
test-debugger: all
234234
$(PYTHON) tools/test.py debugger
235235

236+
test-inspector: all
237+
$(PYTHON) tools/test.py inspector
238+
236239
test-known-issues: all
237240
$(PYTHON) tools/test.py known_issues
238241

src/inspector_agent.cc

+3
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ void PrintDebuggerReadyMessage(int port) {
4848
"@%s/inspector.html?"
4949
"experiments=true&v8only=true&ws=localhost:%d/node\n",
5050
port, DEVTOOLS_HASH, port);
51+
fflush(stderr);
5152
}
5253

5354
bool AcceptsConnection(inspector_socket_t* socket, const std::string& path) {
@@ -525,6 +526,7 @@ bool AgentImpl::IsStarted() {
525526
void AgentImpl::WaitForDisconnect() {
526527
shutting_down_ = true;
527528
fprintf(stderr, "Waiting for the debugger to disconnect...\n");
529+
fflush(stderr);
528530
inspector_->runMessageLoopOnPause(0);
529531
}
530532

@@ -620,6 +622,7 @@ bool AgentImpl::OnInspectorHandshakeIO(inspector_socket_t* socket,
620622
return false;
621623
default:
622624
UNREACHABLE();
625+
return false;
623626
}
624627
}
625628

src/inspector_socket.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static void dump_hex(const char* buf, size_t len) {
3333
while (ptr < end) {
3434
cptr = ptr;
3535
for (i = 0; i < 16 && ptr < end; i++) {
36-
printf("%2.2X ", *(ptr++));
36+
printf("%2.2X ", static_cast<unsigned char>(*(ptr++)));
3737
}
3838
for (i = 72 - (i * 4); i > 0; i--) {
3939
printf(" ");

test/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ Tests for garbage collection related functionality.
5454
|:----------:|
5555
| No |
5656

57+
58+
### inspector
59+
60+
Tests for the V8 inspector integration.
61+
62+
| Runs on CI |
63+
|:----------:|
64+
| Yes |
65+
5766
### internet
5867

5968
Tests that make real outbound connections (mainly networking related modules).

test/fixtures/loop.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
var t = 1;
2+
var k = 1;
3+
console.log('A message', 5);
4+
while (t > 0) {
5+
if (t++ === 1000) {
6+
t = 0;
7+
console.log('Outputed message #' + k++);
8+
}
9+
}
10+
process.exit(55);

0 commit comments

Comments
 (0)