Skip to content

Commit

Permalink
inspector: introduce a smoke test
Browse files Browse the repository at this point in the history
This test executes a simple debug session over the inspector protocol.

PR-URL: #8429
Reviewed-By: ofrobots - Ali Ijaz Sheikh <ofrobots@google.com>
  • Loading branch information
Eugene Ostroukhov authored and ofrobots committed Sep 19, 2016
1 parent c5545f2 commit b4a249f
Show file tree
Hide file tree
Showing 10 changed files with 630 additions and 6 deletions.
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ test: all
$(MAKE) build-addons
$(MAKE) cctest
$(PYTHON) tools/test.py --mode=release -J \
addons doctool known_issues message pseudo-tty parallel sequential
addons doctool inspector known_issues message pseudo-tty parallel sequential
$(MAKE) lint

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

CI_NATIVE_SUITES := addons
CI_JS_SUITES := doctool known_issues message parallel pseudo-tty sequential
CI_JS_SUITES := doctool inspector known_issues message parallel pseudo-tty sequential

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

test-inspector: all
$(PYTHON) tools/test.py inspector

test-known-issues: all
$(PYTHON) tools/test.py known_issues

Expand Down
3 changes: 3 additions & 0 deletions src/inspector_agent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ void PrintDebuggerReadyMessage(int port) {
"@%s/inspector.html?"
"experiments=true&v8only=true&ws=localhost:%d/node\n",
port, DEVTOOLS_HASH, port);
fflush(stderr);
}

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

Expand Down Expand Up @@ -620,6 +622,7 @@ bool AgentImpl::OnInspectorHandshakeIO(inspector_socket_t* socket,
return false;
default:
UNREACHABLE();
return false;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/inspector_socket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static void dump_hex(const char* buf, size_t len) {
while (ptr < end) {
cptr = ptr;
for (i = 0; i < 16 && ptr < end; i++) {
printf("%2.2X ", *(ptr++));
printf("%2.2X ", static_cast<unsigned char>(*(ptr++)));
}
for (i = 72 - (i * 4); i > 0; i--) {
printf(" ");
Expand Down
9 changes: 9 additions & 0 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ Tests for garbage collection related functionality.
|:----------:|
| No |


### inspector

Tests for the V8 inspector integration.

| Runs on CI |
|:----------:|
| Yes |

### internet

Tests that make real outbound connections (mainly networking related modules).
Expand Down
10 changes: 10 additions & 0 deletions test/fixtures/loop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
var t = 1;
var k = 1;
console.log('A message', 5);
while (t > 0) {
if (t++ === 1000) {
t = 0;
console.log('Outputed message #' + k++);
}
}
process.exit(55);
Loading

0 comments on commit b4a249f

Please sign in to comment.