mirror of
https://github.com/denoland/deno.git
synced 2024-11-25 15:29:32 -05:00
chore(ext/websocket): Add autobahn|testsuite fuzzingclient (#18846)
Closes #17242
This commit is contained in:
parent
fbefceeb56
commit
036778c2e8
7 changed files with 100 additions and 2 deletions
|
@ -13,7 +13,9 @@
|
||||||
"associations": "**/*.rs",
|
"associations": "**/*.rs",
|
||||||
"rustfmt": "rustfmt --config imports_granularity=item"
|
"rustfmt": "rustfmt --config imports_granularity=item"
|
||||||
},
|
},
|
||||||
"includes": ["**/*.{ts,tsx,js,jsx,json,md,toml,rs}"],
|
"includes": [
|
||||||
|
"**/*.{ts,tsx,js,jsx,json,md,toml,rs}"
|
||||||
|
],
|
||||||
"excludes": [
|
"excludes": [
|
||||||
".cargo_home",
|
".cargo_home",
|
||||||
".git",
|
".git",
|
||||||
|
@ -48,7 +50,8 @@
|
||||||
"tools/node_compat/TODO.md",
|
"tools/node_compat/TODO.md",
|
||||||
"tools/node_compat/versions",
|
"tools/node_compat/versions",
|
||||||
"tools/wpt/expectation.json",
|
"tools/wpt/expectation.json",
|
||||||
"tools/wpt/manifest.json"
|
"tools/wpt/manifest.json",
|
||||||
|
"ext/websocket/autobahn/reports"
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"https://plugins.dprint.dev/typescript-0.84.0.wasm",
|
"https://plugins.dprint.dev/typescript-0.84.0.wasm",
|
||||||
|
|
9
.github/workflows/ci.generate.ts
vendored
9
.github/workflows/ci.generate.ts
vendored
|
@ -642,6 +642,15 @@ const ci = {
|
||||||
run:
|
run:
|
||||||
'gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.zip gs://dl.deno.land/canary/$(git rev-parse HEAD)/',
|
'gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.zip gs://dl.deno.land/canary/$(git rev-parse HEAD)/',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Autobahn testsuite",
|
||||||
|
if: [
|
||||||
|
"matrix.job == 'test' && matrix.profile == 'release' &&",
|
||||||
|
"!startsWith(github.ref, 'refs/tags/') && startsWith(matrix.os, 'ubuntu')",
|
||||||
|
].join("\n"),
|
||||||
|
run:
|
||||||
|
"target/release/deno run -A --unstable ext/websocket/autobahn/fuzzingclient.js",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "Test debug",
|
name: "Test debug",
|
||||||
if: [
|
if: [
|
||||||
|
|
5
.github/workflows/ci.yml
vendored
5
.github/workflows/ci.yml
vendored
|
@ -399,6 +399,11 @@ jobs:
|
||||||
env:
|
env:
|
||||||
CLOUDSDK_PYTHON: '${{env.pythonLocation}}\python.exe'
|
CLOUDSDK_PYTHON: '${{env.pythonLocation}}\python.exe'
|
||||||
run: 'gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.zip gs://dl.deno.land/canary/$(git rev-parse HEAD)/'
|
run: 'gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.zip gs://dl.deno.land/canary/$(git rev-parse HEAD)/'
|
||||||
|
- name: Autobahn testsuite
|
||||||
|
if: |-
|
||||||
|
!(github.event_name == 'pull_request' && matrix.skip_pr) && (matrix.job == 'test' && matrix.profile == 'release' &&
|
||||||
|
!startsWith(github.ref, 'refs/tags/') && startsWith(matrix.os, 'ubuntu'))
|
||||||
|
run: target/release/deno run -A --unstable ext/websocket/autobahn/fuzzingclient.js
|
||||||
- name: Test debug
|
- name: Test debug
|
||||||
if: |-
|
if: |-
|
||||||
!(github.event_name == 'pull_request' && matrix.skip_pr) && (matrix.job == 'test' && matrix.profile == 'debug' &&
|
!(github.event_name == 'pull_request' && matrix.skip_pr) && (matrix.job == 'test' && matrix.profile == 'debug' &&
|
||||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -26,3 +26,5 @@ gclient_config.py_entries
|
||||||
# WPT generated cert files
|
# WPT generated cert files
|
||||||
/tools/wpt/certs/index.txt*
|
/tools/wpt/certs/index.txt*
|
||||||
/tools/wpt/certs/serial*
|
/tools/wpt/certs/serial*
|
||||||
|
|
||||||
|
/ext/websocket/autobahn/reports
|
||||||
|
|
20
ext/websocket/autobahn/autobahn_server.js
Normal file
20
ext/websocket/autobahn/autobahn_server.js
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||||
|
import { parse } from "../../../test_util/std/flags/mod.ts";
|
||||||
|
|
||||||
|
const { port } = parse(Deno.args, {
|
||||||
|
number: ["port"],
|
||||||
|
default: {
|
||||||
|
port: 6969,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const { serve } = Deno;
|
||||||
|
|
||||||
|
// A message-based WebSocket echo server.
|
||||||
|
serve((request) => {
|
||||||
|
const { socket, response } = Deno.upgradeWebSocket(request);
|
||||||
|
socket.onmessage = (event) => {
|
||||||
|
socket.send(event.data);
|
||||||
|
};
|
||||||
|
return response;
|
||||||
|
}, { port });
|
33
ext/websocket/autobahn/fuzzingclient.js
Normal file
33
ext/websocket/autobahn/fuzzingclient.js
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
|
// deno-lint-ignore-file
|
||||||
|
|
||||||
|
import { $ } from "https://deno.land/x/dax@0.31.0/mod.ts";
|
||||||
|
|
||||||
|
const pwd = new URL(".", import.meta.url).pathname;
|
||||||
|
|
||||||
|
const AUTOBAHN_TESTSUITE_DOCKER =
|
||||||
|
"crossbario/autobahn-testsuite:0.8.2@sha256:5d4ba3aa7d6ab2fdbf6606f3f4ecbe4b66f205ce1cbc176d6cdf650157e52242";
|
||||||
|
|
||||||
|
const self = Deno.execPath();
|
||||||
|
$`${self} run -A --unstable ${pwd}/autobahn_server.js`.spawn();
|
||||||
|
await $`docker run --name fuzzingserver -v ${pwd}/fuzzingclient.json:/fuzzingclient.json:ro -v ${pwd}/reports:/reports -p 9001:9001 --net=host --rm ${AUTOBAHN_TESTSUITE_DOCKER} wstest -m fuzzingclient -s fuzzingclient.json`
|
||||||
|
.cwd(pwd);
|
||||||
|
|
||||||
|
const { deno_websocket } = JSON.parse(
|
||||||
|
Deno.readTextFileSync(`${pwd}/reports/servers/index.json`),
|
||||||
|
);
|
||||||
|
const result = Object.values(deno_websocket);
|
||||||
|
|
||||||
|
function failed(name) {
|
||||||
|
return name != "OK" && name != "INFORMATIONAL" && name != "NON-STRICT";
|
||||||
|
}
|
||||||
|
|
||||||
|
const failedtests = result.filter((outcome) => failed(outcome.behavior));
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
`%c${result.length - failedtests.length} / ${result.length} tests OK`,
|
||||||
|
`color: ${failedtests.length == 0 ? "green" : "red"}`,
|
||||||
|
);
|
||||||
|
|
||||||
|
Deno.exit(failedtests.length == 0 ? 0 : 1);
|
26
ext/websocket/autobahn/fuzzingclient.json
Normal file
26
ext/websocket/autobahn/fuzzingclient.json
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
"outdir": "./reports/servers",
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"agent": "deno_websocket",
|
||||||
|
"url": "ws://localhost:6969"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"cases": [
|
||||||
|
"1.*",
|
||||||
|
"2.*",
|
||||||
|
"3.*",
|
||||||
|
"4.*",
|
||||||
|
"5.*",
|
||||||
|
"6.*",
|
||||||
|
"7.*",
|
||||||
|
"9.*",
|
||||||
|
"10.*"
|
||||||
|
],
|
||||||
|
"exclude-cases": [
|
||||||
|
"11.*",
|
||||||
|
"12.*",
|
||||||
|
"13.*"
|
||||||
|
],
|
||||||
|
"exclude-agent-cases": {}
|
||||||
|
}
|
Loading…
Reference in a new issue