Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
turbo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open Source Software
turbo
Commits
8320cb39
Commit
8320cb39
authored
2 years ago
by
Jason Hiser
Browse files
Options
Downloads
Patches
Plain Diff
Added SeedList functionality.
parent
d83a1d74
No related branches found
No related tags found
1 merge request
!10
Add seed list
Pipeline
#20210
passed
2 years ago
Stage: build
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
cli/turbo-cli.cpp
+69
-25
69 additions, 25 deletions
cli/turbo-cli.cpp
turbo-rpc/turbo.proto
+12
-1
12 additions, 1 deletion
turbo-rpc/turbo.proto
turbod/turbod.cpp
+35
-0
35 additions, 0 deletions
turbod/turbod.cpp
with
116 additions
and
26 deletions
cli/turbo-cli.cpp
+
69
−
25
View file @
8320cb39
// std c/c++ includes
#include
<iostream>
#include
<fstream>
...
...
@@ -50,7 +48,7 @@ int Usage(int argc, char* argv[], OptionVector_t& upper_opts)
cerr
<<
"todo log delete prep <ver id> Delete the prep logs for a version id"
<<
endl
;
cerr
<<
"todo log delete fuzz <ver id> Delete the fuzzing logs for a version id"
<<
endl
;
cerr
<<
" seed add <boost id> <seed.yaml> Add a seed file to a boost"
<<
endl
;
cerr
<<
"
clc
seed list <boost id> List all seed files for a boost "
<<
endl
;
cerr
<<
"
seed list <boost id> List all seed files for a boost "
<<
endl
;
cerr
<<
" input import-raw-file <input-name> <on-disk-name> <input.yaml> "
<<
endl
;
cerr
<<
" Edit input.yaml to add raw data from a file."
<<
endl
;
cerr
<<
" input extract-raw-file <input filename> <input.yaml> "
<<
endl
;
...
...
@@ -219,32 +217,32 @@ int VersionList(int argc, char *argv[], OptionVector_t& upper_opts)
request
.
set_boost_id
(
atoi
(
argv
[
1
]));
auto
reader
=
move
(
unique_ptr
<
ClientReader
<
VersionInfo_t
>
>
(
backend
->
VersionList
(
&
context
,
request
)));
auto
reader
=
move
(
unique_ptr
<
ClientReader
<
VersionInfo_t
>
>
(
backend
->
VersionList
(
&
context
,
request
)));
cout
<<
"id
\t
"
<<
setw
(
16
)
<<
left
<<
"orig bin sha"
<<
setw
(
16
)
<<
left
<<
"zafl bin sha"
<<
setw
(
25
)
<<
left
<<
"submit time"
<<
setw
(
25
)
<<
left
<<
"processing start time"
<<
setw
(
25
)
<<
left
<<
"processing end time"
<<
"error"
<<
endl
;
while
(
reader
->
Read
(
&
reply
))
{
cout
<<
dec
<<
reply
.
ver_id
()
<<
"
\t
"
<<
setw
(
16
)
<<
left
<<
reply
.
orig_bin_sha
()
<<
setw
(
16
)
<<
left
<<
reply
.
zafl_bin_sha
()
<<
setw
(
25
)
<<
left
<<
reply
.
submit_time
()
<<
setw
(
25
)
<<
left
<<
reply
.
start_time
()
<<
setw
(
25
)
<<
left
<<
reply
.
end_time
()
<<
boolalpha
<<
reply
.
err
()
<<
endl
;
cout
<<
"id
\t
"
<<
setw
(
16
)
<<
left
<<
"orig bin sha"
<<
setw
(
16
)
<<
left
<<
"zafl bin sha"
<<
setw
(
25
)
<<
left
<<
"submit time"
<<
setw
(
25
)
<<
left
<<
"processing start time"
<<
setw
(
25
)
<<
left
<<
"processing end time"
<<
"error"
<<
endl
;
while
(
reader
->
Read
(
&
reply
))
{
cout
<<
dec
<<
reply
.
ver_id
()
<<
"
\t
"
<<
setw
(
16
)
<<
left
<<
reply
.
orig_bin_sha
()
<<
setw
(
16
)
<<
left
<<
reply
.
zafl_bin_sha
()
<<
setw
(
25
)
<<
left
<<
reply
.
submit_time
()
<<
setw
(
25
)
<<
left
<<
reply
.
start_time
()
<<
setw
(
25
)
<<
left
<<
reply
.
end_time
()
<<
boolalpha
<<
reply
.
err
()
<<
endl
;
}
}
const
auto
status
=
reader
->
Finish
();
const
auto
status
=
reader
->
Finish
();
// Act upon its status.
if
(
!
status
.
ok
())
...
...
@@ -920,6 +918,51 @@ int SeedAdd(int argc, char *argv[], OptionVector_t& upper_opts)
}
/*
* List all seeds in a boost.
*/
int
SeedList
(
int
argc
,
char
*
argv
[],
OptionVector_t
&
upper_opts
)
{
if
(
argc
<
2
)
{
cerr
<<
"Error, seed list must specify a boost id"
<<
endl
;
Usage
(
argc
,
argv
,
upper_opts
);
return
1
;
}
if
(
argc
>
2
)
{
cerr
<<
"Error, junk at end of seed list "
<<
endl
;
Usage
(
argc
,
argv
,
upper_opts
);
return
1
;
}
SETUP_CONN
(
SeedListRequest_t
,
SeedInfo_t
,
upper_opts
);
request
.
set_boost_id
(
atoi
(
argv
[
1
]));
auto
reader
=
move
(
unique_ptr
<
ClientReader
<
SeedInfo_t
>
>
(
backend
->
SeedList
(
&
context
,
request
)));
cout
<<
"BID
\t
Seed ID
\t
Input ID"
<<
endl
;
while
(
reader
->
Read
(
&
reply
))
{
cout
<<
dec
<<
(
reply
.
boost_id
())
<<
"
\t
"
<<
(
reply
.
seed_id
())
<<
"
\t
"
<<
(
reply
.
input_id
())
<<
endl
;
}
const
auto
status
=
reader
->
Finish
();
// Act upon its status.
if
(
!
status
.
ok
())
{
print_error
(
status
);
return
1
;
}
cout
<<
"Server returned OK"
<<
endl
;
return
0
;
}
//
// process the boost subcommand
//
...
...
@@ -928,6 +971,7 @@ int Seed(int argc, char *argv[], OptionVector_t& upper_opts)
const
auto
subcommands
=
SubCommandVector_t
{
{
"add"
,
SeedAdd
},
{
"list"
,
SeedList
},
};
return
subcommandDispatch
(
"seed"
,
subcommands
,
argc
,
argv
,
upper_opts
);
...
...
This diff is collapsed.
Click to expand it.
turbo-rpc/turbo.proto
+
12
−
1
View file @
8320cb39
...
...
@@ -29,6 +29,7 @@ service TurboService
rpc
GetZaflLog
(
GetZaflLogRequest_t
)
returns
(
LogFile_t
)
{}
rpc
GetFuzzLog
(
GetFuzzLogRequest_t
)
returns
(
LogFile_t
)
{}
rpc
SeedAdd
(
SeedAddRequest_t
)
returns
(
SeedAddReply_t
)
{}
rpc
SeedList
(
SeedListRequest_t
)
returns
(
stream
SeedInfo_t
)
{}
rpc
InputAdd
(
InputAddRequest_t
)
returns
(
InputAddReply_t
)
{}
rpc
DownloadInputs
(
DownloadInputsRequest_t
)
returns
(
stream
DownloadInputsReply_t
)
{}
rpc
DownloadCrashes
(
DownloadInputsRequest_t
)
returns
(
stream
DownloadInputsReply_t
)
{}
...
...
@@ -114,7 +115,6 @@ message LogFile_t
bytes
log
=
1
;
}
message
SeedAddRequest_t
{
uint32
boost_id
=
1
;
...
...
@@ -127,6 +127,17 @@ message SeedAddReply_t
uint32
input_id
=
2
;
}
message
SeedListRequest_t
{
uint32
boost_id
=
1
;
}
message
SeedInfo_t
{
uint32
boost_id
=
1
;
uint32
seed_id
=
2
;
uint32
input_id
=
3
;
}
message
InputAddRequest_t
{
...
...
This diff is collapsed.
Click to expand it.
turbod/turbod.cpp
+
35
−
0
View file @
8320cb39
...
...
@@ -346,6 +346,41 @@ class TurboServiceImpl final : public TurboService::Service
}
}
Status
SeedList
(
ServerContext
*
context
,
const
SeedListRequest_t
*
request
,
ServerWriter
<
SeedInfo_t
>
*
writer
)
override
final
{
try
{
pqxx
::
connection
conn
{
db_connect_options
.
c_str
()};
pqxx
::
work
txn
(
conn
);
cout
<<
"Requested seed list "
<<
endl
;
conn
.
prepare
(
"seedlist"
,
"select S.seed_id as sid ,S.input_id as iid, I.boost_id as bid from seeds S inner join inputs I on I.boost_id = $1 and S.input_id = I.input_id"
);
const
auto
res_table
=
txn
.
exec_prepared
(
"seedlist"
,
request
->
boost_id
());
if
(
res_table
.
size
()
==
0
)
{
return
Status
(
ABORTED
,
"No boost "
+
to_string
(
request
->
boost_id
())
+
" or no seeds found for boost"
);
}
for
(
const
auto
&
res
:
res_table
)
{
auto
reply
=
SeedInfo_t
();
reply
.
set_boost_id
(
res
[
"bid"
].
as
<
int
>
());
reply
.
set_input_id
(
res
[
"iid"
].
as
<
int
>
());
reply
.
set_seed_id
(
res
[
"sid"
].
as
<
int
>
());
writer
->
Write
(
reply
);
}
return
Status
::
OK
;
}
catch
(
const
std
::
exception
&
e
)
{
return
Status
(
ABORTED
,
e
.
what
());
}
}
Status
InputAdd
(
ServerContext
*
context
,
const
InputAddRequest_t
*
request
,
InputAddReply_t
*
reply
)
override
final
{
try
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment