diff options
| author | Taras Madan <tarasmadan@google.com> | 2024-07-19 16:25:12 +0200 |
|---|---|---|
| committer | Taras Madan <tarasmadan@google.com> | 2024-07-19 15:16:25 +0000 |
| commit | 890ce4f355eb3eb900bde0834a34c7498199e3e4 (patch) | |
| tree | 66fbc8b1a53cd8d8dac1ba17ab42c53bc50c6cc9 | |
| parent | ee4e11c8201e61ce6155059daa9330824f9fad16 (diff) | |
syz-covermerger: factor out db init code
| -rwxr-xr-x | tools/syz-bq.sh | 33 | ||||
| -rw-r--r-- | tools/syz-covermerger/init_db.sh | 37 |
2 files changed, 37 insertions, 33 deletions
diff --git a/tools/syz-bq.sh b/tools/syz-bq.sh index 4bdf0ccd8..491f1a400 100755 --- a/tools/syz-bq.sh +++ b/tools/syz-bq.sh @@ -49,39 +49,6 @@ then exit fi -db="coverage" - -# it also allows to early check gcloud credentials -echo "making sure spanner table 'files' exists" -create_table=$( echo -n ' -CREATE TABLE IF NOT EXISTS - files ( - "session" text, - "filepath" text, - "instrumented" bigint, - "covered" bigint, - PRIMARY KEY - (session, filepath) );') -gcloud spanner databases ddl update $db --instance=syzbot --project=syzkaller \ - --ddl="$create_table" - -echo "making sure spanner table 'merge_history' exists" -create_table=$( echo -n ' -CREATE TABLE IF NOT EXISTS - merge_history ( - "namespace" text, - "repo" text, - "duration" bigint, - "dateto" date, - "session" text, - "time" timestamptz, - "commit" text, - "totalrows" bigint, - PRIMARY KEY - (namespace, repo, duration, dateto) );') -gcloud spanner databases ddl update $db --instance=syzbot --project=syzkaller \ - --ddl="$create_table" - echo "Workdir: $workdir" base_dir="${workdir}repos/linux_kernels" if [ ! -d $base_dir ]; then diff --git a/tools/syz-covermerger/init_db.sh b/tools/syz-covermerger/init_db.sh new file mode 100644 index 000000000..f7e185221 --- /dev/null +++ b/tools/syz-covermerger/init_db.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +# Copyright 2024 syzkaller project authors. All rights reserved. +# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. + +set -e # exit on any problem +set -o pipefail + +db="coverage" +echo "making sure spanner table 'files' exists" +create_table=$( echo -n ' +CREATE TABLE IF NOT EXISTS + files ( + "session" text, + "filepath" text, + "instrumented" bigint, + "covered" bigint, + PRIMARY KEY + (session, filepath) );') +gcloud spanner databases ddl update $db --instance=syzbot --project=syzkaller \ + --ddl="$create_table" + +echo "making sure spanner table 'merge_history' exists" +create_table=$( echo -n ' +CREATE TABLE IF NOT EXISTS + merge_history ( + "namespace" text, + "repo" text, + "duration" bigint, + "dateto" date, + "session" text, + "time" timestamptz, + "commit" text, + "totalrows" bigint, + PRIMARY KEY + (namespace, repo, duration, dateto) );') +gcloud spanner databases ddl update $db --instance=syzbot --project=syzkaller \ + --ddl="$create_table" |
