Skip to content

Commit e1d7bf9

Browse files
committed
driver: s/--rngstate/--rng-state/ for consistency.
1 parent 7cde61a commit e1d7bf9

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

README.org

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ The following options are currently supported:
7676
| =--dry-run= | print queries instead of executing them |
7777
| =--max-queries=long= | terminate after generating this many queries |
7878
| =--dump-all-graphs= | dump generated ASTs for debugging |
79-
| =--rngstate=string= | deserialize dumped rng state |
79+
| =--rng-state=string= | deserialize dumped rng state |
8080

8181
Sample output:
8282

sqlsmith.cc

+7-6
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ int main(int argc, char *argv[])
5858
cerr << PACKAGE_NAME " " GITREV << endl;
5959

6060
map<string,string> options;
61-
regex optregex("--(help|log-to|verbose|target|sqlite|version|dump-all-graphs|seed|dry-run|max-queries|rngstate|exclude-catalog)(?:=((?:.|\n)*))?");
61+
regex optregex("--(help|log-to|verbose|target|sqlite|version|dump-all-graphs|seed|dry-run|max-queries|rng-state|exclude-catalog)(?:=((?:.|\n)*))?");
6262

6363
for(char **opt = argv+1 ;opt < argv+argc; opt++) {
6464
smatch match;
@@ -83,7 +83,7 @@ int main(int argc, char *argv[])
8383
" --dry-run print queries instead of executing them" << endl <<
8484
" --exclude-catalog don't generate queries using catalog relations" << endl <<
8585
" --max-queries=long terminate after generating this many queries" << endl <<
86-
" --rngstate=string deserialize dumped rng state" << endl <<
86+
" --rng-state=string deserialize dumped rng state" << endl <<
8787
" --verbose emit progress output" << endl <<
8888
" --version print version information and exit" << endl <<
8989
" --help print available command line options and exit" << endl;
@@ -110,8 +110,8 @@ int main(int argc, char *argv[])
110110
long queries_generated = 0;
111111
schema->fill_scope(scope);
112112

113-
if (options.count("rngstate")) {
114-
istringstream(options["rngstate"]) >> smith::rng;
113+
if (options.count("rng-state")) {
114+
istringstream(options["rng-state"]) >> smith::rng;
115115
} else {
116116
smith::rng.seed(options.count("seed") ? stoi(options["seed"]) : getpid());
117117
}
@@ -163,10 +163,11 @@ int main(int argc, char *argv[])
163163
else
164164
dut = make_shared<dut_libpq>(options["target"]);
165165

166-
while (1)
166+
while (1) /* Loop to recover connection loss */
167167
{
168168
try {
169-
while (1) {
169+
while (1) { /* Main loop */
170+
170171
if (options.count("max-queries")
171172
&& (++queries_generated > stol(options["max-queries"]))) {
172173
if (global_cerr_logger)

0 commit comments

Comments
 (0)