diff options
| author | Taras Madan <tarasmadan@google.com> | 2024-08-16 12:04:08 +0200 |
|---|---|---|
| committer | Taras Madan <tarasmadan@google.com> | 2024-08-16 11:35:48 +0000 |
| commit | d0becdea21af55ab122b2e8d5d498c6fa9ab3564 (patch) | |
| tree | aea3b8fee86ed3e1410eb375ba813838f5b0c58d /pkg/covermerger | |
| parent | c3a6603be2cc031a8f2fa69e757e04a4ce647080 (diff) | |
tools/syz-cover: filter by source commit
Diffstat (limited to 'pkg/covermerger')
| -rw-r--r-- | pkg/covermerger/bq_csv_reader.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/pkg/covermerger/bq_csv_reader.go b/pkg/covermerger/bq_csv_reader.go index 42a1fd4ec..f429f6f4e 100644 --- a/pkg/covermerger/bq_csv_reader.go +++ b/pkg/covermerger/bq_csv_reader.go @@ -37,7 +37,7 @@ func MakeBQCSVReader() *bqCSVReader { return &bqCSVReader{} } -func (r *bqCSVReader) InitNsRecords(ctx context.Context, ns, filePath string, from, to civil.Date) error { +func (r *bqCSVReader) InitNsRecords(ctx context.Context, ns, filePath, commit string, from, to civil.Date) error { if !isAllowedFilePath(filePath) { return fmt.Errorf("wrong file path '%s'", filePath) } @@ -52,6 +52,10 @@ func (r *bqCSVReader) InitNsRecords(ctx context.Context, ns, filePath string, fr if err := client.EnableStorageReadClient(ctx); err != nil { return fmt.Errorf("failed to client.EnableStorageReadClient: %w", err) } + selectCommit := "" + if commit != "" { + selectCommit = fmt.Sprintf("AND\n\t\t\t\t\tkernel_commit = \"%s\"", commit) + } q := client.Query(fmt.Sprintf(` EXPORT DATA OPTIONS ( @@ -68,11 +72,11 @@ func (r *bqCSVReader) InitNsRecords(ctx context.Context, ns, filePath string, fr TIMESTAMP_TRUNC(timestamp, DAY) >= "%s" AND TIMESTAMP_TRUNC(timestamp, DAY) <= "%s" AND version = 1 AND - starts_with(file_path, "%s") + starts_with(file_path, "%s") %s GROUP BY file_path, kernel_commit, kernel_repo, kernel_branch, sl ORDER BY file_path ); - `, gsURI, ns, from.String(), to.String(), filePath)) + `, gsURI, ns, from.String(), to.String(), filePath, selectCommit)) job, err := q.Run(ctx) if err != nil { return fmt.Errorf("err during bigquery.Run: %w", err) |
