Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inspector: introduce a smoke test for inspector #8429

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated change. Is it to squelch a compiler warning?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be a VC++ warning. I fixed it as I was testing on Windows.

}
}

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