forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
135501: logictest: allow multiple configs for skipif, onlyif r=RaduBerinde a=RaduBerinde This is mostly a convenience for `skipif` but it is a necessity for `onlyif`, which we can't use twice. Epic: none Release note: None Co-authored-by: Radu Berinde <[email protected]>
- Loading branch information
Showing
18 changed files
with
152 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright 2024 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the CockroachDB Software License | ||
// included in the /LICENSE file. | ||
|
||
package logictest | ||
|
||
import ( | ||
"fmt" | ||
"strconv" | ||
"strings" | ||
) | ||
|
||
// extractGithubIssue parses directive fields of the form: | ||
// | ||
// [#ISSUE] [args...] | ||
// | ||
// If the first field is a number prefixed with #, it will be interpreted as | ||
// a github issue and the rest of the fiels are returned. Otherwise, returns -1 | ||
// and the given fields. | ||
func extractGithubIssue(fields []string) (githubIssueID int, args []string) { | ||
if len(fields) < 1 { | ||
return -1, nil | ||
} | ||
if numStr, ok := strings.CutPrefix(fields[0], "#"); ok { | ||
if num, err := strconv.ParseUint(numStr, 10, 32); err == nil { | ||
return int(num), fields[1:] | ||
} | ||
} | ||
return -1, fields | ||
} | ||
|
||
func githubIssueStr(githubIssueID int) string { | ||
if githubIssueID <= 0 { | ||
return "no issue given" | ||
} | ||
return fmt.Sprintf("#%d", githubIssueID) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.