Skip to content

Commit

Permalink
Update latest sobek: bigInt, etc (#3913)
Browse files Browse the repository at this point in the history
* Upgraded grafana/sobek to the latest one, including tc39 updates
* Apply fixes related to the bigint into the tests
  • Loading branch information
olegbespalov authored Aug 28, 2024
1 parent 3674458 commit 8aa1aca
Show file tree
Hide file tree
Showing 25 changed files with 1,315 additions and 255 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ require (
github.com/go-logr/stdr v1.2.2 // indirect
github.com/google/pprof v0.0.0-20230728192033-2ba5b33183c6 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grafana/sobek v0.0.0-20240816075701-fd55381ddfc3
github.com/grafana/sobek v0.0.0-20240823144814-3c582bfdac82
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358/go.mod h1:chxPXzS
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/DataDog/datadog-go v0.0.0-20180330214955-e67964b4021a h1:zpQSzEApXM0qkXcpdjeJ4OpnBWhD/X8zT/iT1wYLiVU=
github.com/DataDog/datadog-go v0.0.0-20180330214955-e67964b4021a/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0=
github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ=
github.com/PuerkitoBio/goquery v1.9.2 h1:4/wZksC3KgkQw7SQgkKotmKljk0M6V8TUvA8Wb4yPeE=
github.com/PuerkitoBio/goquery v1.9.2/go.mod h1:GHPCaP0ODyyxqcNoFGYlAprUFH81NuRPd0GX3Zu2Mvk=
github.com/Soontao/goHttpDigestClient v0.0.0-20170320082612-6d28bb1415c5 h1:k+1+doEm31k0rRjCjLnGG3YRkuO9ljaEyS2ajZd6GK8=
Expand Down Expand Up @@ -87,8 +89,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
github.com/grafana/sobek v0.0.0-20240816075701-fd55381ddfc3 h1:mJ1DN6EDA5MlRtcspUjVTsfINUVJMd4Yw70RdFoKN8E=
github.com/grafana/sobek v0.0.0-20240816075701-fd55381ddfc3/go.mod h1:14YTHWUwjApKs5kzRn+4akwbvPMRsXEmjfozc5OmT0I=
github.com/grafana/sobek v0.0.0-20240823144814-3c582bfdac82 h1:bOg9X3uXuOSjQmIhxefNpClq0pA8C4T+bzHpE6DuaOk=
github.com/grafana/sobek v0.0.0-20240823144814-3c582bfdac82/go.mod h1:FmcutBFPLiGgroH42I4/HBahv7GxVjODcVWFTw1ISes=
github.com/grafana/xk6-browser v1.7.1 h1:RKCcoFyKT97iGgbnK76WwxcXnkB23ijlO1LghqjHQ0E=
github.com/grafana/xk6-browser v1.7.1/go.mod h1:sZO7cT7/XQf2mz+rXkp6poswhOCA0JKA8isj3fQrfaU=
github.com/grafana/xk6-dashboard v0.7.5 h1:TcILyffT/Ea/XD7xG1jMA5lwtusOPRbEQsQDHmO30Mk=
Expand Down
7 changes: 0 additions & 7 deletions js/bundle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,6 @@ func TestNewBundle(t *testing.T) {
"InvalidCompat", "es1", `export default function() {};`,
`invalid compatibility mode "es1". Use: "extended", "base", "experimental_enhanced"`,
},
// BigInt is not supported
{
"BigInt", "base",
`module.exports.default = function() {};
BigInt(1231412444)`,
"ReferenceError: BigInt is not defined\n\tat file:///script.js:2:7(7)\n",
},
}

for _, tc := range testCases {
Expand Down
35 changes: 8 additions & 27 deletions js/modules/k6/crypto/x509/x509_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ func TestParse(t *testing.T) {
value.algorithm === "RSA" &&
typeof value.key === "object" &&
typeof value.key.e === "number" &&
typeof value.key.n === "object"
typeof value.key.n === "bigint"
)) {
throw new Error("Bad RSA public key");
}`, material.rsaCertificate))
Expand Down Expand Up @@ -607,29 +607,10 @@ func TestParse(t *testing.T) {
_, err := rt.RunString(fmt.Sprintf(`
var pem = %q;
var cert = x509.parse(pem);
var value = cert.publicKey ? cert.publicKey.key.n.bytes() : null;
var expected = [
223, 249, 234, 71, 180, 36, 28, 62, 84, 141, 177, 118, 53, 2, 175,
45, 167, 89, 155, 216, 103, 86, 32, 216, 42, 92, 84, 125, 183, 102,
217, 40, 255, 129, 38, 203, 175, 98, 209, 147, 151, 106, 250, 12,
123, 236, 135, 45, 80, 80, 76, 253, 148, 141, 13, 36, 76, 47, 182,
58, 100, 153, 114, 13, 141, 96, 12, 109, 126, 74, 68, 119, 88, 15,
52, 107, 80, 117, 190, 163, 230, 120, 26, 44, 139, 245, 222, 188,
210, 237, 123, 83, 91, 98, 160, 218, 229, 244, 128, 31, 24, 139,
125, 25, 184, 108, 180, 23, 149, 136, 47, 140, 168, 51, 159, 35,
65, 150, 7, 51, 134, 138, 188, 225, 105, 92, 9, 91, 72, 133, 70,
195, 131, 105, 184, 191, 198, 177, 130, 191, 70, 6, 37, 159, 255,
244, 109, 238, 128, 138, 0, 201, 41, 87, 67, 87, 165, 118, 4, 253,
209, 31, 177, 1, 1, 116, 64, 14, 17, 19, 217, 6, 117, 75, 24, 174,
236, 129, 134, 115, 245, 226, 203, 222, 17, 113, 197, 215, 138,
241, 99, 169, 68, 77, 243, 36, 116, 69, 143, 150, 60, 245, 75, 200,
30, 207, 141, 139, 136, 35, 125, 184, 255, 174, 26, 6, 148, 56,
253, 124, 249, 158, 249, 117, 3, 126, 124, 89, 27, 96, 209, 0, 207,
152, 233, 166, 81, 7, 253, 155, 165, 96, 29, 72, 28, 172, 24, 104,
70, 229, 201, 107, 200, 169, 220, 35
]
if (value.join(":") !== expected.join(":")) {
throw new Error("Bad RSA public key modulus: " + value.join(":"));
var value = cert.publicKey ? cert.publicKey.key.n.toString(16) : null;
var expected = "dff9ea47b4241c3e548db1763502af2da7599bd8675620d82a5c547db766d928ff8126cbaf62d193976afa0c7bec872d50504cfd948d0d244c2fb63a6499720d8d600c6d7e4a4477580f346b5075bea3e6781a2c8bf5debcd2ed7b535b62a0dae5f4801f188b7d19b86cb41795882f8ca8339f2341960733868abce1695c095b488546c38369b8bfc6b182bf4606259ffff46dee808a00c929574357a57604fdd11fb1010174400e1113d906754b18aeec818673f5e2cbde1171c5d78af163a9444df32474458f963cf54bc81ecf8d8b88237db8ffae1a069438fd7cf99ef975037e7c591b60d100cf98e9a65107fd9ba5601d481cac186846e5c96bc8a9dc23";
if (value !== expected) {
throw new Error("Bad RSA public key modulus: " + value);
}`, material.rsaCertificate))
assert.NoError(t, err)
})
Expand All @@ -648,7 +629,7 @@ func TestParse(t *testing.T) {
typeof value === "object" &&
value.algorithm === "DSA" &&
typeof value.key.parameters === "object" &&
typeof value.key.y === "object"
typeof value.key.y === "bigint"
)) {
throw new Error("Bad DSA public key");
}`, material.dsaCertificate))
Expand All @@ -669,8 +650,8 @@ func TestParse(t *testing.T) {
typeof value === "object" &&
value.algorithm === "ECDSA" &&
typeof value.key.curve === "object" &&
typeof value.key.x === "object" &&
typeof value.key.y === "object"
typeof value.key.x === "bigint" &&
typeof value.key.y === "bigint"
)) {
throw new Error("Bad ECDSA public key");
}`, material.ecdsaCertificate))
Expand Down
25 changes: 11 additions & 14 deletions js/tc39/breaking_test_errors-experimental_enhanced.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@
"test/annexB/built-ins/RegExp/RegExp-leading-escape-BMP.js-strict:true": "test/annexB/built-ins/RegExp/RegExp-leading-escape-BMP.js: Test262Error: Code unit: d800 Expected SameValue(«\\\\\\ud800», «\\�») to be true <at omitted>",
"test/annexB/built-ins/RegExp/RegExp-trailing-escape-BMP.js-strict:true": "test/annexB/built-ins/RegExp/RegExp-trailing-escape-BMP.js: Test262Error: Code unit: d800 Expected SameValue(«a\\\\\\ud800», «a\\�») to be true <at omitted>",
"test/annexB/built-ins/RegExp/prototype/compile/pattern-string-invalid-u.js-strict:true": "test/annexB/built-ins/RegExp/prototype/compile/pattern-string-invalid-u.js: Test262Error: invalid pattern: { Expected a SyntaxError to be thrown but no exception was thrown at all <at omitted>",
"test/built-ins/AsyncArrowFunction/is-a-constructor.js-strict:true": "test/built-ins/AsyncArrowFunction/is-a-constructor.js: SyntaxError: Async generators are not supported yet <at omitted>",
"test/built-ins/AsyncFunction/AsyncFunction-is-subclass.js-strict:true": "test/built-ins/AsyncFunction/AsyncFunction-is-subclass.js: Test262Error: Prototype of constructor is Function Expected SameValue(«function () { [native code] }», «function Function() { [native code] }») to be true <at omitted>",
"test/built-ins/AsyncFunction/is-a-constructor.js-strict:true": "test/built-ins/AsyncFunction/is-a-constructor.js: SyntaxError: Async generators are not supported yet <at omitted>",
"test/built-ins/Date/UTC/fp-evaluation-order.js-strict:true": "test/built-ins/Date/UTC/fp-evaluation-order.js: Test262Error: order of operations / precision in MakeTime Expected SameValue(«29256», «29312») to be true <at omitted>",
"test/built-ins/Function/internals/Construct/base-ctor-revoked-proxy.js-strict:true": "test/built-ins/Function/internals/Construct/base-ctor-revoked-proxy.js: Test262Error: Expected a TypeError to be thrown but no exception was thrown at all <at omitted>",
"test/built-ins/GeneratorFunction/is-a-constructor.js-strict:true": "test/built-ins/GeneratorFunction/is-a-constructor.js: SyntaxError: Async generators are not supported yet <at omitted>",
"test/built-ins/Object/seal/seal-bigint64array.js-strict:true": "test/built-ins/Object/seal/seal-bigint64array.js: ReferenceError: BigInt64Array is not defined <at omitted>",
"test/built-ins/Object/seal/seal-biguint64array.js-strict:true": "test/built-ins/Object/seal/seal-biguint64array.js: ReferenceError: BigUint64Array is not defined <at omitted>",
"test/built-ins/RegExp/lookahead-quantifier-match-groups.js-strict:true": "test/built-ins/RegExp/lookahead-quantifier-match-groups.js: Test262Error: Expected [a, abc] and [a, undefined] to have the same contents. ? quantifier <at omitted>",
"test/built-ins/RegExp/nullable-quantifier.js-strict:true": "test/built-ins/RegExp/nullable-quantifier.js: Test262Error: The regex is expected to match the whole string Expected SameValue(«a», «ab») to be true <at omitted>",
"test/built-ins/RegExp/quantifier-integer-limit.js-strict:true": "test/built-ins/RegExp/quantifier-integer-limit.js: SyntaxError: Invalid regular expression (re2): b{9007199254740991} (error parsing regexp: invalid repeat count: `{9007199254740991}`) <at omitted>",
"test/built-ins/RegExp/unicode_full_case_folding.js-strict:true": "test/built-ins/RegExp/unicode_full_case_folding.js: Test262Error: \\u0390 does not match \\u1fd3 <at omitted>",
"test/built-ins/RegExp/unicode_restricted_brackets.js-strict:true": "test/built-ins/RegExp/unicode_restricted_brackets.js: Test262Error: RegExp(\"]\", \"u\"): Expected a SyntaxError to be thrown but no exception was thrown at all <at omitted>",
"test/built-ins/RegExp/unicode_restricted_character_class_escape.js-strict:true": "test/built-ins/RegExp/unicode_restricted_character_class_escape.js: Test262Error: RegExp(\"[\\d-a]\", \"u\"): Expected a SyntaxError to be thrown but no exception was thrown at all <at omitted>",
"test/built-ins/RegExp/unicode_restricted_identity_escape.js-strict:true": "test/built-ins/RegExp/unicode_restricted_identity_escape.js: Test262Error: Invalid IdentityEscape in AtomEscape: '\\\u0000' Expected a SyntaxError to be thrown but no exception was thrown at all <at omitted>",
Expand All @@ -28,12 +26,11 @@
"test/built-ins/RegExp/unicode_restricted_incomplete_quantifier.js-strict:true": "test/built-ins/RegExp/unicode_restricted_incomplete_quantifier.js: Test262Error: RegExp(\"a{\", \"u\"): Expected a SyntaxError to be thrown but no exception was thrown at all <at omitted>",
"test/built-ins/RegExp/unicode_restricted_octal_escape.js-strict:true": "test/built-ins/RegExp/unicode_restricted_octal_escape.js: Test262Error: RegExp(\"\\1\", \"u\"): Expected a SyntaxError to be thrown but no exception was thrown at all <at omitted>",
"test/built-ins/RegExp/unicode_restricted_quantifiable_assertion.js-strict:true": "test/built-ins/RegExp/unicode_restricted_quantifiable_assertion.js: Test262Error: RegExp(\"(?=.)*\", \"u\"): Expected a SyntaxError to be thrown but no exception was thrown at all <at omitted>",
"test/built-ins/TypedArrayConstructors/BigUint64Array/is-a-constructor.js-strict:true": "test/built-ins/TypedArrayConstructors/BigUint64Array/is-a-constructor.js: ReferenceError: BigUint64Array is not defined <at omitted>",
"test/language/comments/hashbang/function-constructor.js-strict:true": "test/language/comments/hashbang/function-constructor.js: SyntaxError: Async generators are not supported yet <at omitted>",
"test/language/comments/hashbang/module.js-strict:false": "test/language/comments/hashbang/module.js: file:///TestTC39/test262/test/language/comments/hashbang/module.js: Line 1:28 Unexpected token ILLEGAL (and 2 more errors)",
"test/language/destructuring/binding/syntax/destructuring-array-parameters-function-arguments-length.js-strict:true": "test/language/destructuring/binding/syntax/destructuring-array-parameters-function-arguments-length.js: SyntaxError: Async generators are not supported yet <at omitted>",
"test/language/destructuring/binding/syntax/destructuring-object-parameters-function-arguments-length.js-strict:true": "test/language/destructuring/binding/syntax/destructuring-object-parameters-function-arguments-length.js: SyntaxError: Async generators are not supported yet <at omitted>",
"test/language/expressions/assignment/fn-name-lhs-cover.js-strict:true": "test/language/expressions/assignment/fn-name-lhs-cover.js: Test262Error: descriptor value should be <at omitted>",
"test/language/expressions/assignment/fn-name-lhs-cover.js-strict:true": "test/language/expressions/assignment/fn-name-lhs-cover.js: Test262Error: descriptor value should be ; object value should be <at omitted>",
"test/language/expressions/assignmenttargettype/simple-basic-identifierreference-await.js-strict:true": "test/language/expressions/assignmenttargettype/simple-basic-identifierreference-await.js: test/language/expressions/assignmenttargettype/simple-basic-identifierreference-await.js: Line 9:5 Unexpected token await (and 1 more errors)",
"test/language/expressions/await/await-BindingIdentifier-in-global.js-strict:true": "test/language/expressions/await/await-BindingIdentifier-in-global.js: test/language/expressions/await/await-BindingIdentifier-in-global.js: Line 12:16 Unexpected token await (and 2 more errors)",
"test/language/expressions/await/await-in-global.js-strict:true": "test/language/expressions/await/await-in-global.js: test/language/expressions/await/await-in-global.js: Line 12:5 Unexpected token await (and 1 more errors)",
Expand Down Expand Up @@ -63,7 +60,7 @@
"test/language/expressions/object/method-definition/static-init-await-reference-accessor.js-strict:true": "test/language/expressions/object/method-definition/static-init-await-reference-accessor.js: test/language/expressions/object/method-definition/static-init-await-reference-accessor.js: Line 15:5 Unexpected token await (and 1 more errors)",
"test/language/expressions/object/method-definition/static-init-await-reference-generator.js-strict:true": "test/language/expressions/object/method-definition/static-init-await-reference-generator.js: test/language/expressions/object/method-definition/static-init-await-reference-generator.js: Line 15:5 Unexpected token await (and 1 more errors)",
"test/language/expressions/object/method-definition/static-init-await-reference-normal.js-strict:true": "test/language/expressions/object/method-definition/static-init-await-reference-normal.js: test/language/expressions/object/method-definition/static-init-await-reference-normal.js: Line 15:5 Unexpected token await (and 1 more errors)",
"test/language/expressions/optional-chaining/iteration-statement-for-await-of.js-strict:true": "test/language/expressions/optional-chaining/iteration-statement-for-await-of.js: test/language/expressions/optional-chaining/iteration-statement-for-await-of.js: Line 31:7 Unexpected token await (and 9 more errors)",
"test/language/expressions/optional-chaining/iteration-statement-for-await-of.js-strict:true": "test/language/expressions/optional-chaining/iteration-statement-for-await-of.js: test/language/expressions/optional-chaining/iteration-statement-for-await-of.js: Line 32:7 Unexpected token await (and 9 more errors)",
"test/language/expressions/optional-chaining/member-expression.js-strict:true": "test/language/expressions/optional-chaining/member-expression.js: SyntaxError: Async generators are not supported yet <at omitted>",
"test/language/global-code/import.js-strict:true": "test/language/global-code/import.js: error is not an object (Test262: This statement should not be evaluated.)",
"test/language/literals/numeric/non-octal-decimal-integer.js-strict:false": "test/language/literals/numeric/non-octal-decimal-integer.js: test/language/literals/numeric/non-octal-decimal-integer.js: Line 28:18 Unexpected token ILLEGAL (and 1 more errors)",
Expand Down Expand Up @@ -100,12 +97,12 @@
"test/language/module-code/export-expname-from-as-unpaired-surrogate.js-strict:true": "test/language/module-code/export-expname-from-as-unpaired-surrogate.js: error is not an object (Test262: This statement should not be evaluated.)",
"test/language/module-code/export-expname-string-binding.js-strict:true": "test/language/module-code/export-expname-string-binding.js: error is not an object (Test262: This statement should not be evaluated.)",
"test/language/module-code/export-expname-unpaired-surrogate.js-strict:true": "test/language/module-code/export-expname-unpaired-surrogate.js: error is not an object (Test262: This statement should not be evaluated.)",
"test/language/module-code/instn-iee-err-not-found-as.js-strict:true": "test/language/module-code/instn-iee-err-not-found-as.js: Expected error: <nil>",
"test/language/module-code/instn-iee-err-not-found.js-strict:true": "test/language/module-code/instn-iee-err-not-found.js: Expected error: <nil>",
"test/language/module-code/instn-named-err-not-found-as.js-strict:true": "test/language/module-code/instn-named-err-not-found-as.js: Expected error: <nil>",
"test/language/module-code/instn-named-err-not-found-dflt.js-strict:true": "test/language/module-code/instn-named-err-not-found-dflt.js: Expected error: <nil>",
"test/language/module-code/instn-named-err-not-found.js-strict:true": "test/language/module-code/instn-named-err-not-found.js: Expected error: <nil>",
"test/language/module-code/instn-star-err-not-found.js-strict:true": "test/language/module-code/instn-star-err-not-found.js: Expected error: <nil>",
"test/language/module-code/instn-iee-err-not-found-as.js-strict:true": "test/language/module-code/instn-iee-err-not-found-as.js: error is not an object (Test262: This statement should not be evaluated.)",
"test/language/module-code/instn-iee-err-not-found.js-strict:true": "test/language/module-code/instn-iee-err-not-found.js: error is not an object (Test262: This statement should not be evaluated.)",
"test/language/module-code/instn-named-err-not-found-as.js-strict:true": "test/language/module-code/instn-named-err-not-found-as.js: error is not an object (Test262: This statement should not be evaluated.)",
"test/language/module-code/instn-named-err-not-found-dflt.js-strict:true": "test/language/module-code/instn-named-err-not-found-dflt.js: error is not an object (Test262: This statement should not be evaluated.)",
"test/language/module-code/instn-named-err-not-found.js-strict:true": "test/language/module-code/instn-named-err-not-found.js: error is not an object (Test262: This statement should not be evaluated.)",
"test/language/module-code/instn-star-err-not-found.js-strict:true": "test/language/module-code/instn-star-err-not-found.js: error is not an object (Test262: This statement should not be evaluated.)",
"test/language/module-code/parse-err-hoist-lex-fun.js-strict:true": "test/language/module-code/parse-err-hoist-lex-fun.js: error is not an object (Test262: This statement should not be evaluated.)",
"test/language/module-code/parse-err-return.js-strict:true": "test/language/module-code/parse-err-return.js: error is not an object (Test262: This statement should not be evaluated.)",
"test/language/reserved-words/await-module.js-strict:true": "test/language/reserved-words/await-module.js: error is not an object (Test262: This statement should not be evaluated.)",
Expand Down
Loading

0 comments on commit 8aa1aca

Please sign in to comment.