From fd03ba6f54a4e133ec0060c0b43c75b5e5c72870 Mon Sep 17 00:00:00 2001 From: Mihail Stoykov <312246+mstoykov@users.noreply.github.com> Date: Fri, 16 Aug 2024 19:25:12 +0300 Subject: [PATCH 01/12] Update to golangci-lint 1.60.1 to support go 1.23 (#3900) Once again a new release of go makes golangci-lint use all available memory. This also fixes some new linter issues, mostly: - staticheck dropping a bunch of checks - min/max overriding. They are now build-in in 1.21+, but I didn't want to replace them and bump to 1.21 in this commit already, given the whole toolchain thing. - printf not being error checked or not being used with format + arguments. Co-authored-by: Oleg Bespalov --- .golangci.yml | 2 +- cloudapi/client.go | 2 +- cloudapi/logs.go | 6 +++--- cmd/scale.go | 6 +++--- cmd/tests/cmd_run_test.go | 14 +++++++------- js/modules/k6/crypto/x509/x509.go | 2 +- js/modules/k6/grpc/client.go | 2 +- js/modules/k6/http/response_callback.go | 10 +++++----- js/modules/k6/http/tls_test.go | 7 ++++--- js/runner.go | 1 - js/runner_test.go | 2 +- lib/archive.go | 2 +- lib/executor/base_config.go | 17 +++++++++-------- lib/executor/executors_test.go | 2 +- lib/executor/helpers.go | 8 ++++---- lib/netext/grpcext/conn_test.go | 2 +- lib/options.go | 2 +- lib/options_test.go | 4 ++-- output/cloud/expv2/flush.go | 4 ++-- output/cloud/output_test.go | 3 ++- ui/form.go | 7 +++++-- ui/pb/helpers.go | 13 ++++++------- 22 files changed, 61 insertions(+), 57 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 7690d16f48a..91f1a57d5b8 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,4 +1,4 @@ -# v1.57.2 +# v1.60.1 # Please don't remove the first line. It uses in CI to determine the golangci version run: timeout: 5m diff --git a/cloudapi/client.go b/cloudapi/client.go index 8e0ae945437..1c6628bad7d 100644 --- a/cloudapi/client.go +++ b/cloudapi/client.go @@ -212,7 +212,7 @@ func shouldRetry(resp *http.Response, err error, attempt, maxAttempts int) bool return true } - if resp.StatusCode >= 500 || resp.StatusCode == 429 { + if resp.StatusCode >= 500 || resp.StatusCode == http.StatusTooManyRequests { return true } diff --git a/cloudapi/logs.go b/cloudapi/logs.go index 2d0b6623a14..2f215f99b58 100644 --- a/cloudapi/logs.go +++ b/cloudapi/logs.go @@ -226,7 +226,7 @@ func (sfn sleeperFunc) Sleep(d time.Duration) { // between the latest iteration and the next retry. // Interval is used as the base to compute an exponential backoff, // if the computed interval overtakes the max interval then max will be used. -func retry(s sleeper, attempts uint, interval, max time.Duration, do func() error) (err error) { +func retry(s sleeper, attempts uint, interval, maxDuration time.Duration, do func() error) (err error) { baseInterval := math.Abs(interval.Truncate(time.Second).Seconds()) r := rand.New(rand.NewSource(time.Now().UnixNano())) //nolint:gosec @@ -236,8 +236,8 @@ func retry(s sleeper, attempts uint, interval, max time.Duration, do func() erro wait := time.Duration(math.Pow(baseInterval, float64(i))) * time.Second wait += time.Duration(r.Int63n(1000)) * time.Millisecond - if wait > max { - wait = max + if wait > maxDuration { + wait = maxDuration } s.Sleep(wait) } diff --git a/cmd/scale.go b/cmd/scale.go index b64e14b4f84..b70f2ae86df 100644 --- a/cmd/scale.go +++ b/cmd/scale.go @@ -20,8 +20,8 @@ func getCmdScale(gs *state.GlobalState) *cobra.Command { Use the global --address flag to specify the URL to the API server.`, RunE: func(cmd *cobra.Command, _ []string) error { vus := getNullInt64(cmd.Flags(), "vus") - max := getNullInt64(cmd.Flags(), "max") - if !vus.Valid && !max.Valid { + maxVUs := getNullInt64(cmd.Flags(), "max") + if !vus.Valid && !maxVUs.Valid { return errors.New("Specify either -u/--vus or -m/--max") //nolint:golint,stylecheck } @@ -29,7 +29,7 @@ func getCmdScale(gs *state.GlobalState) *cobra.Command { if err != nil { return err } - status, err := c.SetStatus(gs.Ctx, v1.Status{VUs: vus, VUsMax: max}) + status, err := c.SetStatus(gs.Ctx, v1.Status{VUs: vus, VUsMax: maxVUs}) if err != nil { return err } diff --git a/cmd/tests/cmd_run_test.go b/cmd/tests/cmd_run_test.go index bc575ecfeaf..985eb0ba1ae 100644 --- a/cmd/tests/cmd_run_test.go +++ b/cmd/tests/cmd_run_test.go @@ -1434,14 +1434,14 @@ func sum(vals []float64) (sum float64) { return sum } -func max(vals []float64) float64 { - max := vals[0] +func maxFloat64(vals []float64) float64 { + result := vals[0] for _, val := range vals { - if max < val { - max = val + if result < val { + result = val } } - return max + return result } func TestActiveVUsCount(t *testing.T) { @@ -1499,8 +1499,8 @@ func TestActiveVUsCount(t *testing.T) { jsonResults, err := fsext.ReadFile(ts.FS, "results.json") require.NoError(t, err) // t.Log(string(jsonResults)) - assert.Equal(t, float64(10), max(getSampleValues(t, jsonResults, "vus_max", nil))) - assert.Equal(t, float64(10), max(getSampleValues(t, jsonResults, "vus", nil))) + assert.Equal(t, float64(10), maxFloat64(getSampleValues(t, jsonResults, "vus_max", nil))) + assert.Equal(t, float64(10), maxFloat64(getSampleValues(t, jsonResults, "vus", nil))) assert.Equal(t, float64(0), sum(getSampleValues(t, jsonResults, "iterations", nil))) logEntries := ts.LoggerHook.Drain() diff --git a/js/modules/k6/crypto/x509/x509.go b/js/modules/k6/crypto/x509/x509.go index 318813028a9..0162989ef40 100644 --- a/js/modules/k6/crypto/x509/x509.go +++ b/js/modules/k6/crypto/x509/x509.go @@ -2,7 +2,7 @@ package x509 import ( - "crypto/dsa" //nolint:staticcheck // #nosec G505 // DSA is weak, but we need it for compatibility + "crypto/dsa" // #nosec G505 // DSA is weak, but we need it for compatibility "crypto/ecdsa" "crypto/rsa" "crypto/sha1" // #nosec G505 diff --git a/js/modules/k6/grpc/client.go b/js/modules/k6/grpc/client.go index fdcd80048d0..292e3adac64 100644 --- a/js/modules/k6/grpc/client.go +++ b/js/modules/k6/grpc/client.go @@ -125,7 +125,7 @@ func decryptPrivateKey(key, password []byte) ([]byte, error) { being used here because it is deprecated due to it not supporting *good* cryptography ultimately though we want to support something so we will be using it for now. */ - decryptedKey, err := x509.DecryptPEMBlock(block, password) //nolint:staticcheck + decryptedKey, err := x509.DecryptPEMBlock(block, password) if err != nil { return nil, err } diff --git a/js/modules/k6/http/response_callback.go b/js/modules/k6/http/response_callback.go index 2f68f502343..e456effe23f 100644 --- a/js/modules/k6/http/response_callback.go +++ b/js/modules/k6/http/response_callback.go @@ -63,16 +63,16 @@ func (mi *ModuleInstance) expectedStatuses(args ...sobek.Value) *expectedStatuse if isInt(arg) { result.exact = append(result.exact, int(o.ToInteger())) } else { - min := o.Get("min") - max := o.Get("max") - if min == nil || max == nil { + minValue := o.Get("min") + maxValue := o.Get("max") + if minValue == nil || maxValue == nil { common.Throw(rt, fmt.Errorf(errMsg, i+1)) } - if !(isInt(min) && isInt(max)) { + if !(isInt(minValue) && isInt(maxValue)) { common.Throw(rt, fmt.Errorf("both min and max need to be integers for argument number %d", i+1)) } - result.minmax = append(result.minmax, [2]int{int(min.ToInteger()), int(max.ToInteger())}) + result.minmax = append(result.minmax, [2]int{int(minValue.ToInteger()), int(maxValue.ToInteger())}) } } return &result diff --git a/js/modules/k6/http/tls_test.go b/js/modules/k6/http/tls_test.go index 54ae30da1fe..2ced2dd061a 100644 --- a/js/modules/k6/http/tls_test.go +++ b/js/modules/k6/http/tls_test.go @@ -6,7 +6,7 @@ import ( "net/http" "testing" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "gopkg.in/guregu/null.v3" "go.k6.io/k6/lib" @@ -19,7 +19,8 @@ func TestTLS13Support(t *testing.T) { ts.tb.Mux.HandleFunc("/tls-version", http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) { ver := req.TLS.Version - fmt.Fprint(resp, lib.SupportedTLSVersionsToString[lib.TLSVersion(ver)]) + _, err := fmt.Fprint(resp, lib.SupportedTLSVersionsToString[lib.TLSVersion(ver)]) + require.NoError(t, err) })) // We don't expect any failed requests @@ -32,5 +33,5 @@ func TestTLS13Support(t *testing.T) { throw new Error("unexpected tls version: " + resp.body); } `)) - assert.NoError(t, err) + require.NoError(t, err) } diff --git a/js/runner.go b/js/runner.go index 29deb508ea1..a3741fc7f86 100644 --- a/js/runner.go +++ b/js/runner.go @@ -188,7 +188,6 @@ func (r *Runner) newVU( "deprecation - https://pkg.go.dev/crypto/tls@go1.17#Config.", ) }) - //nolint:staticcheck // ignore SA1019 we can deprecate it but we have to continue to support the previous code. tlsConfig.NameToCertificate = nameToCert } transport := &http.Transport{ diff --git a/js/runner_test.go b/js/runner_test.go index 5324d7c6e4a..c0ca818086c 100644 --- a/js/runner_test.go +++ b/js/runner_test.go @@ -1294,7 +1294,7 @@ func TestVUIntegrationTLSConfig(t *testing.T) { "", }, "UnsupportedVersion": { - lib.Options{TLSVersion: &lib.TLSVersions{Min: tls.VersionSSL30, Max: tls.VersionSSL30}}, //nolint:staticcheck + lib.Options{TLSVersion: &lib.TLSVersions{Min: tls.VersionSSL30, Max: tls.VersionSSL30}}, unsupportedVersionErrorMsg, }, } diff --git a/lib/archive.go b/lib/archive.go index 52fc5f27cf3..d84936d0487 100644 --- a/lib/archive.go +++ b/lib/archive.go @@ -125,7 +125,7 @@ func ReadArchive(in io.Reader) (*Archive, error) { } return nil, err } - if hdr.Typeflag != tar.TypeReg && hdr.Typeflag != tar.TypeRegA { //nolint:staticcheck + if hdr.Typeflag != tar.TypeReg && hdr.Typeflag != tar.TypeRegA { continue } diff --git a/lib/executor/base_config.go b/lib/executor/base_config.go index 51ec1fad8d8..b4ddf76d0b4 100644 --- a/lib/executor/base_config.go +++ b/lib/executor/base_config.go @@ -1,6 +1,7 @@ package executor import ( + "errors" "fmt" "regexp" "strings" @@ -46,29 +47,29 @@ func NewBaseConfig(name, configType string) BaseConfig { } // Validate checks some basic things like present name, type, and a positive start time -func (bc BaseConfig) Validate() (errors []error) { +func (bc BaseConfig) Validate() (result []error) { // Some just-in-case checks, since those things are likely checked in other places or // even assigned by us: if bc.Name == "" { - errors = append(errors, fmt.Errorf("scenario name can't be empty")) + result = append(result, errors.New("scenario name can't be empty")) } if !scenarioNameWhitelist.MatchString(bc.Name) { - errors = append(errors, fmt.Errorf(scenarioNameErr)) + result = append(result, errors.New(scenarioNameErr)) } if bc.Exec.Valid && bc.Exec.String == "" { - errors = append(errors, fmt.Errorf("exec value cannot be empty")) + result = append(result, errors.New("exec value cannot be empty")) } if bc.Type == "" { - errors = append(errors, fmt.Errorf("missing or empty type field")) + result = append(result, errors.New("missing or empty type field")) } // The actually reasonable checks: if bc.StartTime.Duration < 0 { - errors = append(errors, fmt.Errorf("the startTime can't be negative")) + result = append(result, errors.New("the startTime can't be negative")) } if bc.GracefulStop.Duration < 0 { - errors = append(errors, fmt.Errorf("the gracefulStop timeout can't be negative")) + result = append(result, errors.New("the gracefulStop timeout can't be negative")) } - return errors + return result } // GetName returns the name of the scenario. diff --git a/lib/executor/executors_test.go b/lib/executor/executors_test.go index a3f44703676..0e6832a69b4 100644 --- a/lib/executor/executors_test.go +++ b/lib/executor/executors_test.go @@ -429,7 +429,7 @@ func TestConfigMapParsingAndValidation(t *testing.T) { tc := tc t.Run(fmt.Sprintf("TestCase#%d", i), func(t *testing.T) { t.Parallel() - t.Logf(tc.rawJSON) + t.Log(tc.rawJSON) var result lib.ScenarioConfigs err := json.Unmarshal([]byte(tc.rawJSON), &result) if tc.expected.parseError { diff --git a/lib/executor/helpers.go b/lib/executor/helpers.go index 80699407dab..ae513770342 100644 --- a/lib/executor/helpers.go +++ b/lib/executor/helpers.go @@ -30,13 +30,13 @@ func sumStagesDuration(stages []Stage) (result time.Duration) { } func getStagesUnscaledMaxTarget(unscaledStartValue int64, stages []Stage) int64 { - max := unscaledStartValue + result := unscaledStartValue for _, s := range stages { - if s.Target.Int64 > max { - max = s.Target.Int64 + if s.Target.Int64 > result { + result = s.Target.Int64 } } - return max + return result } // validateTargetShifts validates the VU Target shifts. diff --git a/lib/netext/grpcext/conn_test.go b/lib/netext/grpcext/conn_test.go index 42bbb829f92..a6b5fc1276b 100644 --- a/lib/netext/grpcext/conn_test.go +++ b/lib/netext/grpcext/conn_test.go @@ -153,7 +153,7 @@ func methodFromProto(method string) protoreflect.MethodDescriptor { // otherwise the parser will try to parse "google/protobuf/descriptor.proto" // with exactly the same name as the one we are trying to parse for testing if filename != path { - return nil, nil + return nil, nil //nolint:nilnil } b := ` diff --git a/lib/options.go b/lib/options.go index 9331028fec4..4f013e50652 100644 --- a/lib/options.go +++ b/lib/options.go @@ -179,7 +179,7 @@ func decryptPrivateKey(privKey, password string) ([]byte, error) { being used here because it is deprecated due to it not supporting *good* crypography ultimately though we want to support something so we will be using it for now. */ - decryptedKey, err := x509.DecryptPEMBlock(block, []byte(password)) //nolint:staticcheck + decryptedKey, err := x509.DecryptPEMBlock(block, []byte(password)) if err != nil { return nil, err } diff --git a/lib/options_test.go b/lib/options_test.go index f5b73419c51..586cfc52324 100644 --- a/lib/options_test.go +++ b/lib/options_test.go @@ -160,11 +160,11 @@ func TestOptions(t *testing.T) { }) t.Run("TLSVersion", func(t *testing.T) { t.Parallel() - versions := TLSVersions{Min: tls.VersionSSL30, Max: tls.VersionTLS12} //nolint:staticcheck + versions := TLSVersions{Min: tls.VersionSSL30, Max: tls.VersionTLS12} opts := Options{}.Apply(Options{TLSVersion: &versions}) assert.NotNil(t, opts.TLSVersion) - assert.Equal(t, opts.TLSVersion.Min, TLSVersion(tls.VersionSSL30)) //nolint:staticcheck + assert.Equal(t, opts.TLSVersion.Min, TLSVersion(tls.VersionSSL30)) assert.Equal(t, opts.TLSVersion.Max, TLSVersion(tls.VersionTLS12)) t.Run("JSON", func(t *testing.T) { diff --git a/output/cloud/expv2/flush.go b/output/cloud/expv2/flush.go index 703ac052510..036e724c16c 100644 --- a/output/cloud/expv2/flush.go +++ b/output/cloud/expv2/flush.go @@ -87,7 +87,7 @@ func (f *metricsFlusher) flush() error { func (f *metricsFlusher) flushBatches(batches []*pbcloud.MetricSet) error { // TODO remove after go 1.21 becomes the minimum supported version - it has `min` in it - min := func(a, b int) int { + minInt := func(a, b int) int { if a < b { return a } @@ -95,7 +95,7 @@ func (f *metricsFlusher) flushBatches(batches []*pbcloud.MetricSet) error { } var ( - workers = min(len(batches), f.batchPushConcurrency) + workers = minInt(len(batches), f.batchPushConcurrency) errs = make(chan error, workers) feed = make(chan *pbcloud.MetricSet) finalErr error diff --git a/output/cloud/output_test.go b/output/cloud/output_test.go index f0e1fc58303..fc3edb00d6d 100644 --- a/output/cloud/output_test.go +++ b/output/cloud/output_test.go @@ -94,13 +94,14 @@ func TestOutputCreateTestWithConfigOverwrite(t *testing.T) { handler := func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { case "/v1/tests": - fmt.Fprintf(w, `{ + _, err := fmt.Fprintf(w, `{ "reference_id": "12345", "config": { "metricPushInterval": "10ms", "aggregationPeriod": "40s" } }`) + require.NoError(t, err) case "/v1/tests/12345": w.WriteHeader(http.StatusOK) default: diff --git a/ui/form.go b/ui/form.go index bf00e1ced01..9c9451ef25d 100644 --- a/ui/form.go +++ b/ui/form.go @@ -39,7 +39,7 @@ func (f Form) Run(r io.Reader, w io.Writer) (map[string]string, error) { if extra := field.GetLabelExtra(); extra != "" { displayLabel += " " + color.New(color.Faint, color.FgCyan).Sprint("["+extra+"]") } - if _, err := fmt.Fprintf(w, " "+displayLabel+": "); err != nil { + if _, err := fmt.Fprint(w, " "+displayLabel+": "); err != nil { return nil, err } @@ -47,7 +47,10 @@ func (f Form) Run(r io.Reader, w io.Writer) (map[string]string, error) { s, err := field.GetContents(r) if _, ok := field.(PasswordField); ok { - fmt.Fprint(w, "\n") + _, err := fmt.Fprint(w, "\n") + if err != nil { + return nil, err + } } color.Unset() diff --git a/ui/pb/helpers.go b/ui/pb/helpers.go index 546042a2930..6f595f1693f 100644 --- a/ui/pb/helpers.go +++ b/ui/pb/helpers.go @@ -110,14 +110,13 @@ func GetFixedLengthDuration(d, maxDuration time.Duration) (result string) { return string(buf[i:]) } -// Clampf returns the given value, "clamped" to the range [min, max]. -// This is copied from lib/util.go to avoid circular imports. -func Clampf(val, min, max float64) float64 { +// Clampf returns the given value, "clamped" to the range [floor, ceiling]. +func Clampf(val, floor, ceiling float64) float64 { switch { - case val < min: - return min - case val > max: - return max + case val < floor: + return floor + case val > ceiling: + return ceiling default: return val } From c5dc773703e8f44ebce81ab929b7dd741b803335 Mon Sep 17 00:00:00 2001 From: Mihail Stoykov Date: Tue, 20 Aug 2024 11:09:21 +0300 Subject: [PATCH 02/12] golangci-lint: enable fatcontext and canonicalheader - fatcontext prevents a problem we had in the past where you keep adding variables to a context canonicalheader has some performance improvements as it doesn't require go to canonize the header on each invocation Those are the only new linters since last we updated --- .golangci.yml | 3 +++ cloudapi/client.go | 2 +- cloudapi/logs.go | 2 +- lib/executor/vu_handle.go | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 91f1a57d5b8..468bc54eff1 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -19,6 +19,7 @@ issues: # files (due to common repeats and long functions in test code) - path: _(test|gen)\.go linters: + - canonicalheader - cyclop - dupl - gocognit @@ -68,6 +69,7 @@ linters: - asciicheck - bidichk - bodyclose + - canonicalheader - contextcheck - cyclop - dogsled @@ -79,6 +81,7 @@ linters: - errorlint - exhaustive - exportloopref + - fatcontext - forbidigo - forcetypeassert - funlen diff --git a/cloudapi/client.go b/cloudapi/client.go index 1c6628bad7d..0292564a4f9 100644 --- a/cloudapi/client.go +++ b/cloudapi/client.go @@ -20,7 +20,7 @@ const ( // MaxRetries specifies max retry attempts MaxRetries = 3 - k6IdempotencyKeyHeader = "k6-Idempotency-Key" + k6IdempotencyKeyHeader = "K6-Idempotency-Key" ) // Client handles communication with the k6 Cloud API. diff --git a/cloudapi/logs.go b/cloudapi/logs.go index 2f215f99b58..129c6500d5c 100644 --- a/cloudapi/logs.go +++ b/cloudapi/logs.go @@ -101,7 +101,7 @@ func (c *Config) logtailConn(ctx context.Context, referenceID string, since time headers := make(http.Header) headers.Add("Sec-WebSocket-Protocol", "token="+c.Token.String) headers.Add("Authorization", "token "+c.Token.String) - headers.Add("X-K6TestRun-Id", referenceID) + headers.Add("X-K6testrun-Id", referenceID) var conn *websocket.Conn err = retry(sleeperFunc(time.Sleep), 3, 5*time.Second, 2*time.Minute, func() (err error) { diff --git a/lib/executor/vu_handle.go b/lib/executor/vu_handle.go index a5c40ea43a7..8a3c57fdf6a 100644 --- a/lib/executor/vu_handle.go +++ b/lib/executor/vu_handle.go @@ -225,7 +225,7 @@ func (vh *vuHandle) runLoopsIfPossible(runIter func(context.Context, lib.ActiveV // we need to cancel the context, to return the vu // and because *we* did, lets reinitialize it cancel() - vh.ctx, vh.cancel = context.WithCancel(vh.parentCtx) + vh.ctx, vh.cancel = context.WithCancel(vh.parentCtx) //nolint:fatcontext // isn't actually on the same context } fallthrough // to set the state case toHardStop: From 441f4d60d035dc5336703840765d82f852e07c69 Mon Sep 17 00:00:00 2001 From: Ben Radler Date: Wed, 21 Aug 2024 00:52:50 -0700 Subject: [PATCH 03/12] Add call to `AllowMissingFileDescriptors` in `lib/netext/grpcext/reflect.go` (#3871) --- lib/netext/grpcext/reflect.go | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/netext/grpcext/reflect.go b/lib/netext/grpcext/reflect.go index 548e2aeab3b..25c4f097a41 100644 --- a/lib/netext/grpcext/reflect.go +++ b/lib/netext/grpcext/reflect.go @@ -19,6 +19,7 @@ type reflectionClient struct { // It is called in the connect function the first time the Client.Connect function is called. func (rc *reflectionClient) Reflect(ctx context.Context) (*descriptorpb.FileDescriptorSet, error) { client := grpcreflect.NewClientAuto(ctx, rc.Conn) + client.AllowMissingFileDescriptors() services, err := client.ListServices() if err != nil { From eaa5419d13ec2a8fec87de7eba9ea6bf3f49e605 Mon Sep 17 00:00:00 2001 From: Lev Zakharov Date: Wed, 21 Aug 2024 11:47:59 +0300 Subject: [PATCH 04/12] Add `discardResponseMessage` option for gRPC client (#3820) Now gRPC unary RPCs respects `discardResponseMessage` option. When the option is used the client still fetches the response body but it doesn't serialize the expected content as JSON. It removes a step that would take significant CPU cycles. Note that unfortunately, gRPC doesn't support discarding completely the response body so it is resolved using emptypb.Empty. This is the reason why the response body is still loaded in memory. --- js/modules/k6/grpc/client.go | 13 +++--- js/modules/k6/grpc/client_test.go | 69 +++++++++++++++++++++++++++++++ js/modules/k6/grpc/params.go | 9 ++-- js/modules/k6/grpc/params_test.go | 41 ++++++++++++++++++ lib/netext/grpcext/conn.go | 24 +++++++---- lib/netext/grpcext/conn_test.go | 22 ++++++++++ 6 files changed, 161 insertions(+), 17 deletions(-) diff --git a/js/modules/k6/grpc/client.go b/js/modules/k6/grpc/client.go index 292e3adac64..97e228329b6 100644 --- a/js/modules/k6/grpc/client.go +++ b/js/modules/k6/grpc/client.go @@ -365,12 +365,13 @@ func (c *Client) buildInvokeRequest( p.SetSystemTags(state, c.addr, method) return grpcext.InvokeRequest{ - Method: method, - MethodDescriptor: methodDesc, - Timeout: p.Timeout, - Message: b, - TagsAndMeta: &p.TagsAndMeta, - Metadata: p.Metadata, + Method: method, + MethodDescriptor: methodDesc, + Timeout: p.Timeout, + DiscardResponseMessage: p.DiscardResponseMessage, + Message: b, + TagsAndMeta: &p.TagsAndMeta, + Metadata: p.Metadata, }, nil } diff --git a/js/modules/k6/grpc/client_test.go b/js/modules/k6/grpc/client_test.go index 11951986c3c..3f5bc71ae9f 100644 --- a/js/modules/k6/grpc/client_test.go +++ b/js/modules/k6/grpc/client_test.go @@ -310,6 +310,19 @@ func TestClient(t *testing.T) { client.invoke("grpc.testing.TestService/EmptyCall", {}, { timeout: 2000 })`, }, }, + { + name: "InvokeDiscardResponseMessage", + initString: codeBlock{ + code: ` + var client = new grpc.Client(); + client.load([], "../../../../lib/testutils/httpmultibin/grpc_testing/test.proto");`, + }, + vuString: codeBlock{ + code: ` + client.connect("GRPCBIN_ADDR"); + client.invoke("grpc.testing.TestService/EmptyCall", {}, { discardResponseMessage: true })`, + }, + }, { name: "Invoke", initString: codeBlock{code: ` @@ -333,6 +346,32 @@ func TestClient(t *testing.T) { }, }, }, + { + name: "InvokeDiscardResponseMessage", + initString: codeBlock{code: ` + var client = new grpc.Client(); + client.load([], "../../../../lib/testutils/httpmultibin/grpc_testing/test.proto");`}, + setup: func(tb *httpmultibin.HTTPMultiBin) { + tb.GRPCStub.EmptyCallFunc = func(context.Context, *grpc_testing.Empty) (*grpc_testing.Empty, error) { + return &grpc_testing.Empty{}, nil + } + }, + vuString: codeBlock{ + code: ` + client.connect("GRPCBIN_ADDR"); + var resp = client.invoke("grpc.testing.TestService/EmptyCall", {}, { discardResponseMessage: true }) + if (resp.status !== grpc.StatusOK) { + throw new Error("unexpected error: " + JSON.stringify(resp.error) + "or status: " + resp.status) + } + if (resp.message !== null) { + throw new Error("unexpected message: " + JSON.stringify(resp.message)) + }`, + asserts: func(t *testing.T, rb *httpmultibin.HTTPMultiBin, samples chan metrics.SampleContainer, _ error) { + samplesBuf := metrics.GetBufferedSamples(samples) + assertMetricEmitted(t, metrics.GRPCReqDurationName, samplesBuf, rb.Replacer.Replace("GRPCBIN_ADDR/grpc.testing.TestService/EmptyCall")) + }, + }, + }, { name: "AsyncInvoke", initString: codeBlock{code: ` @@ -360,6 +399,36 @@ func TestClient(t *testing.T) { }, }, }, + { + name: "AsyncInvokeDiscardResponseMessage", + initString: codeBlock{code: ` + var client = new grpc.Client(); + client.load([], "../../../../lib/testutils/httpmultibin/grpc_testing/test.proto");`}, + setup: func(tb *httpmultibin.HTTPMultiBin) { + tb.GRPCStub.EmptyCallFunc = func(context.Context, *grpc_testing.Empty) (*grpc_testing.Empty, error) { + return &grpc_testing.Empty{}, nil + } + }, + vuString: codeBlock{ + code: ` + client.connect("GRPCBIN_ADDR"); + client.asyncInvoke("grpc.testing.TestService/EmptyCall", {}, { discardResponseMessage: true }).then(function(resp) { + if (resp.status !== grpc.StatusOK) { + throw new Error("unexpected error: " + JSON.stringify(resp.error) + "or status: " + resp.status) + } + if (resp.message !== null) { + throw new Error("unexpected message: " + JSON.stringify(resp.message)) + } + }, (err) => { + throw new Error("unexpected error: " + err) + }) + `, + asserts: func(t *testing.T, rb *httpmultibin.HTTPMultiBin, samples chan metrics.SampleContainer, _ error) { + samplesBuf := metrics.GetBufferedSamples(samples) + assertMetricEmitted(t, metrics.GRPCReqDurationName, samplesBuf, rb.Replacer.Replace("GRPCBIN_ADDR/grpc.testing.TestService/EmptyCall")) + }, + }, + }, { name: "InvokeAnyProto", initString: codeBlock{code: ` diff --git a/js/modules/k6/grpc/params.go b/js/modules/k6/grpc/params.go index f03d10bea13..25af351350c 100644 --- a/js/modules/k6/grpc/params.go +++ b/js/modules/k6/grpc/params.go @@ -18,9 +18,10 @@ import ( // callParams is the parameters that can be passed to a gRPC calls // like invoke or newStream. type callParams struct { - Metadata metadata.MD - TagsAndMeta metrics.TagsAndMeta - Timeout time.Duration + Metadata metadata.MD + TagsAndMeta metrics.TagsAndMeta + Timeout time.Duration + DiscardResponseMessage bool } // newCallParams constructs the call parameters from the input value. @@ -58,6 +59,8 @@ func newCallParams(vu modules.VU, input sobek.Value) (*callParams, error) { if err != nil { return result, fmt.Errorf("invalid timeout value: %w", err) } + case "discardResponseMessage": + result.DiscardResponseMessage = params.Get(k).ToBoolean() default: return result, fmt.Errorf("unknown param: %q", k) } diff --git a/js/modules/k6/grpc/params_test.go b/js/modules/k6/grpc/params_test.go index ef0c20c14ca..76dbcdd9f19 100644 --- a/js/modules/k6/grpc/params_test.go +++ b/js/modules/k6/grpc/params_test.go @@ -139,6 +139,47 @@ func TestCallParamsTimeOutParse(t *testing.T) { } } +func TestCallParamsDiscardResponseMessageParse(t *testing.T) { + t.Parallel() + + testCases := []struct { + Name string + JSON string + DiscardResponseMessage bool + }{ + { + Name: "Empty", + JSON: `{}`, + DiscardResponseMessage: false, + }, + { + Name: "DiscardResponseMessageFalse", + JSON: `{ discardResponseMessage: false }`, + DiscardResponseMessage: false, + }, + { + Name: "DiscardResponseMessageTrue", + JSON: `{ discardResponseMessage: true }`, + DiscardResponseMessage: true, + }, + } + + for _, tc := range testCases { + tc := tc + + t.Run(tc.Name, func(t *testing.T) { + t.Parallel() + + testRuntime, params := newParamsTestRuntime(t, tc.JSON) + + p, err := newCallParams(testRuntime.VU, params) + require.NoError(t, err) + + assert.Equal(t, tc.DiscardResponseMessage, p.DiscardResponseMessage) + }) + } +} + // newParamsTestRuntime creates a new test runtime // that could be used to test the params // it also moves to the VU context and creates the params diff --git a/lib/netext/grpcext/conn.go b/lib/netext/grpcext/conn.go index 386a6a110ba..849fc3408e3 100644 --- a/lib/netext/grpcext/conn.go +++ b/lib/netext/grpcext/conn.go @@ -26,16 +26,18 @@ import ( "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/types/descriptorpb" "google.golang.org/protobuf/types/dynamicpb" + "google.golang.org/protobuf/types/known/emptypb" ) // InvokeRequest represents a unary gRPC request. type InvokeRequest struct { - Method string - MethodDescriptor protoreflect.MethodDescriptor - Timeout time.Duration - TagsAndMeta *metrics.TagsAndMeta - Message []byte - Metadata metadata.MD + Method string + MethodDescriptor protoreflect.MethodDescriptor + Timeout time.Duration + TagsAndMeta *metrics.TagsAndMeta + DiscardResponseMessage bool + Message []byte + Metadata metadata.MD } // InvokeResponse represents a gRPC response. @@ -133,7 +135,13 @@ func (c *Conn) Invoke( ctx = withRPCState(ctx, &rpcState{tagsAndMeta: req.TagsAndMeta}) - resp := dynamicpb.NewMessage(req.MethodDescriptor.Output()) + var resp *dynamicpb.Message + if req.DiscardResponseMessage { + resp = dynamicpb.NewMessage((&emptypb.Empty{}).ProtoReflect().Descriptor()) + } else { + resp = dynamicpb.NewMessage(req.MethodDescriptor.Output()) + } + header, trailer := metadata.New(nil), metadata.New(nil) copts := make([]grpc.CallOption, 0, len(opts)+2) @@ -165,7 +173,7 @@ func (c *Conn) Invoke( response.Error = errMsg } - if resp != nil { + if resp != nil && !req.DiscardResponseMessage { msg, err := convert(marshaler, resp) if err != nil { return nil, fmt.Errorf("unable to convert response object to JSON: %w", err) diff --git a/lib/netext/grpcext/conn_test.go b/lib/netext/grpcext/conn_test.go index a6b5fc1276b..6d14df0b163 100644 --- a/lib/netext/grpcext/conn_test.go +++ b/lib/netext/grpcext/conn_test.go @@ -64,6 +64,28 @@ func TestInvokeWithCallOptions(t *testing.T) { assert.NotNil(t, res) } +func TestInvokeWithDiscardResponseMessage(t *testing.T) { + t.Parallel() + + reply := func(_, _ *dynamicpb.Message, opts ...grpc.CallOption) error { + assert.Len(t, opts, 3) // two by default plus one injected + return nil + } + + c := Conn{raw: invokemock(reply)} + r := InvokeRequest{ + Method: "/hello.HelloService/NoOp", + MethodDescriptor: methodFromProto("NoOp"), + DiscardResponseMessage: true, + Message: []byte(`{}`), + Metadata: metadata.New(nil), + } + res, err := c.Invoke(context.Background(), r, grpc.UseCompressor("fakeone")) + require.NoError(t, err) + assert.NotNil(t, res) + assert.Nil(t, res.Message) +} + func TestInvokeReturnError(t *testing.T) { t.Parallel() From 01ac781b83c0340e94071fff57a19fb5495fa048 Mon Sep 17 00:00:00 2001 From: Oleg Bespalov Date: Wed, 21 Aug 2024 08:59:00 +0200 Subject: [PATCH 05/12] Upgrades golang.org/x/crypto v0.25.0 => v0.26.0 --- go.mod | 10 ++-- go.sum | 20 ++++---- vendor/golang.org/x/crypto/LICENSE | 4 +- vendor/golang.org/x/sync/LICENSE | 4 +- vendor/golang.org/x/sys/LICENSE | 4 +- vendor/golang.org/x/sys/unix/mkerrors.sh | 1 + .../golang.org/x/sys/unix/syscall_darwin.go | 12 +++++ vendor/golang.org/x/sys/unix/syscall_linux.go | 1 + .../golang.org/x/sys/unix/syscall_openbsd.go | 1 + .../x/sys/unix/zerrors_darwin_amd64.go | 5 ++ .../x/sys/unix/zerrors_darwin_arm64.go | 5 ++ vendor/golang.org/x/sys/unix/zerrors_linux.go | 38 ++++++++++++-- .../x/sys/unix/zerrors_linux_386.go | 2 + .../x/sys/unix/zerrors_linux_amd64.go | 2 + .../x/sys/unix/zerrors_linux_arm.go | 2 + .../x/sys/unix/zerrors_linux_arm64.go | 2 + .../x/sys/unix/zerrors_linux_loong64.go | 2 + .../x/sys/unix/zerrors_linux_mips.go | 2 + .../x/sys/unix/zerrors_linux_mips64.go | 2 + .../x/sys/unix/zerrors_linux_mips64le.go | 2 + .../x/sys/unix/zerrors_linux_mipsle.go | 2 + .../x/sys/unix/zerrors_linux_ppc.go | 2 + .../x/sys/unix/zerrors_linux_ppc64.go | 2 + .../x/sys/unix/zerrors_linux_ppc64le.go | 2 + .../x/sys/unix/zerrors_linux_riscv64.go | 2 + .../x/sys/unix/zerrors_linux_s390x.go | 2 + .../x/sys/unix/zerrors_linux_sparc64.go | 2 + .../x/sys/unix/zsyscall_darwin_amd64.go | 48 ++++++++++++++++++ .../x/sys/unix/zsyscall_darwin_amd64.s | 10 ++++ .../x/sys/unix/zsyscall_darwin_arm64.go | 48 ++++++++++++++++++ .../x/sys/unix/zsyscall_darwin_arm64.s | 10 ++++ .../golang.org/x/sys/unix/zsyscall_linux.go | 16 ++++++ .../x/sys/unix/zsyscall_openbsd_386.go | 24 +++++++++ .../x/sys/unix/zsyscall_openbsd_386.s | 5 ++ .../x/sys/unix/zsyscall_openbsd_amd64.go | 24 +++++++++ .../x/sys/unix/zsyscall_openbsd_amd64.s | 5 ++ .../x/sys/unix/zsyscall_openbsd_arm.go | 24 +++++++++ .../x/sys/unix/zsyscall_openbsd_arm.s | 5 ++ .../x/sys/unix/zsyscall_openbsd_arm64.go | 24 +++++++++ .../x/sys/unix/zsyscall_openbsd_arm64.s | 5 ++ .../x/sys/unix/zsyscall_openbsd_mips64.go | 24 +++++++++ .../x/sys/unix/zsyscall_openbsd_mips64.s | 5 ++ .../x/sys/unix/zsyscall_openbsd_ppc64.go | 24 +++++++++ .../x/sys/unix/zsyscall_openbsd_ppc64.s | 6 +++ .../x/sys/unix/zsyscall_openbsd_riscv64.go | 24 +++++++++ .../x/sys/unix/zsyscall_openbsd_riscv64.s | 5 ++ .../x/sys/unix/zsysnum_linux_386.go | 1 + .../x/sys/unix/zsysnum_linux_amd64.go | 1 + .../x/sys/unix/zsysnum_linux_arm.go | 1 + .../x/sys/unix/zsysnum_linux_arm64.go | 1 + .../x/sys/unix/zsysnum_linux_loong64.go | 1 + .../x/sys/unix/zsysnum_linux_mips.go | 1 + .../x/sys/unix/zsysnum_linux_mips64.go | 1 + .../x/sys/unix/zsysnum_linux_mips64le.go | 1 + .../x/sys/unix/zsysnum_linux_mipsle.go | 1 + .../x/sys/unix/zsysnum_linux_ppc.go | 1 + .../x/sys/unix/zsysnum_linux_ppc64.go | 1 + .../x/sys/unix/zsysnum_linux_ppc64le.go | 1 + .../x/sys/unix/zsysnum_linux_riscv64.go | 1 + .../x/sys/unix/zsysnum_linux_s390x.go | 1 + .../x/sys/unix/zsysnum_linux_sparc64.go | 1 + vendor/golang.org/x/sys/unix/ztypes_linux.go | 7 +-- .../x/sys/windows/security_windows.go | 2 +- .../x/sys/windows/syscall_windows.go | 12 ++++- .../golang.org/x/sys/windows/types_windows.go | 27 +++++++++- .../x/sys/windows/zsyscall_windows.go | 49 ++++++++++++++++--- vendor/golang.org/x/term/LICENSE | 4 +- vendor/golang.org/x/text/LICENSE | 4 +- vendor/modules.txt | 10 ++-- 69 files changed, 553 insertions(+), 48 deletions(-) diff --git a/go.mod b/go.mod index c4a6c6c7ce8..8f25d7373bb 100644 --- a/go.mod +++ b/go.mod @@ -46,10 +46,10 @@ require ( go.opentelemetry.io/otel/sdk v1.24.0 go.opentelemetry.io/otel/trace v1.24.0 go.uber.org/goleak v1.3.0 - golang.org/x/crypto v0.25.0 + golang.org/x/crypto v0.26.0 golang.org/x/crypto/x509roots/fallback v0.0.0-20240709155400-d66d9c31b4ae golang.org/x/net v0.27.0 - golang.org/x/term v0.22.0 + golang.org/x/term v0.23.0 golang.org/x/time v0.5.0 google.golang.org/grpc v1.64.1 google.golang.org/protobuf v1.34.2 @@ -95,9 +95,9 @@ require ( go.opentelemetry.io/otel/metric v1.24.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.24.0 // indirect go.opentelemetry.io/proto/otlp v1.1.0 // indirect - golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/sync v0.8.0 // indirect + golang.org/x/sys v0.23.0 // indirect + golang.org/x/text v0.17.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect gopkg.in/cenkalti/backoff.v1 v1.1.0 // indirect diff --git a/go.sum b/go.sum index e475609b775..7f6152e5fe7 100644 --- a/go.sum +++ b/go.sum @@ -224,8 +224,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= +golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= +golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= golang.org/x/crypto/x509roots/fallback v0.0.0-20240709155400-d66d9c31b4ae h1:3Lr8+tydLa3EM5BMsp0/++1Pca9P3T3lnTTj6z5BqOc= golang.org/x/crypto/x509roots/fallback v0.0.0-20240709155400-d66d9c31b4ae/go.mod h1:kNa9WdvYnzFwC79zRpLRMJbdEFlhyM5RPFBBZp/wWH8= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -261,8 +261,8 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -280,21 +280,21 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= +golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= -golang.org/x/term v0.22.0 h1:BbsgPEJULsl2fV/AT3v15Mjva5yXKQDyKf+TbDz7QJk= -golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4= +golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= +golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/vendor/golang.org/x/crypto/LICENSE b/vendor/golang.org/x/crypto/LICENSE index 6a66aea5eaf..2a7cf70da6e 100644 --- a/vendor/golang.org/x/crypto/LICENSE +++ b/vendor/golang.org/x/crypto/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/golang.org/x/sync/LICENSE b/vendor/golang.org/x/sync/LICENSE index 6a66aea5eaf..2a7cf70da6e 100644 --- a/vendor/golang.org/x/sync/LICENSE +++ b/vendor/golang.org/x/sync/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/golang.org/x/sys/LICENSE b/vendor/golang.org/x/sys/LICENSE index 6a66aea5eaf..2a7cf70da6e 100644 --- a/vendor/golang.org/x/sys/LICENSE +++ b/vendor/golang.org/x/sys/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index 4ed2e488b61..d07dd09eb50 100644 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -58,6 +58,7 @@ includes_Darwin=' #define _DARWIN_USE_64_BIT_INODE #define __APPLE_USE_RFC_3542 #include +#include #include #include #include diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.go b/vendor/golang.org/x/sys/unix/syscall_darwin.go index 4cc7b005967..2d15200adb4 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin.go @@ -402,6 +402,18 @@ func IoctlSetIfreqMTU(fd int, ifreq *IfreqMTU) error { return ioctlPtr(fd, SIOCSIFMTU, unsafe.Pointer(ifreq)) } +//sys renamexNp(from string, to string, flag uint32) (err error) + +func RenamexNp(from string, to string, flag uint32) (err error) { + return renamexNp(from, to, flag) +} + +//sys renameatxNp(fromfd int, from string, tofd int, to string, flag uint32) (err error) + +func RenameatxNp(fromfd int, from string, tofd int, to string, flag uint32) (err error) { + return renameatxNp(fromfd, from, tofd, to, flag) +} + //sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS_SYSCTL func Uname(uname *Utsname) error { diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go index 5682e2628ad..3f1d3d4cb25 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -2592,3 +2592,4 @@ func SchedGetAttr(pid int, flags uint) (*SchedAttr, error) { } //sys Cachestat(fd uint, crange *CachestatRange, cstat *Cachestat_t, flags uint) (err error) +//sys Mseal(b []byte, flags uint) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd.go b/vendor/golang.org/x/sys/unix/syscall_openbsd.go index b25343c71a4..b86ded549c6 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd.go @@ -293,6 +293,7 @@ func Uname(uname *Utsname) error { //sys Mkfifoat(dirfd int, path string, mode uint32) (err error) //sys Mknod(path string, mode uint32, dev int) (err error) //sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error) +//sys Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) //sys Nanosleep(time *Timespec, leftover *Timespec) (err error) //sys Open(path string, mode int, perm uint32) (fd int, err error) //sys Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go index e40fa85245f..4308ac1772b 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go @@ -1169,6 +1169,11 @@ const ( PT_WRITE_D = 0x5 PT_WRITE_I = 0x4 PT_WRITE_U = 0x6 + RENAME_EXCL = 0x4 + RENAME_NOFOLLOW_ANY = 0x10 + RENAME_RESERVED1 = 0x8 + RENAME_SECLUDE = 0x1 + RENAME_SWAP = 0x2 RLIMIT_AS = 0x5 RLIMIT_CORE = 0x4 RLIMIT_CPU = 0x0 diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go index bb02aa6c056..c8068a7a169 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go @@ -1169,6 +1169,11 @@ const ( PT_WRITE_D = 0x5 PT_WRITE_I = 0x4 PT_WRITE_U = 0x6 + RENAME_EXCL = 0x4 + RENAME_NOFOLLOW_ANY = 0x10 + RENAME_RESERVED1 = 0x8 + RENAME_SECLUDE = 0x1 + RENAME_SWAP = 0x2 RLIMIT_AS = 0x5 RLIMIT_CORE = 0x4 RLIMIT_CPU = 0x0 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux.go b/vendor/golang.org/x/sys/unix/zerrors_linux.go index 877a62b479a..01a70b24638 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux.go @@ -457,6 +457,7 @@ const ( B600 = 0x8 B75 = 0x2 B9600 = 0xd + BCACHEFS_SUPER_MAGIC = 0xca451a4e BDEVFS_MAGIC = 0x62646576 BINDERFS_SUPER_MAGIC = 0x6c6f6f70 BINFMTFS_MAGIC = 0x42494e4d @@ -928,6 +929,7 @@ const ( EPOLL_CTL_ADD = 0x1 EPOLL_CTL_DEL = 0x2 EPOLL_CTL_MOD = 0x3 + EPOLL_IOC_TYPE = 0x8a EROFS_SUPER_MAGIC_V1 = 0xe0f5e1e2 ESP_V4_FLOW = 0xa ESP_V6_FLOW = 0xc @@ -941,9 +943,6 @@ const ( ETHTOOL_FEC_OFF = 0x4 ETHTOOL_FEC_RS = 0x8 ETHTOOL_FLAG_ALL = 0x7 - ETHTOOL_FLAG_COMPACT_BITSETS = 0x1 - ETHTOOL_FLAG_OMIT_REPLY = 0x2 - ETHTOOL_FLAG_STATS = 0x4 ETHTOOL_FLASHDEV = 0x33 ETHTOOL_FLASH_MAX_FILENAME = 0x80 ETHTOOL_FWVERS_LEN = 0x20 @@ -1705,6 +1704,7 @@ const ( KEXEC_ARCH_S390 = 0x160000 KEXEC_ARCH_SH = 0x2a0000 KEXEC_ARCH_X86_64 = 0x3e0000 + KEXEC_CRASH_HOTPLUG_SUPPORT = 0x8 KEXEC_FILE_DEBUG = 0x8 KEXEC_FILE_NO_INITRAMFS = 0x4 KEXEC_FILE_ON_CRASH = 0x2 @@ -1780,6 +1780,7 @@ const ( KEY_SPEC_USER_KEYRING = -0x4 KEY_SPEC_USER_SESSION_KEYRING = -0x5 LANDLOCK_ACCESS_FS_EXECUTE = 0x1 + LANDLOCK_ACCESS_FS_IOCTL_DEV = 0x8000 LANDLOCK_ACCESS_FS_MAKE_BLOCK = 0x800 LANDLOCK_ACCESS_FS_MAKE_CHAR = 0x40 LANDLOCK_ACCESS_FS_MAKE_DIR = 0x80 @@ -1861,6 +1862,19 @@ const ( MAP_FILE = 0x0 MAP_FIXED = 0x10 MAP_FIXED_NOREPLACE = 0x100000 + MAP_HUGE_16GB = 0x88000000 + MAP_HUGE_16KB = 0x38000000 + MAP_HUGE_16MB = 0x60000000 + MAP_HUGE_1GB = 0x78000000 + MAP_HUGE_1MB = 0x50000000 + MAP_HUGE_256MB = 0x70000000 + MAP_HUGE_2GB = 0x7c000000 + MAP_HUGE_2MB = 0x54000000 + MAP_HUGE_32MB = 0x64000000 + MAP_HUGE_512KB = 0x4c000000 + MAP_HUGE_512MB = 0x74000000 + MAP_HUGE_64KB = 0x40000000 + MAP_HUGE_8MB = 0x5c000000 MAP_HUGE_MASK = 0x3f MAP_HUGE_SHIFT = 0x1a MAP_PRIVATE = 0x2 @@ -2498,6 +2512,23 @@ const ( PR_PAC_GET_ENABLED_KEYS = 0x3d PR_PAC_RESET_KEYS = 0x36 PR_PAC_SET_ENABLED_KEYS = 0x3c + PR_PPC_DEXCR_CTRL_CLEAR = 0x4 + PR_PPC_DEXCR_CTRL_CLEAR_ONEXEC = 0x10 + PR_PPC_DEXCR_CTRL_EDITABLE = 0x1 + PR_PPC_DEXCR_CTRL_MASK = 0x1f + PR_PPC_DEXCR_CTRL_SET = 0x2 + PR_PPC_DEXCR_CTRL_SET_ONEXEC = 0x8 + PR_PPC_DEXCR_IBRTPD = 0x1 + PR_PPC_DEXCR_NPHIE = 0x3 + PR_PPC_DEXCR_SBHE = 0x0 + PR_PPC_DEXCR_SRAPD = 0x2 + PR_PPC_GET_DEXCR = 0x48 + PR_PPC_SET_DEXCR = 0x49 + PR_RISCV_CTX_SW_FENCEI_OFF = 0x1 + PR_RISCV_CTX_SW_FENCEI_ON = 0x0 + PR_RISCV_SCOPE_PER_PROCESS = 0x0 + PR_RISCV_SCOPE_PER_THREAD = 0x1 + PR_RISCV_SET_ICACHE_FLUSH_CTX = 0x47 PR_RISCV_V_GET_CONTROL = 0x46 PR_RISCV_V_SET_CONTROL = 0x45 PR_RISCV_V_VSTATE_CTRL_CUR_MASK = 0x3 @@ -3192,6 +3223,7 @@ const ( STATX_MTIME = 0x40 STATX_NLINK = 0x4 STATX_SIZE = 0x200 + STATX_SUBVOL = 0x8000 STATX_TYPE = 0x1 STATX_UID = 0x8 STATX__RESERVED = 0x80000000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go index e4bc0bd57c7..684a5168dac 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x80088a02 + EPIOCSPARAMS = 0x40088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go index 689317afdbf..61d74b592d6 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x80088a02 + EPIOCSPARAMS = 0x40088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go index 5cca668ac30..a28c9e3e893 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x80088a02 + EPIOCSPARAMS = 0x40088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go index 14270508b04..ab5d1fe8ead 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x80088a02 + EPIOCSPARAMS = 0x40088a01 EPOLL_CLOEXEC = 0x80000 ESR_MAGIC = 0x45535201 EXTPROC = 0x10000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go index 28e39afdcb4..c523090e7c1 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x80088a02 + EPIOCSPARAMS = 0x40088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go index cd66e92cb42..01e6ea7804b 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x80 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go index c1595eba78e..7aa610b1e71 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x80 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go index ee9456b0da7..92af771b44a 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x80 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go index 8cfca81e1b5..b27ef5e6f11 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x80 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go index 60b0deb3af7..237a2cefb3e 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x20 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000000 FF1 = 0x4000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go index f90aa7281bf..4a5c555a36e 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x20 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000000 FF1 = 0x4000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go index ba9e0150338..a02fb49a5f8 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x20 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000000 FF1 = 0x4000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go index 07cdfd6e9fd..e26a7c61b2b 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x80088a02 + EPIOCSPARAMS = 0x40088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go index 2f1dd214a74..c48f7c2103b 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x80088a02 + EPIOCSPARAMS = 0x40088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go index f40519d9018..ad4b9aace7b 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go @@ -82,6 +82,8 @@ const ( EFD_CLOEXEC = 0x400000 EFD_NONBLOCK = 0x4000 EMT_TAGOVF = 0x1 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x400000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go index 07642c308d3..b622533ef2c 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go @@ -740,6 +740,54 @@ func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func renamexNp(from string, to string, flag uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_renamex_np_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flag)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_renamex_np_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_renamex_np renamex_np "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func renameatxNp(fromfd int, from string, tofd int, to string, flag uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_renameatx_np_trampoline_addr, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), uintptr(flag), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_renameatx_np_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_renameatx_np renameatx_np "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { var _p0 unsafe.Pointer if len(mib) > 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s index 923e08cb792..cfe6646baf2 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s @@ -223,6 +223,16 @@ TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_ioctl_trampoline_addr(SB)/8, $libc_ioctl_trampoline<>(SB) +TEXT libc_renamex_np_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_renamex_np(SB) +GLOBL ·libc_renamex_np_trampoline_addr(SB), RODATA, $8 +DATA ·libc_renamex_np_trampoline_addr(SB)/8, $libc_renamex_np_trampoline<>(SB) + +TEXT libc_renameatx_np_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_renameatx_np(SB) +GLOBL ·libc_renameatx_np_trampoline_addr(SB), RODATA, $8 +DATA ·libc_renameatx_np_trampoline_addr(SB)/8, $libc_renameatx_np_trampoline<>(SB) + TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sysctl(SB) GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go index 7d73dda6473..13f624f69f1 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go @@ -740,6 +740,54 @@ func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func renamexNp(from string, to string, flag uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_renamex_np_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flag)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_renamex_np_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_renamex_np renamex_np "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func renameatxNp(fromfd int, from string, tofd int, to string, flag uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_renameatx_np_trampoline_addr, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), uintptr(flag), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_renameatx_np_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_renameatx_np renameatx_np "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { var _p0 unsafe.Pointer if len(mib) > 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s index 057700111e7..fe222b75df0 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s @@ -223,6 +223,16 @@ TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_ioctl_trampoline_addr(SB)/8, $libc_ioctl_trampoline<>(SB) +TEXT libc_renamex_np_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_renamex_np(SB) +GLOBL ·libc_renamex_np_trampoline_addr(SB), RODATA, $8 +DATA ·libc_renamex_np_trampoline_addr(SB)/8, $libc_renamex_np_trampoline<>(SB) + +TEXT libc_renameatx_np_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_renameatx_np(SB) +GLOBL ·libc_renameatx_np_trampoline_addr(SB), RODATA, $8 +DATA ·libc_renameatx_np_trampoline_addr(SB)/8, $libc_renameatx_np_trampoline<>(SB) + TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sysctl(SB) GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux.go b/vendor/golang.org/x/sys/unix/zsyscall_linux.go index 87d8612a1dc..1bc1a5adb25 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux.go @@ -2229,3 +2229,19 @@ func Cachestat(fd uint, crange *CachestatRange, cstat *Cachestat_t, flags uint) } return } + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mseal(b []byte, flags uint) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall(SYS_MSEAL, uintptr(_p0), uintptr(len(b)), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go index 9dc42410b78..1851df14e87 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go @@ -1493,6 +1493,30 @@ var libc_mknodat_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(fsType) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dir) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mount mount "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s index 41b5617316c..0b43c693656 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s @@ -463,6 +463,11 @@ TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $4 DATA ·libc_mknodat_trampoline_addr(SB)/4, $libc_mknodat_trampoline<>(SB) +TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mount(SB) +GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $4 +DATA ·libc_mount_trampoline_addr(SB)/4, $libc_mount_trampoline<>(SB) + TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_nanosleep(SB) GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $4 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go index 0d3a0751cd4..e1ec0dbe4ec 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go @@ -1493,6 +1493,30 @@ var libc_mknodat_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(fsType) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dir) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mount mount "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s index 4019a656f6d..880c6d6e316 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s @@ -463,6 +463,11 @@ TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $8 DATA ·libc_mknodat_trampoline_addr(SB)/8, $libc_mknodat_trampoline<>(SB) +TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mount(SB) +GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mount_trampoline_addr(SB)/8, $libc_mount_trampoline<>(SB) + TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_nanosleep(SB) GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go index c39f7776db3..7c8452a63e9 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go @@ -1493,6 +1493,30 @@ var libc_mknodat_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(fsType) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dir) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mount mount "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s index ac4af24f908..b8ef95b0fa1 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s @@ -463,6 +463,11 @@ TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $4 DATA ·libc_mknodat_trampoline_addr(SB)/4, $libc_mknodat_trampoline<>(SB) +TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mount(SB) +GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $4 +DATA ·libc_mount_trampoline_addr(SB)/4, $libc_mount_trampoline<>(SB) + TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_nanosleep(SB) GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $4 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go index 57571d072fe..2ffdf861f75 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go @@ -1493,6 +1493,30 @@ var libc_mknodat_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(fsType) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dir) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mount mount "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s index f77d532121b..2af3b5c762f 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s @@ -463,6 +463,11 @@ TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $8 DATA ·libc_mknodat_trampoline_addr(SB)/8, $libc_mknodat_trampoline<>(SB) +TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mount(SB) +GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mount_trampoline_addr(SB)/8, $libc_mount_trampoline<>(SB) + TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_nanosleep(SB) GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go index e62963e67e2..1da08d52675 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go @@ -1493,6 +1493,30 @@ var libc_mknodat_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(fsType) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dir) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mount mount "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s index fae140b62c9..b7a251353b0 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s @@ -463,6 +463,11 @@ TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $8 DATA ·libc_mknodat_trampoline_addr(SB)/8, $libc_mknodat_trampoline<>(SB) +TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mount(SB) +GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mount_trampoline_addr(SB)/8, $libc_mount_trampoline<>(SB) + TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_nanosleep(SB) GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go index 00831354c82..6e85b0aac95 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go @@ -1493,6 +1493,30 @@ var libc_mknodat_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(fsType) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dir) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mount mount "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s index 9d1e0ff06d0..f15dadf0552 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s @@ -555,6 +555,12 @@ TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $8 DATA ·libc_mknodat_trampoline_addr(SB)/8, $libc_mknodat_trampoline<>(SB) +TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_mount(SB) + RET +GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mount_trampoline_addr(SB)/8, $libc_mount_trampoline<>(SB) + TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 CALL libc_nanosleep(SB) RET diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go index 79029ed5848..28b487df251 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go @@ -1493,6 +1493,30 @@ var libc_mknodat_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(fsType) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dir) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mount mount "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s index da115f9a4b6..1e7f321e436 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s @@ -463,6 +463,11 @@ TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $8 DATA ·libc_mknodat_trampoline_addr(SB)/8, $libc_mknodat_trampoline<>(SB) +TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mount(SB) +GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mount_trampoline_addr(SB)/8, $libc_mount_trampoline<>(SB) + TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_nanosleep(SB) GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go index 53aef5dc58d..524b0820cbc 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go @@ -457,4 +457,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go index 71d524763d3..d3e38f681ab 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go @@ -379,4 +379,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go index c747706131c..70b35bf3b09 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go @@ -421,4 +421,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go index f96e214f6d4..6c778c23278 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go @@ -324,4 +324,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go index 28425346cf1..37281cf51a8 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go @@ -318,4 +318,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go index d0953018dae..7e567f1efff 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go @@ -441,4 +441,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 4459 SYS_LSM_SET_SELF_ATTR = 4460 SYS_LSM_LIST_MODULES = 4461 + SYS_MSEAL = 4462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go index 295c7f4b818..38ae55e5ef8 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go @@ -371,4 +371,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 5459 SYS_LSM_SET_SELF_ATTR = 5460 SYS_LSM_LIST_MODULES = 5461 + SYS_MSEAL = 5462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go index d1a9eaca7a4..55e92e60a82 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go @@ -371,4 +371,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 5459 SYS_LSM_SET_SELF_ATTR = 5460 SYS_LSM_LIST_MODULES = 5461 + SYS_MSEAL = 5462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go index bec157c39fd..60658d6a021 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go @@ -441,4 +441,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 4459 SYS_LSM_SET_SELF_ATTR = 4460 SYS_LSM_LIST_MODULES = 4461 + SYS_MSEAL = 4462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go index 7ee7bdc435c..e203e8a7ed4 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go @@ -448,4 +448,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go index fad1f25b449..5944b97d546 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go @@ -420,4 +420,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go index 7d3e16357d6..c66d416dad1 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go @@ -420,4 +420,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go index 0ed53ad9f7e..9889f6a5591 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go @@ -325,4 +325,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go index 2fba04ad500..01d86825bb9 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go @@ -386,4 +386,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go index 621d00d741b..7b703e77cda 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go @@ -399,4 +399,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux.go b/vendor/golang.org/x/sys/unix/ztypes_linux.go index 4740b834854..b102b95a0a1 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux.go @@ -110,7 +110,8 @@ type Statx_t struct { Mnt_id uint64 Dio_mem_align uint32 Dio_offset_align uint32 - _ [12]uint64 + Subvol uint64 + _ [11]uint64 } type Fsid struct { @@ -3473,7 +3474,7 @@ const ( DEVLINK_PORT_FN_ATTR_STATE = 0x2 DEVLINK_PORT_FN_ATTR_OPSTATE = 0x3 DEVLINK_PORT_FN_ATTR_CAPS = 0x4 - DEVLINK_PORT_FUNCTION_ATTR_MAX = 0x5 + DEVLINK_PORT_FUNCTION_ATTR_MAX = 0x6 ) type FsverityDigest struct { @@ -3975,7 +3976,7 @@ const ( ETHTOOL_A_TSINFO_TX_TYPES = 0x3 ETHTOOL_A_TSINFO_RX_FILTERS = 0x4 ETHTOOL_A_TSINFO_PHC_INDEX = 0x5 - ETHTOOL_A_TSINFO_MAX = 0x5 + ETHTOOL_A_TSINFO_MAX = 0x6 ETHTOOL_A_CABLE_TEST_UNSPEC = 0x0 ETHTOOL_A_CABLE_TEST_HEADER = 0x1 ETHTOOL_A_CABLE_TEST_MAX = 0x1 diff --git a/vendor/golang.org/x/sys/windows/security_windows.go b/vendor/golang.org/x/sys/windows/security_windows.go index 97651b5bd04..b6e1ab76f82 100644 --- a/vendor/golang.org/x/sys/windows/security_windows.go +++ b/vendor/golang.org/x/sys/windows/security_windows.go @@ -1179,7 +1179,7 @@ type OBJECTS_AND_NAME struct { //sys makeSelfRelativeSD(absoluteSD *SECURITY_DESCRIPTOR, selfRelativeSD *SECURITY_DESCRIPTOR, selfRelativeSDSize *uint32) (err error) = advapi32.MakeSelfRelativeSD //sys setEntriesInAcl(countExplicitEntries uint32, explicitEntries *EXPLICIT_ACCESS, oldACL *ACL, newACL **ACL) (ret error) = advapi32.SetEntriesInAclW -//sys GetAce(acl *ACL, aceIndex uint32, pAce **ACCESS_ALLOWED_ACE) (ret error) = advapi32.GetAce +//sys GetAce(acl *ACL, aceIndex uint32, pAce **ACCESS_ALLOWED_ACE) (err error) = advapi32.GetAce // Control returns the security descriptor control bits. func (sd *SECURITY_DESCRIPTOR) Control() (control SECURITY_DESCRIPTOR_CONTROL, revision uint32, err error) { diff --git a/vendor/golang.org/x/sys/windows/syscall_windows.go b/vendor/golang.org/x/sys/windows/syscall_windows.go index 6525c62f3c2..1fa34fd17c5 100644 --- a/vendor/golang.org/x/sys/windows/syscall_windows.go +++ b/vendor/golang.org/x/sys/windows/syscall_windows.go @@ -17,8 +17,10 @@ import ( "unsafe" ) -type Handle uintptr -type HWND uintptr +type ( + Handle uintptr + HWND uintptr +) const ( InvalidHandle = ^Handle(0) @@ -211,6 +213,10 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) (handle Handle, err error) //sys ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int32) (err error) [failretval<=32] = shell32.ShellExecuteW //sys GetWindowThreadProcessId(hwnd HWND, pid *uint32) (tid uint32, err error) = user32.GetWindowThreadProcessId +//sys LoadKeyboardLayout(name *uint16, flags uint32) (hkl Handle, err error) [failretval==0] = user32.LoadKeyboardLayoutW +//sys UnloadKeyboardLayout(hkl Handle) (err error) = user32.UnloadKeyboardLayout +//sys GetKeyboardLayout(tid uint32) (hkl Handle) = user32.GetKeyboardLayout +//sys ToUnicodeEx(vkey uint32, scancode uint32, keystate *byte, pwszBuff *uint16, cchBuff int32, flags uint32, hkl Handle) (ret int32) = user32.ToUnicodeEx //sys GetShellWindow() (shellWindow HWND) = user32.GetShellWindow //sys MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) [failretval==0] = user32.MessageBoxW //sys ExitWindowsEx(flags uint32, reason uint32) (err error) = user32.ExitWindowsEx @@ -1368,9 +1374,11 @@ func SetsockoptLinger(fd Handle, level, opt int, l *Linger) (err error) { func SetsockoptInet4Addr(fd Handle, level, opt int, value [4]byte) (err error) { return Setsockopt(fd, int32(level), int32(opt), (*byte)(unsafe.Pointer(&value[0])), 4) } + func SetsockoptIPMreq(fd Handle, level, opt int, mreq *IPMreq) (err error) { return Setsockopt(fd, int32(level), int32(opt), (*byte)(unsafe.Pointer(mreq)), int32(unsafe.Sizeof(*mreq))) } + func SetsockoptIPv6Mreq(fd Handle, level, opt int, mreq *IPv6Mreq) (err error) { return syscall.EWINDOWS } diff --git a/vendor/golang.org/x/sys/windows/types_windows.go b/vendor/golang.org/x/sys/windows/types_windows.go index d8cb71db0a6..4d0c15745f8 100644 --- a/vendor/golang.org/x/sys/windows/types_windows.go +++ b/vendor/golang.org/x/sys/windows/types_windows.go @@ -2003,7 +2003,21 @@ const ( MOVEFILE_FAIL_IF_NOT_TRACKABLE = 0x20 ) -const GAA_FLAG_INCLUDE_PREFIX = 0x00000010 +// Flags for GetAdaptersAddresses, see +// https://learn.microsoft.com/en-us/windows/win32/api/iphlpapi/nf-iphlpapi-getadaptersaddresses. +const ( + GAA_FLAG_SKIP_UNICAST = 0x1 + GAA_FLAG_SKIP_ANYCAST = 0x2 + GAA_FLAG_SKIP_MULTICAST = 0x4 + GAA_FLAG_SKIP_DNS_SERVER = 0x8 + GAA_FLAG_INCLUDE_PREFIX = 0x10 + GAA_FLAG_SKIP_FRIENDLY_NAME = 0x20 + GAA_FLAG_INCLUDE_WINS_INFO = 0x40 + GAA_FLAG_INCLUDE_GATEWAYS = 0x80 + GAA_FLAG_INCLUDE_ALL_INTERFACES = 0x100 + GAA_FLAG_INCLUDE_ALL_COMPARTMENTS = 0x200 + GAA_FLAG_INCLUDE_TUNNEL_BINDINGORDER = 0x400 +) const ( IF_TYPE_OTHER = 1 @@ -3404,3 +3418,14 @@ type DCB struct { EvtChar byte wReserved1 uint16 } + +// Keyboard Layout Flags. +// See https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-loadkeyboardlayoutw +const ( + KLF_ACTIVATE = 0x00000001 + KLF_SUBSTITUTE_OK = 0x00000002 + KLF_REORDER = 0x00000008 + KLF_REPLACELANG = 0x00000010 + KLF_NOTELLSHELL = 0x00000080 + KLF_SETFORPROCESS = 0x00000100 +) diff --git a/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/vendor/golang.org/x/sys/windows/zsyscall_windows.go index eba761018aa..9bb979a3e47 100644 --- a/vendor/golang.org/x/sys/windows/zsyscall_windows.go +++ b/vendor/golang.org/x/sys/windows/zsyscall_windows.go @@ -478,12 +478,16 @@ var ( procGetDesktopWindow = moduser32.NewProc("GetDesktopWindow") procGetForegroundWindow = moduser32.NewProc("GetForegroundWindow") procGetGUIThreadInfo = moduser32.NewProc("GetGUIThreadInfo") + procGetKeyboardLayout = moduser32.NewProc("GetKeyboardLayout") procGetShellWindow = moduser32.NewProc("GetShellWindow") procGetWindowThreadProcessId = moduser32.NewProc("GetWindowThreadProcessId") procIsWindow = moduser32.NewProc("IsWindow") procIsWindowUnicode = moduser32.NewProc("IsWindowUnicode") procIsWindowVisible = moduser32.NewProc("IsWindowVisible") + procLoadKeyboardLayoutW = moduser32.NewProc("LoadKeyboardLayoutW") procMessageBoxW = moduser32.NewProc("MessageBoxW") + procToUnicodeEx = moduser32.NewProc("ToUnicodeEx") + procUnloadKeyboardLayout = moduser32.NewProc("UnloadKeyboardLayout") procCreateEnvironmentBlock = moduserenv.NewProc("CreateEnvironmentBlock") procDestroyEnvironmentBlock = moduserenv.NewProc("DestroyEnvironmentBlock") procGetUserProfileDirectoryW = moduserenv.NewProc("GetUserProfileDirectoryW") @@ -789,6 +793,14 @@ func FreeSid(sid *SID) (err error) { return } +func GetAce(acl *ACL, aceIndex uint32, pAce **ACCESS_ALLOWED_ACE) (err error) { + r1, _, e1 := syscall.Syscall(procGetAce.Addr(), 3, uintptr(unsafe.Pointer(acl)), uintptr(aceIndex), uintptr(unsafe.Pointer(pAce))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func GetLengthSid(sid *SID) (len uint32) { r0, _, _ := syscall.Syscall(procGetLengthSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) len = uint32(r0) @@ -1225,14 +1237,6 @@ func setEntriesInAcl(countExplicitEntries uint32, explicitEntries *EXPLICIT_ACCE return } -func GetAce(acl *ACL, aceIndex uint32, pAce **ACCESS_ALLOWED_ACE) (ret error) { - r0, _, _ := syscall.Syscall(procGetAce.Addr(), 3, uintptr(unsafe.Pointer(acl)), uintptr(aceIndex), uintptr(unsafe.Pointer(pAce))) - if r0 == 0 { - ret = GetLastError() - } - return -} - func SetKernelObjectSecurity(handle Handle, securityInformation SECURITY_INFORMATION, securityDescriptor *SECURITY_DESCRIPTOR) (err error) { r1, _, e1 := syscall.Syscall(procSetKernelObjectSecurity.Addr(), 3, uintptr(handle), uintptr(securityInformation), uintptr(unsafe.Pointer(securityDescriptor))) if r1 == 0 { @@ -4082,6 +4086,12 @@ func GetGUIThreadInfo(thread uint32, info *GUIThreadInfo) (err error) { return } +func GetKeyboardLayout(tid uint32) (hkl Handle) { + r0, _, _ := syscall.Syscall(procGetKeyboardLayout.Addr(), 1, uintptr(tid), 0, 0) + hkl = Handle(r0) + return +} + func GetShellWindow() (shellWindow HWND) { r0, _, _ := syscall.Syscall(procGetShellWindow.Addr(), 0, 0, 0, 0) shellWindow = HWND(r0) @@ -4115,6 +4125,15 @@ func IsWindowVisible(hwnd HWND) (isVisible bool) { return } +func LoadKeyboardLayout(name *uint16, flags uint32) (hkl Handle, err error) { + r0, _, e1 := syscall.Syscall(procLoadKeyboardLayoutW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(flags), 0) + hkl = Handle(r0) + if hkl == 0 { + err = errnoErr(e1) + } + return +} + func MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) { r0, _, e1 := syscall.Syscall6(procMessageBoxW.Addr(), 4, uintptr(hwnd), uintptr(unsafe.Pointer(text)), uintptr(unsafe.Pointer(caption)), uintptr(boxtype), 0, 0) ret = int32(r0) @@ -4124,6 +4143,20 @@ func MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret i return } +func ToUnicodeEx(vkey uint32, scancode uint32, keystate *byte, pwszBuff *uint16, cchBuff int32, flags uint32, hkl Handle) (ret int32) { + r0, _, _ := syscall.Syscall9(procToUnicodeEx.Addr(), 7, uintptr(vkey), uintptr(scancode), uintptr(unsafe.Pointer(keystate)), uintptr(unsafe.Pointer(pwszBuff)), uintptr(cchBuff), uintptr(flags), uintptr(hkl), 0, 0) + ret = int32(r0) + return +} + +func UnloadKeyboardLayout(hkl Handle) (err error) { + r1, _, e1 := syscall.Syscall(procUnloadKeyboardLayout.Addr(), 1, uintptr(hkl), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) (err error) { var _p0 uint32 if inheritExisting { diff --git a/vendor/golang.org/x/term/LICENSE b/vendor/golang.org/x/term/LICENSE index 6a66aea5eaf..2a7cf70da6e 100644 --- a/vendor/golang.org/x/term/LICENSE +++ b/vendor/golang.org/x/term/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/golang.org/x/text/LICENSE b/vendor/golang.org/x/text/LICENSE index 6a66aea5eaf..2a7cf70da6e 100644 --- a/vendor/golang.org/x/text/LICENSE +++ b/vendor/golang.org/x/text/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/modules.txt b/vendor/modules.txt index b0f54a0bf47..3b263ff12af 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -434,7 +434,7 @@ go.opentelemetry.io/proto/otlp/trace/v1 ## explicit; go 1.20 go.uber.org/goleak go.uber.org/goleak/internal/stack -# golang.org/x/crypto v0.25.0 +# golang.org/x/crypto v0.26.0 ## explicit; go 1.20 golang.org/x/crypto/md4 golang.org/x/crypto/ocsp @@ -455,19 +455,19 @@ golang.org/x/net/internal/socks golang.org/x/net/internal/timeseries golang.org/x/net/proxy golang.org/x/net/trace -# golang.org/x/sync v0.7.0 +# golang.org/x/sync v0.8.0 ## explicit; go 1.18 golang.org/x/sync/semaphore -# golang.org/x/sys v0.22.0 +# golang.org/x/sys v0.23.0 ## explicit; go 1.18 golang.org/x/sys/plan9 golang.org/x/sys/unix golang.org/x/sys/windows golang.org/x/sys/windows/registry -# golang.org/x/term v0.22.0 +# golang.org/x/term v0.23.0 ## explicit; go 1.18 golang.org/x/term -# golang.org/x/text v0.16.0 +# golang.org/x/text v0.17.0 ## explicit; go 1.18 golang.org/x/text/cases golang.org/x/text/collate From 93b82a41a4f175a25979c2681a7115adb8b84b50 Mon Sep 17 00:00:00 2001 From: Oleg Bespalov Date: Wed, 21 Aug 2024 09:00:01 +0200 Subject: [PATCH 06/12] Upgrades golang.org/x/crypto/x509roots/fallback --- go.mod | 2 +- go.sum | 4 ++-- vendor/golang.org/x/crypto/x509roots/fallback/LICENSE | 4 ++-- vendor/modules.txt | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 8f25d7373bb..797e42bbec4 100644 --- a/go.mod +++ b/go.mod @@ -47,7 +47,7 @@ require ( go.opentelemetry.io/otel/trace v1.24.0 go.uber.org/goleak v1.3.0 golang.org/x/crypto v0.26.0 - golang.org/x/crypto/x509roots/fallback v0.0.0-20240709155400-d66d9c31b4ae + golang.org/x/crypto/x509roots/fallback v0.0.0-20240806160748-b2d3a6a4b4d3 golang.org/x/net v0.27.0 golang.org/x/term v0.23.0 golang.org/x/time v0.5.0 diff --git a/go.sum b/go.sum index 7f6152e5fe7..c540f104590 100644 --- a/go.sum +++ b/go.sum @@ -226,8 +226,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= -golang.org/x/crypto/x509roots/fallback v0.0.0-20240709155400-d66d9c31b4ae h1:3Lr8+tydLa3EM5BMsp0/++1Pca9P3T3lnTTj6z5BqOc= -golang.org/x/crypto/x509roots/fallback v0.0.0-20240709155400-d66d9c31b4ae/go.mod h1:kNa9WdvYnzFwC79zRpLRMJbdEFlhyM5RPFBBZp/wWH8= +golang.org/x/crypto/x509roots/fallback v0.0.0-20240806160748-b2d3a6a4b4d3 h1:oWb21rU9Q9XrRwXLB7jHc1rbp6EiiimZZv5MLxpu4T0= +golang.org/x/crypto/x509roots/fallback v0.0.0-20240806160748-b2d3a6a4b4d3/go.mod h1:kNa9WdvYnzFwC79zRpLRMJbdEFlhyM5RPFBBZp/wWH8= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= diff --git a/vendor/golang.org/x/crypto/x509roots/fallback/LICENSE b/vendor/golang.org/x/crypto/x509roots/fallback/LICENSE index 6a66aea5eaf..2a7cf70da6e 100644 --- a/vendor/golang.org/x/crypto/x509roots/fallback/LICENSE +++ b/vendor/golang.org/x/crypto/x509roots/fallback/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/modules.txt b/vendor/modules.txt index 3b263ff12af..f5ee3395e2a 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -439,7 +439,7 @@ go.uber.org/goleak/internal/stack golang.org/x/crypto/md4 golang.org/x/crypto/ocsp golang.org/x/crypto/ripemd160 -# golang.org/x/crypto/x509roots/fallback v0.0.0-20240709155400-d66d9c31b4ae +# golang.org/x/crypto/x509roots/fallback v0.0.0-20240806160748-b2d3a6a4b4d3 ## explicit; go 1.20 golang.org/x/crypto/x509roots/fallback # golang.org/x/net v0.27.0 From a4108fb7955a077956f47b37d6f80712d8b9e997 Mon Sep 17 00:00:00 2001 From: Oleg Bespalov Date: Wed, 21 Aug 2024 09:01:16 +0200 Subject: [PATCH 07/12] Upgrades golang.org/x/net v0.27.0 => v0.28.0 --- go.mod | 2 +- go.sum | 4 ++-- vendor/golang.org/x/net/LICENSE | 4 ++-- vendor/modules.txt | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 797e42bbec4..03bc9d95d82 100644 --- a/go.mod +++ b/go.mod @@ -48,7 +48,7 @@ require ( go.uber.org/goleak v1.3.0 golang.org/x/crypto v0.26.0 golang.org/x/crypto/x509roots/fallback v0.0.0-20240806160748-b2d3a6a4b4d3 - golang.org/x/net v0.27.0 + golang.org/x/net v0.28.0 golang.org/x/term v0.23.0 golang.org/x/time v0.5.0 google.golang.org/grpc v1.64.1 diff --git a/go.sum b/go.sum index c540f104590..ea6db0c22cd 100644 --- a/go.sum +++ b/go.sum @@ -250,8 +250,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/vendor/golang.org/x/net/LICENSE b/vendor/golang.org/x/net/LICENSE index 6a66aea5eaf..2a7cf70da6e 100644 --- a/vendor/golang.org/x/net/LICENSE +++ b/vendor/golang.org/x/net/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/modules.txt b/vendor/modules.txt index f5ee3395e2a..98014ce4e8d 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -442,7 +442,7 @@ golang.org/x/crypto/ripemd160 # golang.org/x/crypto/x509roots/fallback v0.0.0-20240806160748-b2d3a6a4b4d3 ## explicit; go 1.20 golang.org/x/crypto/x509roots/fallback -# golang.org/x/net v0.27.0 +# golang.org/x/net v0.28.0 ## explicit; go 1.18 golang.org/x/net/context golang.org/x/net/html From c212bd277aeedbf8395b917df11bd9be4da490a4 Mon Sep 17 00:00:00 2001 From: Oleg Bespalov Date: Wed, 21 Aug 2024 09:02:26 +0200 Subject: [PATCH 08/12] Upgrades golang.org/x/time v0.5.0 => v0.6.0 --- go.mod | 2 +- go.sum | 4 ++-- vendor/golang.org/x/time/LICENSE | 4 ++-- vendor/modules.txt | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 03bc9d95d82..50b03886e6f 100644 --- a/go.mod +++ b/go.mod @@ -50,7 +50,7 @@ require ( golang.org/x/crypto/x509roots/fallback v0.0.0-20240806160748-b2d3a6a4b4d3 golang.org/x/net v0.28.0 golang.org/x/term v0.23.0 - golang.org/x/time v0.5.0 + golang.org/x/time v0.6.0 google.golang.org/grpc v1.64.1 google.golang.org/protobuf v1.34.2 gopkg.in/guregu/null.v3 v3.3.0 diff --git a/go.sum b/go.sum index ea6db0c22cd..a040c7f4136 100644 --- a/go.sum +++ b/go.sum @@ -295,8 +295,8 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= -golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= +golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= diff --git a/vendor/golang.org/x/time/LICENSE b/vendor/golang.org/x/time/LICENSE index 6a66aea5eaf..2a7cf70da6e 100644 --- a/vendor/golang.org/x/time/LICENSE +++ b/vendor/golang.org/x/time/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/modules.txt b/vendor/modules.txt index 98014ce4e8d..5ddb8297f03 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -482,7 +482,7 @@ golang.org/x/text/transform golang.org/x/text/unicode/bidi golang.org/x/text/unicode/norm golang.org/x/text/unicode/rangetable -# golang.org/x/time v0.5.0 +# golang.org/x/time v0.6.0 ## explicit; go 1.18 golang.org/x/time/rate # google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 From 632c0c837099ca32524e8ef3212dfb55ec8b62a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Crevon?= Date: Wed, 21 Aug 2024 13:09:37 +0200 Subject: [PATCH 09/12] Fix cloud command not listed in k6 command's help text (#3901) * Fix `cloud` command not listed in k6 command's help text When implementing the new cloud command structure, we marked the k6 cloud command as deprecated by setting the cobra.Cmd Deprecated option. By doing so, Cobra took over itself to hide the command all in all from the help text's output, and users couldn't see the cloud command as part of the "Available Commands". This commit removes the Cobra.Cmd Deprecated option usage, and ports the message to the Long version of the help text. This commit also rephrases the message to be more accurate. Considering the cloud command itself is not deprecated, but rather its existing behavior, we have mentioned the original behavior consisting in taking a test resource as input is deprecated, specifically. * Add a root command test asserting the expected commands are available This commit adds a test asserting the root command help text lists the expected commands as available. --- cmd/cloud.go | 13 ++++--- cmd/root_test.go | 90 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+), 7 deletions(-) create mode 100644 cmd/root_test.go diff --git a/cmd/cloud.go b/cmd/cloud.go index 9f529bd7064..bfb79015563 100644 --- a/cmd/cloud.go +++ b/cmd/cloud.go @@ -366,16 +366,15 @@ func getCmdCloud(gs *state.GlobalState) *cobra.Command { cloudCmd := &cobra.Command{ Use: "cloud", Short: "Run a test on the cloud", - Long: `Run a test in the Grafana Cloud k6. + Long: `The original behavior of the "k6 cloud" command described below is deprecated. +In future versions, the "cloud" command will only display a help text and will no longer run tests +in Grafana Cloud k6. To continue running tests in the cloud, please transition to using the "k6 cloud run" command. + +Run a test in the Grafana Cloud k6. This will archive test script(s), including all necessary resources, and execute the test in the Grafana Cloud k6 service. Be sure to run the "k6 cloud login" command prior to authenticate with Grafana Cloud k6.`, - Args: exactCloudArgs(), - Deprecated: `the k6 team is in the process of modifying and deprecating the "k6 cloud" command behavior. -In the future, the "cloud" command will only display a help text, instead of running tests in the Grafana Cloud k6. - -To run tests in the cloud, users are now invited to migrate to the "k6 cloud run" command instead. -`, + Args: exactCloudArgs(), PreRunE: c.preRun, RunE: c.run, Example: exampleText, diff --git a/cmd/root_test.go b/cmd/root_test.go new file mode 100644 index 00000000000..44e52790d41 --- /dev/null +++ b/cmd/root_test.go @@ -0,0 +1,90 @@ +package cmd + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "go.k6.io/k6/cmd/tests" + "go.k6.io/k6/errext/exitcodes" +) + +func TestRootCommandHelpDisplayCommands(t *testing.T) { + t.Parallel() + + testCases := []struct { + name string + extraArgs []string + wantExitCode exitcodes.ExitCode + wantStdoutContains string + wantStdoutNotContains string + }{ + { + name: "should have archive command", + wantStdoutContains: " archive Create an archive", + }, + { + name: "should have cloud command", + wantStdoutContains: " cloud Run a test on the cloud", + }, + { + name: "should have completion command", + wantStdoutContains: " completion Generate the autocompletion script for the specified shell", + }, + { + name: "should have help command", + wantStdoutContains: " help Help about any command", + }, + { + name: "should have inspect command", + wantStdoutContains: " inspect Inspect a script or archive", + }, + { + name: "should have new command", + wantStdoutContains: " new Create and initialize a new k6 script", + }, + { + name: "should have pause command", + wantStdoutContains: " pause Pause a running test", + }, + { + name: "should have resume command", + wantStdoutContains: " resume Resume a paused test", + }, + { + name: "should have run command", + wantStdoutContains: " run Start a test", + }, + { + name: "should have scale command", + wantStdoutContains: " scale Scale a running test", + }, + { + name: "should have stats command", + wantStdoutContains: " stats Show test metrics", + }, + { + name: "should have status command", + wantStdoutContains: " status Show test status", + }, + { + name: "should have version command", + wantStdoutContains: " version Show application version", + }, + } + + for _, tc := range testCases { + tc := tc + + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + + ts := tests.NewGlobalTestState(t) + ts.CmdArgs = []string{"k6", "help"} + newRootCommand(ts.GlobalState).execute() + + if tc.wantStdoutContains != "" { + assert.Contains(t, ts.Stdout.String(), tc.wantStdoutContains) + } + }) + } +} From 55eb8bca07286ccf4f14e417e07de491f5912acc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20L=C3=B3pez=20de=20la=20Franca=20Beltran?= <5459617+joanlopez@users.noreply.github.com> Date: Thu, 22 Aug 2024 09:55:03 +0200 Subject: [PATCH 10/12] Report ThresholdsHaveFailed on Cloud runs (#3876) --- cmd/cloud.go | 12 +++++++++--- cmd/tests/cmd_cloud_test.go | 29 +++++++++++++++++++++++++---- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/cmd/cloud.go b/cmd/cloud.go index bfb79015563..cd6047355b0 100644 --- a/cmd/cloud.go +++ b/cmd/cloud.go @@ -14,6 +14,7 @@ import ( "github.com/fatih/color" "go.k6.io/k6/cloudapi" + "go.k6.io/k6/cmd/state" "go.k6.io/k6/errext" "go.k6.io/k6/errext/exitcodes" "go.k6.io/k6/lib" @@ -22,8 +23,6 @@ import ( "github.com/spf13/cobra" "github.com/spf13/pflag" - - "go.k6.io/k6/cmd/state" ) // cmdCloud handles the `k6 cloud` sub-command @@ -313,9 +312,16 @@ func (c *cmdCloud) run(cmd *cobra.Command, args []string) error { logger.WithField("run_status", testProgress.RunStatusText).Debug("Test finished") } + //nolint:stylecheck,golint if testProgress.ResultStatus == cloudapi.ResultStatusFailed { + // Although by looking at [ResultStatus] and [RunStatus] isn't self-explanatory, + // the scenario when the test run has finished, but it failed is an exceptional case for those situations + // when thresholds have been crossed (failed). So, we report this situation as such. + if testProgress.RunStatus == cloudapi.RunStatusFinished { + return errext.WithExitCodeIfNone(errors.New("Thresholds have been crossed"), exitcodes.ThresholdsHaveFailed) + } + // TODO: use different exit codes for failed thresholds vs failed test (e.g. aborted by system/limit) - //nolint:stylecheck,golint return errext.WithExitCodeIfNone(errors.New("The test has failed"), exitcodes.CloudTestRunFailed) } diff --git a/cmd/tests/cmd_cloud_test.go b/cmd/tests/cmd_cloud_test.go index 838cb60a461..45c1dd499cb 100644 --- a/cmd/tests/cmd_cloud_test.go +++ b/cmd/tests/cmd_cloud_test.go @@ -10,14 +10,14 @@ import ( "path/filepath" "testing" - "go.k6.io/k6/lib/testutils" - + "go.k6.io/k6/cloudapi" "go.k6.io/k6/cmd" + "go.k6.io/k6/errext/exitcodes" + "go.k6.io/k6/lib/fsext" + "go.k6.io/k6/lib/testutils" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "go.k6.io/k6/cloudapi" - "go.k6.io/k6/lib/fsext" ) func TestK6Cloud(t *testing.T) { @@ -236,6 +236,27 @@ func runCloudTests(t *testing.T, setupCmd setupCommandFunc) { assert.Contains(t, stdout, `output: https://app.k6.io/runs/123`) assert.Contains(t, stdout, `test status: Finished`) }) + + t.Run("TestCloudThresholdsHaveFailed", func(t *testing.T) { + t.Parallel() + + progressCallback := func() cloudapi.TestProgressResponse { + return cloudapi.TestProgressResponse{ + RunStatusText: "Finished", + RunStatus: cloudapi.RunStatusFinished, + ResultStatus: cloudapi.ResultStatusFailed, + Progress: 1.0, + } + } + ts := getSimpleCloudTestState(t, nil, setupCmd, nil, nil, progressCallback) + ts.ExpectedExitCode = int(exitcodes.ThresholdsHaveFailed) + + cmd.ExecuteWithGlobalState(ts.GlobalState) + + stdout := ts.Stdout.String() + t.Log(stdout) + assert.Contains(t, stdout, `Thresholds have been crossed`) + }) } func cloudTestStartSimple(tb testing.TB, testRunID int) http.Handler { From 93c70831ee67b68738b0c831eb235f4245e837f7 Mon Sep 17 00:00:00 2001 From: Mihail Stoykov <312246+mstoykov@users.noreply.github.com> Date: Thu, 22 Aug 2024 16:28:02 +0300 Subject: [PATCH 11/12] Drop NetTrail - emit iterations metrics in runner instead of dialer (#3908) This is an artifact of both data sent/received and iterations being in the same SampleContainer. So where one was emitted we needed to emit the other. That hasn't been a requirement for a while as evident by the dropping of NetTrail with no breaking in outputs. This also stops emitting `iteration_duration` in not default functions (teardown, setup) as it already does for `iterations`. Closes #1605 Part of #1250 --- execution/scheduler_ext_test.go | 85 ++++++++++++++++++++------- js/runner.go | 35 ++++++++++- js/runner_test.go | 8 +-- lib/netext/dialer.go | 83 +++----------------------- output/cloud/insights/collect_test.go | 4 -- 5 files changed, 108 insertions(+), 107 deletions(-) diff --git a/execution/scheduler_ext_test.go b/execution/scheduler_ext_test.go index e175f3db526..3fbffdf0ed9 100644 --- a/execution/scheduler_ext_test.go +++ b/execution/scheduler_ext_test.go @@ -363,8 +363,8 @@ func TestSchedulerSystemTags(t *testing.T) { expTrailPVUTags := expCommonTrailTags.With("scenario", "per_vu_test") expTrailSITags := expCommonTrailTags.With("scenario", "shared_test") - expNetTrailPVUTags := testRunState.RunTags.With("group", "").With("scenario", "per_vu_test") - expNetTrailSITags := testRunState.RunTags.With("group", "").With("scenario", "shared_test") + expDataSentPVUTags := testRunState.RunTags.With("group", "").With("scenario", "per_vu_test") + expDataSentSITags := testRunState.RunTags.With("group", "").With("scenario", "shared_test") var gotCorrectTags int for { @@ -375,9 +375,13 @@ func TestSchedulerSystemTags(t *testing.T) { if s.Tags == expTrailPVUTags || s.Tags == expTrailSITags { gotCorrectTags++ } - case *netext.NetTrail: - if s.Tags == expNetTrailPVUTags || s.Tags == expNetTrailSITags { - gotCorrectTags++ + default: + for _, sample := range s.GetSamples() { + if sample.Metric.Name == metrics.DataSentName { + if sample.Tags == expDataSentPVUTags || sample.Tags == expDataSentSITags { + gotCorrectTags++ + } + } } } @@ -487,7 +491,7 @@ func TestSchedulerRunCustomTags(t *testing.T) { defer stopEmission() require.NoError(t, execScheduler.Run(ctx, ctx, samples)) }() - var gotTrailTag, gotNetTrailTag bool + var gotTrailTag, gotDataSentTag bool for { select { case sample := <-samples: @@ -497,14 +501,16 @@ func TestSchedulerRunCustomTags(t *testing.T) { gotTrailTag = true } } - if netTrail, ok := sample.(*netext.NetTrail); ok && !gotNetTrailTag { - tags := netTrail.Tags.Map() - if v, ok := tags["customTag"]; ok && v == "value" { - gotNetTrailTag = true + for _, s := range sample.GetSamples() { + if s.Metric.Name == metrics.DataSentName && !gotDataSentTag { + tags := s.Tags.Map() + if v, ok := tags["customTag"]; ok && v == "value" { + gotDataSentTag = true + } } } case <-done: - if !gotTrailTag || !gotNetTrailTag { + if !gotTrailTag || !gotDataSentTag { assert.FailNow(t, "a sample with expected tag wasn't received") } return @@ -692,11 +698,15 @@ func TestSchedulerRunCustomConfigNoCrossover(t *testing.T) { gotSampleTags++ } } - case *netext.NetTrail: - tags := s.Tags.Map() - for _, expTags := range expectedNetTrailTags { - if reflect.DeepEqual(expTags, tags) { - gotSampleTags++ + case metrics.Samples: + for _, sample := range s.GetSamples() { + if sample.Metric.Name == metrics.DataSentName { + tags := sample.Tags.Map() + for _, expTags := range expectedNetTrailTags { + if reflect.DeepEqual(expTags, tags) { + gotSampleTags++ + } + } } } case metrics.ConnectedSamples: @@ -1275,7 +1285,7 @@ func TestRealTimeAndSetupTeardownMetrics(t *testing.T) { Value: expValue, } } - getDummyTrail := func(group string, emitIterations bool, addExpTags ...string) metrics.SampleContainer { + getNetworkSamples := func(group string, addExpTags ...string) metrics.SampleContainer { expTags := []string{"group", group} expTags = append(expTags, addExpTags...) dialer := netext.NewDialer( @@ -1284,25 +1294,56 @@ func TestRealTimeAndSetupTeardownMetrics(t *testing.T) { ) ctm := metrics.TagsAndMeta{Tags: getTags(piState.Registry, expTags...)} - return dialer.GetTrail(time.Now(), time.Now(), true, emitIterations, ctm, piState.BuiltinMetrics) + return dialer.IOSamples(time.Now(), ctm, piState.BuiltinMetrics) + } + + getIterationsSamples := func(group string, addExpTags ...string) metrics.SampleContainer { + expTags := []string{"group", group} + expTags = append(expTags, addExpTags...) + ctm := metrics.TagsAndMeta{Tags: getTags(piState.Registry, expTags...)} + startTime := time.Now() + endTime := time.Now() + + return metrics.Samples([]metrics.Sample{ + { + TimeSeries: metrics.TimeSeries{ + Metric: piState.BuiltinMetrics.IterationDuration, + Tags: ctm.Tags, + }, + Time: endTime, + Metadata: ctm.Metadata, + Value: metrics.D(endTime.Sub(startTime)), + }, + { + TimeSeries: metrics.TimeSeries{ + Metric: piState.BuiltinMetrics.Iterations, + Tags: ctm.Tags, + }, + Time: endTime, + Metadata: ctm.Metadata, + Value: 1, + }, + }) } // Initially give a long time (5s) for the execScheduler to start expectIn(0, 5000, getSample(1, testCounter, "group", "::setup", "place", "setupBeforeSleep")) expectIn(900, 1100, getSample(2, testCounter, "group", "::setup", "place", "setupAfterSleep")) - expectIn(0, 100, getDummyTrail("::setup", false)) + expectIn(0, 100, getNetworkSamples("::setup")) expectIn(0, 100, getSample(5, testCounter, "group", "", "place", "defaultBeforeSleep", "scenario", "default")) expectIn(900, 1100, getSample(6, testCounter, "group", "", "place", "defaultAfterSleep", "scenario", "default")) - expectIn(0, 100, getDummyTrail("", true, "scenario", "default")) + expectIn(0, 100, getNetworkSamples("", "scenario", "default")) + expectIn(0, 100, getIterationsSamples("", "scenario", "default")) expectIn(0, 100, getSample(5, testCounter, "group", "", "place", "defaultBeforeSleep", "scenario", "default")) expectIn(900, 1100, getSample(6, testCounter, "group", "", "place", "defaultAfterSleep", "scenario", "default")) - expectIn(0, 100, getDummyTrail("", true, "scenario", "default")) + expectIn(0, 100, getNetworkSamples("", "scenario", "default")) + expectIn(0, 100, getIterationsSamples("", "scenario", "default")) expectIn(0, 1000, getSample(3, testCounter, "group", "::teardown", "place", "teardownBeforeSleep")) expectIn(900, 1100, getSample(4, testCounter, "group", "::teardown", "place", "teardownAfterSleep")) - expectIn(0, 100, getDummyTrail("::teardown", false)) + expectIn(0, 100, getNetworkSamples("::teardown")) for { select { diff --git a/js/runner.go b/js/runner.go index a3741fc7f86..56dae12768a 100644 --- a/js/runner.go +++ b/js/runner.go @@ -865,15 +865,44 @@ func (u *VU) runFn( u.Transport.CloseIdleConnections() } - u.state.Samples <- u.Dialer.GetTrail( - startTime, endTime, isFullIteration, - isDefault, u.state.Tags.GetCurrentValues(), u.Runner.preInitState.BuiltinMetrics) + builtinMetrics := u.Runner.preInitState.BuiltinMetrics + ctm := u.state.Tags.GetCurrentValues() + u.state.Samples <- u.Dialer.IOSamples(endTime, ctm, builtinMetrics) + + if isFullIteration && isDefault { + u.state.Samples <- iterationSamples(startTime, endTime, ctm, builtinMetrics) + } v = unPromisify(v) return v, isFullIteration, endTime.Sub(startTime), err } +func iterationSamples( + startTime, endTime time.Time, ctm metrics.TagsAndMeta, builtinMetrics *metrics.BuiltinMetrics, +) metrics.Samples { + return metrics.Samples([]metrics.Sample{ + { + TimeSeries: metrics.TimeSeries{ + Metric: builtinMetrics.IterationDuration, + Tags: ctm.Tags, + }, + Time: endTime, + Metadata: ctm.Metadata, + Value: metrics.D(endTime.Sub(startTime)), + }, + { + TimeSeries: metrics.TimeSeries{ + Metric: builtinMetrics.Iterations, + Tags: ctm.Tags, + }, + Time: endTime, + Metadata: ctm.Metadata, + Value: 1, + }, + }) +} + func (u *ActiveVU) incrIteration() { u.iteration++ u.state.Iteration = u.iteration diff --git a/js/runner_test.go b/js/runner_test.go index c0ca818086c..0808547a42f 100644 --- a/js/runner_test.go +++ b/js/runner_test.go @@ -794,10 +794,9 @@ func TestVUIntegrationMetrics(t *testing.T) { require.NoError(t, err) sampleCount := 0 builtinMetrics := r.preInitState.BuiltinMetrics - for i, sampleC := range metrics.GetBufferedSamples(samples) { - for j, s := range sampleC.GetSamples() { - sampleCount++ - switch i + j { + for _, sampleC := range metrics.GetBufferedSamples(samples) { + for _, s := range sampleC.GetSamples() { + switch sampleCount { case 0: assert.Equal(t, 5.0, s.Value) assert.Equal(t, "my_metric", s.Metric.Name) @@ -814,6 +813,7 @@ func TestVUIntegrationMetrics(t *testing.T) { assert.Same(t, builtinMetrics.Iterations, s.Metric, "`iterations` sample is after `iteration_duration`") assert.Equal(t, float64(1), s.Value) } + sampleCount++ } } assert.Equal(t, sampleCount, 5) diff --git a/lib/netext/dialer.go b/lib/netext/dialer.go index e9db26fb2b6..0faaef9fb63 100644 --- a/lib/netext/dialer.go +++ b/lib/netext/dialer.go @@ -69,23 +69,20 @@ func (d *Dialer) DialContext(ctx context.Context, proto, addr string) (net.Conn, return conn, err } -// GetTrail creates a new NetTrail instance with the Dialer -// sent and received data metrics and the supplied times and tags. -// TODO: Refactor this according to -// https://github.com/k6io/k6/pull/1203#discussion_r337938370 -func (d *Dialer) GetTrail( - startTime, endTime time.Time, fullIteration bool, emitIterations bool, ctm metrics.TagsAndMeta, - builtinMetrics *metrics.BuiltinMetrics, -) *NetTrail { +// IOSamples returns samples for data send and received since it last call and zeros out. +// It uses the provided time as the sample time and tags and builtinMetrics to build the samples. +func (d *Dialer) IOSamples( + sampleTime time.Time, ctm metrics.TagsAndMeta, builtinMetrics *metrics.BuiltinMetrics, +) metrics.SampleContainer { bytesWritten := atomic.SwapInt64(&d.BytesWritten, 0) bytesRead := atomic.SwapInt64(&d.BytesRead, 0) - samples := []metrics.Sample{ + return metrics.Samples([]metrics.Sample{ { TimeSeries: metrics.TimeSeries{ Metric: builtinMetrics.DataSent, Tags: ctm.Tags, }, - Time: endTime, + Time: sampleTime, Metadata: ctm.Metadata, Value: float64(bytesWritten), }, @@ -94,43 +91,11 @@ func (d *Dialer) GetTrail( Metric: builtinMetrics.DataReceived, Tags: ctm.Tags, }, - Time: endTime, + Time: sampleTime, Metadata: ctm.Metadata, Value: float64(bytesRead), }, - } - if fullIteration { - samples = append(samples, metrics.Sample{ - TimeSeries: metrics.TimeSeries{ - Metric: builtinMetrics.IterationDuration, - Tags: ctm.Tags, - }, - Time: endTime, - Metadata: ctm.Metadata, - Value: metrics.D(endTime.Sub(startTime)), - }) - if emitIterations { - samples = append(samples, metrics.Sample{ - TimeSeries: metrics.TimeSeries{ - Metric: builtinMetrics.Iterations, - Tags: ctm.Tags, - }, - Time: endTime, - Metadata: ctm.Metadata, - Value: 1, - }) - } - } - - return &NetTrail{ - BytesRead: bytesRead, - BytesWritten: bytesWritten, - FullIteration: fullIteration, - StartTime: startTime, - EndTime: endTime, - Tags: ctm.Tags, - Samples: samples, - } + }) } func (d *Dialer) getDialAddr(addr string) (string, error) { @@ -208,36 +173,6 @@ func (d *Dialer) getConfiguredHost(addr, host, port string) (*types.Host, error) return nil, nil //nolint:nilnil } -// NetTrail contains information about the exchanged data size and length of a -// series of connections from a particular netext.Dialer -type NetTrail struct { - BytesRead int64 - BytesWritten int64 - FullIteration bool - StartTime time.Time - EndTime time.Time - Tags *metrics.TagSet - Samples []metrics.Sample -} - -// Ensure that interfaces are implemented correctly -var _ metrics.ConnectedSampleContainer = &NetTrail{} - -// GetSamples implements the metrics.SampleContainer interface. -func (ntr *NetTrail) GetSamples() []metrics.Sample { - return ntr.Samples -} - -// GetTags implements the metrics.ConnectedSampleContainer interface. -func (ntr *NetTrail) GetTags() *metrics.TagSet { - return ntr.Tags -} - -// GetTime implements the metrics.ConnectedSampleContainer interface. -func (ntr *NetTrail) GetTime() time.Time { - return ntr.EndTime -} - // Conn wraps net.Conn and keeps track of sent and received data size type Conn struct { net.Conn diff --git a/output/cloud/insights/collect_test.go b/output/cloud/insights/collect_test.go index aeca952b9bc..6350dc8eb76 100644 --- a/output/cloud/insights/collect_test.go +++ b/output/cloud/insights/collect_test.go @@ -8,7 +8,6 @@ import ( "github.com/stretchr/testify/require" "go.k6.io/k6/cloudapi/insights" - "go.k6.io/k6/lib/netext" "go.k6.io/k6/lib/netext/httpext" "go.k6.io/k6/metrics" ) @@ -51,9 +50,6 @@ func Test_Collector_CollectRequestMetadatas_FiltersAndStoresHTTPTrailsAsRequestM &httpext.Trail{ // HTTP trail without trace ID should be ignored }, - &netext.NetTrail{ - // Net trail should be ignored - }, &httpext.Trail{ EndTime: time.Unix(20, 0), Duration: time.Second, From 8244d497c339906f4a950bd0c3de68b408b6c4f4 Mon Sep 17 00:00:00 2001 From: ankur22 Date: Fri, 23 Aug 2024 09:45:31 +0100 Subject: [PATCH 12/12] Update to browser v1.7.1 Contains a good fix that would benefit users. --- go.mod | 2 +- go.sum | 4 +- .../browser/element_handle_mapping.go | 5 ++ .../xk6-browser/browser/frame_mapping.go | 5 ++ .../xk6-browser/browser/locator_mapping.go | 5 ++ .../xk6-browser/browser/page_mapping.go | 5 ++ .../grafana/xk6-browser/common/frame.go | 31 ++++++++++ .../xk6-browser/common/frame_session.go | 56 +++++++++++-------- .../grafana/xk6-browser/common/locator.go | 26 +++++++++ .../grafana/xk6-browser/common/page.go | 9 ++- vendor/modules.txt | 2 +- 11 files changed, 123 insertions(+), 27 deletions(-) diff --git a/go.mod b/go.mod index 50b03886e6f..e67e796844c 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/go-sourcemap/sourcemap v2.1.4+incompatible github.com/golang/protobuf v1.5.4 github.com/gorilla/websocket v1.5.1 - github.com/grafana/xk6-browser v1.7.0 + github.com/grafana/xk6-browser v1.7.1 github.com/grafana/xk6-dashboard v0.7.5 github.com/grafana/xk6-output-opentelemetry v0.1.1 github.com/grafana/xk6-output-prometheus-remote v0.4.0 diff --git a/go.sum b/go.sum index a040c7f4136..bf42e1e8a3d 100644 --- a/go.sum +++ b/go.sum @@ -84,8 +84,8 @@ github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/ 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/xk6-browser v1.7.0 h1:Rip0st43EmzV37DFO2Gt7sXO4TTRM4g9wGMwBvVb67c= -github.com/grafana/xk6-browser v1.7.0/go.mod h1:TNngUsbmV3I5NDVklGxjpAR2znEjYEsBtHQirGw8nAI= +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= github.com/grafana/xk6-dashboard v0.7.5/go.mod h1:Y75F8xmgCraKT+pBzFH6me9AyH5PkXD+Bxo1dm6Il/M= github.com/grafana/xk6-output-opentelemetry v0.1.1 h1:kLfzKkL9olhmMO+Kmr7ObhX3LknSAbUbzFaDG6mQVeg= diff --git a/vendor/github.com/grafana/xk6-browser/browser/element_handle_mapping.go b/vendor/github.com/grafana/xk6-browser/browser/element_handle_mapping.go index c598ce739d2..e38a78bef87 100644 --- a/vendor/github.com/grafana/xk6-browser/browser/element_handle_mapping.go +++ b/vendor/github.com/grafana/xk6-browser/browser/element_handle_mapping.go @@ -171,6 +171,11 @@ func mapElementHandle(vu moduleVU, eh *common.ElementHandle) mapping { //nolint: return nil, eh.SelectText(opts) //nolint:wrapcheck }) }, + "setChecked": func(checked bool, opts sobek.Value) *sobek.Promise { + return k6ext.Promise(vu.Context(), func() (any, error) { + return nil, eh.SetChecked(checked, opts) //nolint:wrapcheck + }) + }, "setInputFiles": func(files sobek.Value, opts sobek.Value) *sobek.Promise { return k6ext.Promise(vu.Context(), func() (any, error) { return nil, eh.SetInputFiles(files, opts) //nolint:wrapcheck diff --git a/vendor/github.com/grafana/xk6-browser/browser/frame_mapping.go b/vendor/github.com/grafana/xk6-browser/browser/frame_mapping.go index 4d1aaf3a694..f300070ce2e 100644 --- a/vendor/github.com/grafana/xk6-browser/browser/frame_mapping.go +++ b/vendor/github.com/grafana/xk6-browser/browser/frame_mapping.go @@ -192,6 +192,11 @@ func mapFrame(vu moduleVU, f *common.Frame) mapping { //nolint:gocognit,cyclop return f.SelectOption(selector, values, opts) //nolint:wrapcheck }) }, + "setChecked": func(selector string, checked bool, opts sobek.Value) *sobek.Promise { + return k6ext.Promise(vu.Context(), func() (any, error) { + return nil, f.SetChecked(selector, checked, opts) //nolint:wrapcheck + }) + }, "setContent": func(html string, opts sobek.Value) *sobek.Promise { return k6ext.Promise(vu.Context(), func() (any, error) { return nil, f.SetContent(html, opts) //nolint:wrapcheck diff --git a/vendor/github.com/grafana/xk6-browser/browser/locator_mapping.go b/vendor/github.com/grafana/xk6-browser/browser/locator_mapping.go index 1df2f73ecdf..bc014da1cc9 100644 --- a/vendor/github.com/grafana/xk6-browser/browser/locator_mapping.go +++ b/vendor/github.com/grafana/xk6-browser/browser/locator_mapping.go @@ -36,6 +36,11 @@ func mapLocator(vu moduleVU, lo *common.Locator) mapping { //nolint:funlen return nil, lo.Dblclick(opts) //nolint:wrapcheck }) }, + "setChecked": func(checked bool, opts sobek.Value) *sobek.Promise { + return k6ext.Promise(vu.Context(), func() (any, error) { + return nil, lo.SetChecked(checked, opts) //nolint:wrapcheck + }) + }, "check": func(opts sobek.Value) *sobek.Promise { return k6ext.Promise(vu.Context(), func() (any, error) { return nil, lo.Check(opts) //nolint:wrapcheck diff --git a/vendor/github.com/grafana/xk6-browser/browser/page_mapping.go b/vendor/github.com/grafana/xk6-browser/browser/page_mapping.go index 5fadac70069..7703b8e8d77 100644 --- a/vendor/github.com/grafana/xk6-browser/browser/page_mapping.go +++ b/vendor/github.com/grafana/xk6-browser/browser/page_mapping.go @@ -263,6 +263,11 @@ func mapPage(vu moduleVU, p *common.Page) mapping { //nolint:gocognit,cyclop return p.SelectOption(selector, values, opts) //nolint:wrapcheck }) }, + "setChecked": func(selector string, checked bool, opts sobek.Value) *sobek.Promise { + return k6ext.Promise(vu.Context(), func() (any, error) { + return nil, p.SetChecked(selector, checked, opts) //nolint:wrapcheck + }) + }, "setContent": func(html string, opts sobek.Value) *sobek.Promise { return k6ext.Promise(vu.Context(), func() (any, error) { return nil, p.SetContent(html, opts) //nolint:wrapcheck diff --git a/vendor/github.com/grafana/xk6-browser/common/frame.go b/vendor/github.com/grafana/xk6-browser/common/frame.go index 6e2aa2365d2..8245ca54eac 100644 --- a/vendor/github.com/grafana/xk6-browser/common/frame.go +++ b/vendor/github.com/grafana/xk6-browser/common/frame.go @@ -645,6 +645,37 @@ func (f *Frame) check(selector string, opts *FrameCheckOptions) error { return nil } +func (f *Frame) setChecked(selector string, checked bool, opts *FrameCheckOptions) error { + setChecked := func(apiCtx context.Context, handle *ElementHandle, p *Position) (any, error) { + return nil, handle.setChecked(apiCtx, checked, p) + } + act := f.newPointerAction( + selector, DOMElementStateAttached, opts.Strict, setChecked, &opts.ElementHandleBasePointerOptions, + ) + if _, err := call(f.ctx, act, opts.Timeout); err != nil { + return errorFromDOMError(err) + } + + return nil +} + +// SetChecked sets the checked state of the first element found that matches the selector. +func (f *Frame) SetChecked(selector string, checked bool, opts sobek.Value) error { + f.log.Debugf("Frame:SetChecked", "fid:%s furl:%q sel:%q", f.ID(), f.URL(), selector) + + popts := NewFrameCheckOptions(f.defaultTimeout()) + if err := popts.Parse(f.ctx, opts); err != nil { + return fmt.Errorf("parsing frame set check options: %w", err) + } + if err := f.setChecked(selector, checked, popts); err != nil { + return fmt.Errorf("setting checked %q: %w", selector, err) + } + + applySlowMo(f.ctx) + + return nil +} + // Uncheck the first found element that matches the selector. func (f *Frame) Uncheck(selector string, opts sobek.Value) error { f.log.Debugf("Frame:Uncheck", "fid:%s furl:%q sel:%q", f.ID(), f.URL(), selector) diff --git a/vendor/github.com/grafana/xk6-browser/common/frame_session.go b/vendor/github.com/grafana/xk6-browser/common/frame_session.go index 8fb82115ea3..b7ae24a8a6c 100644 --- a/vendor/github.com/grafana/xk6-browser/common/frame_session.go +++ b/vendor/github.com/grafana/xk6-browser/common/frame_session.go @@ -57,7 +57,9 @@ type FrameSession struct { k6Metrics *k6ext.CustomMetrics targetID target.ID - windowID browser.WindowID + // windowID can be 0 when it is associated to an iframe or frame with no UI. + windowID browser.WindowID + hasUIWindow bool // To understand the concepts of Isolated Worlds, Contexts and Frames and // the relationship betwween them have a look at the following doc: @@ -82,7 +84,7 @@ type FrameSession struct { // //nolint:funlen func NewFrameSession( - ctx context.Context, s session, p *Page, parent *FrameSession, tid target.ID, l *log.Logger, + ctx context.Context, s session, p *Page, parent *FrameSession, tid target.ID, l *log.Logger, hasUIWindow bool, ) (_ *FrameSession, err error) { l.Debugf("NewFrameSession", "sid:%v tid:%v", s.ID(), tid) @@ -103,6 +105,7 @@ func NewFrameSession( vu: k6ext.GetVU(ctx), k6Metrics: k6Metrics, logger: l, + hasUIWindow: hasUIWindow, } if err := cdpruntime.RunIfWaitingForDebugger().Do(cdp.WithExecutor(fs.ctx, fs.session)); err != nil { @@ -120,14 +123,20 @@ func NewFrameSession( return nil, err } - action := browser.GetWindowForTarget().WithTargetID(fs.targetID) - if fs.windowID, _, err = action.Do(cdp.WithExecutor(fs.ctx, fs.session)); err != nil { - l.Debugf( - "NewFrameSession:GetWindowForTarget", - "sid:%v tid:%v err:%v", - s.ID(), tid, err) + // When a frame creates a new FrameSession without UI (e.g. some iframes) we cannot + // retrieve the windowID. Doing so would lead to an error from chromium. For now all + // iframes that are attached are setup with hasUIWindow as false which seems to work + // as expected for iframes with and without UI elements. + if fs.hasUIWindow { + action := browser.GetWindowForTarget().WithTargetID(fs.targetID) + if fs.windowID, _, err = action.Do(cdp.WithExecutor(fs.ctx, fs.session)); err != nil { + l.Debugf( + "NewFrameSession:GetWindowForTarget", + "sid:%v tid:%v err:%v", + s.ID(), tid, err) - return nil, fmt.Errorf("getting browser window ID: %w", err) + return nil, fmt.Errorf("getting browser window ID: %w", err) + } } fs.initEvents() @@ -994,7 +1003,8 @@ func (fs *FrameSession) attachIFrameToTarget(ti *target.Info, sid target.Session fs.ctx, fs.page.browserCtx.getSession(sid), fs.page, fs, ti.TargetID, - fs.logger) + fs.logger, + false) if err != nil { return fmt.Errorf("attaching iframe target ID %v to session ID %v: %w", ti.TargetID, sid, err) @@ -1187,18 +1197,20 @@ func (fs *FrameSession) updateViewport() error { return fmt.Errorf("emulating viewport: %w", err) } - // add an inset to viewport depending on the operating system. - // this won't add an inset if we're running in headless mode. - viewport.calculateInset( - fs.page.browserCtx.browser.browserOpts.Headless, - runtime.GOOS, - ) - action2 := browser.SetWindowBounds(fs.windowID, &browser.Bounds{ - Width: viewport.Width, - Height: viewport.Height, - }) - if err := action2.Do(cdp.WithExecutor(fs.ctx, fs.session)); err != nil { - return fmt.Errorf("setting window bounds: %w", err) + if fs.hasUIWindow { + // add an inset to viewport depending on the operating system. + // this won't add an inset if we're running in headless mode. + viewport.calculateInset( + fs.page.browserCtx.browser.browserOpts.Headless, + runtime.GOOS, + ) + action2 := browser.SetWindowBounds(fs.windowID, &browser.Bounds{ + Width: viewport.Width, + Height: viewport.Height, + }) + if err := action2.Do(cdp.WithExecutor(fs.ctx, fs.session)); err != nil { + return fmt.Errorf("setting window bounds: %w", err) + } } return nil diff --git a/vendor/github.com/grafana/xk6-browser/common/locator.go b/vendor/github.com/grafana/xk6-browser/common/locator.go index 89158ae62e9..3b49f3b5c93 100644 --- a/vendor/github.com/grafana/xk6-browser/common/locator.go +++ b/vendor/github.com/grafana/xk6-browser/common/locator.go @@ -104,6 +104,32 @@ func (l *Locator) dblclick(opts *FrameDblclickOptions) error { return l.frame.dblclick(l.selector, opts) } +// SetChecked sets the checked state of the element using locator's selector +// with strict mode on. +func (l *Locator) SetChecked(checked bool, opts sobek.Value) error { + l.log.Debugf( + "Locator:SetChecked", "fid:%s furl:%q sel:%q checked:%v opts:%+v", + l.frame.ID(), l.frame.URL(), l.selector, checked, opts, + ) + + copts := NewFrameCheckOptions(l.frame.defaultTimeout()) + if err := copts.Parse(l.ctx, opts); err != nil { + return fmt.Errorf("parsing set checked options: %w", err) + } + if err := l.setChecked(checked, copts); err != nil { + return fmt.Errorf("setting %q checked to %v: %w", l.selector, checked, err) + } + + applySlowMo(l.ctx) + + return nil +} + +func (l *Locator) setChecked(checked bool, opts *FrameCheckOptions) error { + opts.Strict = true + return l.frame.setChecked(l.selector, checked, opts) +} + // Check on an element using locator's selector with strict mode on. func (l *Locator) Check(opts sobek.Value) error { l.log.Debugf("Locator:Check", "fid:%s furl:%q sel:%q opts:%+v", l.frame.ID(), l.frame.URL(), l.selector, opts) diff --git a/vendor/github.com/grafana/xk6-browser/common/page.go b/vendor/github.com/grafana/xk6-browser/common/page.go index 35b2f296ed0..1c2b96394c8 100644 --- a/vendor/github.com/grafana/xk6-browser/common/page.go +++ b/vendor/github.com/grafana/xk6-browser/common/page.go @@ -296,7 +296,7 @@ func NewPage( var err error p.frameManager = NewFrameManager(ctx, s, &p, p.timeoutSettings, p.logger) - p.mainFrameSession, err = NewFrameSession(ctx, s, &p, nil, tid, p.logger) + p.mainFrameSession, err = NewFrameSession(ctx, s, &p, nil, tid, p.logger, true) if err != nil { p.logger.Debugf("Page:NewPage:NewFrameSession:return", "sid:%v tid:%v err:%v", p.sessionID(), tid, err) @@ -628,6 +628,13 @@ func (p *Page) BringToFront() error { return nil } +// SetChecked sets the checked state of the element matching the provided selector. +func (p *Page) SetChecked(selector string, checked bool, opts sobek.Value) error { + p.logger.Debugf("Page:SetChecked", "sid:%v selector:%s checked:%t", p.sessionID(), selector, checked) + + return p.MainFrame().SetChecked(selector, checked, opts) +} + // Check checks an element matching the provided selector. func (p *Page) Check(selector string, opts sobek.Value) error { p.logger.Debugf("Page:Check", "sid:%v selector:%s", p.sessionID(), selector) diff --git a/vendor/modules.txt b/vendor/modules.txt index 5ddb8297f03..1305094bd56 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -173,7 +173,7 @@ github.com/grafana/sobek/ftoa/internal/fast github.com/grafana/sobek/parser github.com/grafana/sobek/token github.com/grafana/sobek/unistring -# github.com/grafana/xk6-browser v1.7.0 +# github.com/grafana/xk6-browser v1.7.1 ## explicit; go 1.20 github.com/grafana/xk6-browser/browser github.com/grafana/xk6-browser/chromium