Skip to content

Commit f887827

Browse files
authored
Merge pull request #13 from YuShuanHsieh/fix/sorting-trace
Fix(trace): fix expected values and unknown address access
2 parents b42797a + 13d38f6 commit f887827

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

qtest.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -485,16 +485,18 @@ bool do_sort(int argc, char *argv[])
485485
exception_cancel();
486486
set_noallocate_mode(false);
487487

488-
list_ele_t *e = q->head;
489488
bool ok = true;
490-
while (ok && e && --cnt) {
491-
/* Ensure each element in ascending order */
492-
/* FIXME: add an option to specify sorting order */
493-
if (strcmp(e->value, e->next->value) > 0) {
494-
report(1, "ERROR: Not sorted in ascending order");
495-
ok = false;
489+
if (q) {
490+
list_ele_t *e = q->head;
491+
while (ok && e && --cnt) {
492+
/* Ensure each element in ascending order */
493+
/* FIXME: add an option to specify sorting order */
494+
if (strcmp(e->value, e->next->value) > 0) {
495+
report(1, "ERROR: Not sorted in ascending order");
496+
ok = false;
497+
}
498+
e = e->next;
496499
}
497-
e = e->next;
498500
}
499501

500502
show_queue(3);

traces/trace-04-ops.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ it bear
1111
it gerbil
1212
size
1313
sort
14-
rh dolphin
14+
rh bear
1515
rh
1616
rh
1717
rh

traces/trace-05-ops.cmd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ rh dolphin
1515
reverse
1616
size
1717
sort
18-
rh gerbil
1918
rh bear
20-
rh meerkat
21-
rh gerbil
2219
rh bear
20+
rh gerbil
21+
rh gerbil
22+
rh meerkat
2323
size
2424
free

0 commit comments

Comments
 (0)