-
Notifications
You must be signed in to change notification settings - Fork 0
DAOS-16953 tests: fix btree parameter parsing #79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
janekmi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: all files reviewed, 9 unresolved discussions (waiting on @grom72)
a discussion (no related file):
Nice commit message. 👍
src/common/tests/btree.sh line 34 at r1 (raw file):
dyn Run with dynamic root ukey Use integer keys emb Use integer keys and embedded value
Suggestion:
Use embedded valuesrc/common/tests/btree.c line 920 at r1 (raw file):
D_ASSERT(rc == 0); if (rc) fail_msg("Cannot setup pmem: %d\n", rc);
Either-or.
Suggestion:
if (rc) {
fail_msg("Cannot setup pmem: %d\n", rc);
}src/common/tests/btree.c line 926 at r1 (raw file):
D_ASSERT(rc == 0); if (rc) fail_msg("Cannot setup vmem: %d\n", rc);
.
Suggestion:
if (rc) {
fail_msg("Cannot setup vmem: %d\n", rc);
}src/common/tests/btree.c line 938 at r1 (raw file):
/** * Execute test based on the given sequence of steps defined by * the test_state->argc and test_state->argv
It is nice to have a bit of documentation here. But I do not like to put all the technical details in the comment. It makes it hard to maintain.
Suggestion:
* Execute test based on the given sequence of steps.src/common/tests/btree.c line 943 at r1 (raw file):
* otherwise it will be ignored * -m parameter shall be provided before any other short parameters, * otherwise it will be ignored
Kudos for pointing it out.
Code quote:
* -t parameter shall be provided as the first parameter in the sequence,
* otherwise it will be ignored
* -m parameter shall be provided before any other short parameters,
* otherwise it will be ignoredsrc/common/tests/btree.c line 959 at r1 (raw file):
switch (opt) { case 'S': /* General options, not part of the test sequence */
I do not get this bit. Maybe just drop it?
Suggestion:
not part of the test sequencesrc/common/tests/btree.c line 970 at r1 (raw file):
case 'C': if (ik_utx == NULL) ik_btr_init_mem(false, dynamic_flag);
I would prefer to have two switches with optional arguments:
- register class
- with an option to make it a dynamic root
- initialize memory
- with an option to make it PMEM
Two benefits to my proposal would be:
- You would see that registering a class and memory initialization are separate.
- You would no have weird "leaks" between
-mand-Coptions just to initialize the memory on time. The memory would be initialized in one place.
Please consider.
Code quote:
case 't':
D_PRINT("Using dynamic tree order\n");
dynamic_flag = BTR_FEAT_DYNAMIC_ROOT;
break;
case 'm':
ik_btr_init_mem(true, dynamic_flag);
break;
case 'C':
if (ik_utx == NULL)
ik_btr_init_mem(false, dynamic_flag);src/common/tests/btree.c line 1069 at r1 (raw file):
} if (argc != optind) { print_message("Invalid parameters provided.\n");
Suggestion:
print_message("Unknown parameter: %s\n", argv[optind]);src/common/tests/btree.c line 1073 at r1 (raw file):
} if (test_name == NULL) test_name = "Btree testing tool";
You might already noticed I am for having braces no matter what.
Suggestion:
if (test_name == NULL) {
test_name = "Btree testing tool";
}src/common/tests/btree.c line 1082 at r1 (raw file):
daos_debug_fini(); if (ik_utx) rc += utest_utx_destroy(ik_utx);
.
Suggestion:
if (ik_utx) {
rc += utest_utx_destroy(ik_utx);
}6aef5a9 to
871c448
Compare
grom72
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 1 of 2 files reviewed, 9 unresolved discussions (waiting on @janekmi)
src/common/tests/btree.c line 920 at r1 (raw file):
Previously, janekmi (Jan Michalski) wrote…
Either-or.
Done.
src/common/tests/btree.c line 926 at r1 (raw file):
Previously, janekmi (Jan Michalski) wrote…
.
Done.
src/common/tests/btree.c line 938 at r1 (raw file):
Previously, janekmi (Jan Michalski) wrote…
It is nice to have a bit of documentation here. But I do not like to put all the technical details in the comment. It makes it hard to maintain.
Done.
src/common/tests/btree.c line 959 at r1 (raw file):
Previously, janekmi (Jan Michalski) wrote…
I do not get this bit. Maybe just drop it?
Done.
src/common/tests/btree.c line 1073 at r1 (raw file):
Previously, janekmi (Jan Michalski) wrote…
You might already noticed I am for having braces no matter what.
Done.
src/common/tests/btree.c line 1082 at r1 (raw file):
Previously, janekmi (Jan Michalski) wrote…
.
Done.
src/common/tests/btree.sh line 34 at r1 (raw file):
dyn Run with dynamic root ukey Use integer keys emb Use integer keys and embedded value
emb also includes ukey option
src/common/tests/btree.c line 1069 at r1 (raw file):
} if (argc != optind) { print_message("Invalid parameters provided.\n");
Done.
871c448 to
44c1ab5
Compare
44c1ab5 to
6eed72b
Compare
grom72
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 8 of 9 files at r3.
Reviewable status: 8 of 9 files reviewed, 9 unresolved discussions (waiting on @janekmi)
src/common/tests/btree.c line 970 at r1 (raw file):
Previously, janekmi (Jan Michalski) wrote…
I would prefer to have two switches with optional arguments:
- register class
- with an option to make it a dynamic root
- initialize memory
- with an option to make it PMEM
Two benefits to my proposal would be:
- You would see that registering a class and memory initialization are separate.
- You would no have weird "leaks" between
-mand-Coptions just to initialize the memory on time. The memory would be initialized in one place.Please consider.
Done.
src/common/tests/btree.sh line 34 at r1 (raw file):
Previously, grom72 (Tomasz Gromadzki) wrote…
embalso includesukeyoption
Done
grom72
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 9 files at r3, all commit messages.
Reviewable status: all files reviewed, 9 unresolved discussions (waiting on @janekmi)
janekmi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 9 of 9 files at r3, all commit messages.
Reviewable status: all files reviewed, 12 unresolved discussions (waiting on @grom72)
src/common/tests/btree.c line 1073 at r1 (raw file):
Previously, grom72 (Tomasz Gromadzki) wrote…
Done.
Nope.
src/common/tests/btree.sh line 34 at r1 (raw file):
Previously, grom72 (Tomasz Gromadzki) wrote…
Done
Please do it in the first commit.
src/common/tests/btree.c line 892 at r3 (raw file):
{"start-test", required_argument, NULL, 'S'}, {"reg_class", optional_argument, NULL, 'R'}, {"reg_memory", optional_argument, NULL, 'M'},
Suggestion:
{"reg-class", optional_argument, NULL, 'R'},
{"reg-memory", optional_argument, NULL, 'M'},src/common/tests/btree.c line 916 at r3 (raw file):
int rc = 0; if (pmem_flag && *pmem_flag != 'p') { fail_msg("Invalid value of -M parameter: %c\n", *pmem_flag);
IMHO it is a string not a character.
Suggestion:
fail_msg("Invalid value of -M parameter: %s\n", pmem_flag);src/common/tests/btree.c line 940 at r3 (raw file):
{ if (dynamic_flag && *dynamic_flag != 'd') { fail_msg("Invalid value of -R parameter: %c\n", *dynamic_flag);
.
Suggestion:
fail_msg("Invalid value of -R parameter: %s\n", dynamic_flag);src/common/tests/btree.c line 1073 at r3 (raw file):
/* unknown parameter */ break; }
It doesn't look right. Are you sure you need this despite the + at the beginning of the options string?
And how it was not necessary in the previous commit?
Code quote:
if (opt == '?') {
/* unknown parameter */
break;
}src/common/tests/btree.sh line 114 at r3 (raw file):
eval "${VCMD}" "$BTR" \ --start-test "'btree functional ${test_conf_pre} ${test_conf} iterate=${IDIR}'" \ -R"${DYN}" -M"${PMEM}" -C "${UINT}${IPL}o:$ORDER" \
It would be nice to either separate value from option with a space for all the options or none of them.
Code quote:
-R"${DYN}" -M"${PMEM}" -C "${UINT}${IPL}o:$ORDER" \src/common/tests/btree.sh line 134 at r3 (raw file):
eval "${VCMD}" "$BTR" \ --start-test "'btree batch operations ${test_conf_pre} ${test_conf}'" \ -R"${DYN}" -M"${PMEM}" -C "${UINT}${IPL}o:$ORDER" \
.
src/common/tests/btree.sh line 143 at r3 (raw file):
eval "${VCMD}" "$BTR" \ --start-test "'btree drain ${test_conf_pre} ${test_conf}'" \ -R"${DYN}" -M"${PMEM}" -C "${UINT}${IPL}o:$ORDER" \
.
src/common/tests/btree.sh line 150 at r3 (raw file):
eval "${VCMD}" "$BTR" \ --start-test "'btree performance ${test_conf_pre} ${test_conf}'" \ -R"${DYN}" -M"${PMEM}" -C "${UINT}${IPL}o:$ORDER" \
.
src/common/tests/btree.c line 1061 at r2 (raw file):
if (argc != optind) { print_message("Unknown parameter: %s\n", argv[optind]); return -1;
Suggestion:
fail_msg("Unknown parameter: %s\n", argv[optind]);src/common/tests/btree.c line 1078 at r2 (raw file):
if (rc != 0) { print_message("daos_debug_init() failed: %d\n", rc); return rc;
Suggestion:
fail_msg("daos_debug_init() failed: %d\n", rc);6eed72b to
69001f2
Compare
grom72
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 2 files at r1, 9 of 9 files at r4, all commit messages.
Reviewable status: all files reviewed, 12 unresolved discussions (waiting on @janekmi)
src/common/tests/btree.c line 1073 at r1 (raw file):
Previously, janekmi (Jan Michalski) wrote…
Nope.
Done.
src/common/tests/btree.c line 916 at r3 (raw file):
Previously, janekmi (Jan Michalski) wrote…
IMHO it is a string not a character.
We expect character
src/common/tests/btree.c line 940 at r3 (raw file):
Previously, janekmi (Jan Michalski) wrote…
.
.
src/common/tests/btree.c line 1073 at r3 (raw file):
Previously, janekmi (Jan Michalski) wrote…
It doesn't look right. Are you sure you need this despite the
+at the beginning of the options string?
And how it was not necessary in the previous commit?
+ detects 'ma kotaas invalid parameter string but ignores-t`- it is not an error it is unknown parameter (but with proper syntax)
src/common/tests/btree.sh line 34 at r1 (raw file):
Previously, janekmi (Jan Michalski) wrote…
Please do it in the first commit.
Done
src/common/tests/btree.sh line 114 at r3 (raw file):
Previously, janekmi (Jan Michalski) wrote…
It would be nice to either separate value from option with a space for all the options or none of them.
Done.
src/common/tests/btree.sh line 134 at r3 (raw file):
Previously, janekmi (Jan Michalski) wrote…
.
Done.
src/common/tests/btree.sh line 143 at r3 (raw file):
Previously, janekmi (Jan Michalski) wrote…
.
Done.
src/common/tests/btree.sh line 150 at r3 (raw file):
Previously, janekmi (Jan Michalski) wrote…
.
Done.
src/common/tests/btree.c line 1061 at r2 (raw file):
if (argc != optind) { print_message("Unknown parameter: %s\n", argv[optind]); return -1;
let's not mix btree.c errors and test errors
src/common/tests/btree.c line 1078 at r2 (raw file):
if (rc != 0) { print_message("daos_debug_init() failed: %d\n", rc); return rc;
.
src/common/tests/btree.c line 892 at r3 (raw file):
{"start-test", required_argument, NULL, 'S'}, {"reg_class", optional_argument, NULL, 'R'}, {"reg_memory", optional_argument, NULL, 'M'},
see del_retain
69001f2 to
dcc4710
Compare
grom72
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r5, all commit messages.
Reviewable status: all files reviewed, 12 unresolved discussions (waiting on @janekmi)
janekmi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 8 of 9 files at r4, 1 of 1 files at r5, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @grom72)
dcc4710 to
b36368f
Compare
grom72
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 8 of 8 files at r6, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @grom72)
b36368f to
c77f23b
Compare
In btree.sh the -m and -t parameters were not applied correctly because of the preceding positional argument containing spaces but not wrapped in quotes In btree.c an invalid parameter sequence was not detected due to of the partially manual parsing process. btr_test_state introduced to provide global parameters to test (argc/argv) and avoid static variables for that purpose. Co-authored-by: Jan Michalski <[email protected]> Co-authored-by: Tomasz Gromadzki <[email protected]> Signed-off-by: Tomasz Gromadzki <[email protected]>
9c5c02d to
ce818c2
Compare
Introduce new parameters for explicity class and memory registration. Both parameters must be provided before `-C` parameter. Syntax is as follow: * -M[p] for memory registration. The `p` value inidcates the usage of persisten memory * -R[d] for class registration. The `d` value indicates the usage of `BTR_FEAT_DIRECT_KEY` flag - root is dynamically sized up to tree order. Parameters `-t` and `-d` are no longer valid. Signed-off-by: Tomasz Gromadzki <[email protected]>
grom72
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 45 of 45 files at r7, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @grom72)
959f9c9 to
a5d5f74
Compare
grom72
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 8 of 51 files at r8, all commit messages.
Reviewable status: 9 of 52 files reviewed, all discussions resolved (waiting on @grom72)
janekmi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 8 files at r6, 2 of 45 files at r7, 9 of 51 files at r8, all commit messages.
Reviewable status: 15 of 52 files reviewed, 2 unresolved discussions (waiting on @grom72)
-- commits line 42 at r7:
Is it right?
Code quote:
without space. Otherwise, the argument is incorectly interpreted
as the next option (invalid one).
src/common/tests/btree.c line 978 at r8 (raw file):
break; case 'M': ik_btr_memory_register(tst_fn_val.optval);
Either tst_fn_val is global or you pass its value as an argument.
Code quote:
ik_btr_class_register(tst_fn_val.optval);
break;
case 'M':
ik_btr_memory_register(tst_fn_val.optval);-R and -M options have optional argument. The optional argument must be specified on the command line without space. Otherwise, the argument is incorectly interpreted as the next option (invalid one). From getopt() documentation: about option with mandatory argument: "optstring is a string containing the legitimate option characters. If such a character is followed by a colon, the option requires an argument, so getopt() places a pointer to the following text in the same argv-element, or the text of the following argv-element, in optarg." about option with optional argument: "Two colons mean an option takes an optional arg; if there is text in the current argv-element (i.e., in the same word as the option name itself, for example, "-oarg"), then it is returned in optarg, otherwise optarg is set to zero." Signed-off-by: Tomasz Gromadzki <[email protected]>
btree_direct.c and btree.c must follow the same parameters except dyenamic registration and drain. Unify test execution implementation. Limit validation scope: Skip-func-hw-test: true Skip-func-test: true Signed-off-by: Tomasz Gromadzki <[email protected]>
a5d5f74 to
c084761
Compare
grom72
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 15 of 52 files reviewed, 2 unresolved discussions (waiting on @janekmi)
Previously, janekmi (Jan Michalski) wrote…
Is it right?
Yes. The only solution to use space is to use ' e.g. '-M p'
I have updated commit message.
src/common/tests/btree.c line 978 at r8 (raw file):
Previously, janekmi (Jan Michalski) wrote…
Either
tst_fn_valis global or you pass its value as an argument.
Let's fix it separately.
grom72
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 43 of 51 files at r8, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @janekmi)
janekmi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @grom72)
In btree.sh the -m and -t parameters were not applied correctly because of the preceding positional argument containing spaces but not wrapped in quotes
In btree.c an invalid parameter sequence was not detected due to of the partially manual parsing process.
btr_test_state introduced to provide global parameters to the test (argc/argv) and avoid static variables for that purpose.
Additionally:
instead of
-tand-mparameters new parameters has been proposed:-R[d]for class registration, optionally with dynamic root-M[p]for memory registration, optionally with indication to use persistent memoryBefore requesting gatekeeper:
Features:(orTest-tag*) commit pragma was used or there is a reason documented that there are no appropriate tags for this PR.Gatekeeper:
This change is