aboutsummaryrefslogtreecommitdiffstats
path: root/syz-cluster/pkg/db
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2025-01-31 12:38:41 +0100
committerAleksandr Nogikh <nogikh@google.com>2025-02-04 14:57:28 +0000
commit2cfec537a35f8e7bcb50a3302d73bb98be70e426 (patch)
tree27f60eebd3368729e00a35b1662662771948d0df /syz-cluster/pkg/db
parent10f46061d0a00f1bfb6c1f0f34509e1656a3bb23 (diff)
syz-cluster: store session test logs
Record the logs from the build and fuzzing steps.
Diffstat (limited to 'syz-cluster/pkg/db')
-rw-r--r--syz-cluster/pkg/db/entities.go1
-rw-r--r--syz-cluster/pkg/db/migrations/1_initialize.up.sql1
-rw-r--r--syz-cluster/pkg/db/session_test_repo.go13
3 files changed, 15 insertions, 0 deletions
diff --git a/syz-cluster/pkg/db/entities.go b/syz-cluster/pkg/db/entities.go
index f0f4e97db..784a96a2e 100644
--- a/syz-cluster/pkg/db/entities.go
+++ b/syz-cluster/pkg/db/entities.go
@@ -82,6 +82,7 @@ type SessionTest struct {
UpdatedAt time.Time `spanner:"UpdatedAt"`
TestName string `spanner:"TestName"`
Result string `spanner:"Result"`
+ LogURI string `spanner:"LogURI"`
}
type Finding struct {
diff --git a/syz-cluster/pkg/db/migrations/1_initialize.up.sql b/syz-cluster/pkg/db/migrations/1_initialize.up.sql
index 22252666f..4612956e7 100644
--- a/syz-cluster/pkg/db/migrations/1_initialize.up.sql
+++ b/syz-cluster/pkg/db/migrations/1_initialize.up.sql
@@ -69,6 +69,7 @@ CREATE TABLE SessionTests (
Result STRING(36) NOT NULL,
BaseBuildID STRING(36),
PatchedBuildID STRING(36),
+ LogURI STRING(256) NOT NULL,
CONSTRAINT FK_SessionResults FOREIGN KEY (SessionID) REFERENCES Sessions (ID),
CONSTRAINT ResultEnum CHECK (Result IN ('passed', 'failed', 'error', 'running')),
CONSTRAINT FK_BaseBuild FOREIGN KEY (BaseBuildID) REFERENCES Builds (ID),
diff --git a/syz-cluster/pkg/db/session_test_repo.go b/syz-cluster/pkg/db/session_test_repo.go
index 4ece8a904..43ada137c 100644
--- a/syz-cluster/pkg/db/session_test_repo.go
+++ b/syz-cluster/pkg/db/session_test_repo.go
@@ -57,6 +57,19 @@ func (repo *SessionTestRepository) InsertOrUpdate(ctx context.Context, test *Ses
return err
}
+func (repo *SessionTestRepository) Get(ctx context.Context, sessionID, testName string) (*SessionTest, error) {
+ stmt := spanner.Statement{
+ SQL: "SELECT * FROM `SessionTests` WHERE `SessionID` = @session AND `TestName` = @name",
+ Params: map[string]interface{}{
+ "session": sessionID,
+ "name": testName,
+ },
+ }
+ iter := repo.client.Single().Query(ctx, stmt)
+ defer iter.Stop()
+ return readOne[SessionTest](iter)
+}
+
type FullSessionTest struct {
*SessionTest
BaseBuild *Build