Use fixed clock for sort-into-previous-region test
With large values of clocks, awk starts to lose precision due handling the time as floating point values, which causes the test to fail. By always setting the clock of the events to a known value we can just compare the outcome as-is, without performing any arithmetic operation. Fixes: https://pm.bsc.es/gitlab/rarias/ovni/-/issues/205
This commit is contained in:
parent
73b19ca1c4
commit
180ac51aea
@ -36,12 +36,11 @@ emit(char *mcv, uint64_t clock, int size)
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
set_clock(1);
|
||||
instr_start(0, 1);
|
||||
|
||||
/* Leave some room to prevent clashes */
|
||||
sleep_us(100); /* 100000 us */
|
||||
uint64_t t0 = ovni_clock_now();
|
||||
sleep_us(100); /* 100000 us */
|
||||
uint64_t t0 = 100;
|
||||
|
||||
/* We want it to end like this:
|
||||
*
|
||||
@ -68,6 +67,7 @@ main(void)
|
||||
emit("OB.", t0 + 9, 0);
|
||||
emit("OU]", t0 + 11, 0);
|
||||
|
||||
set_clock(200);
|
||||
instr_end();
|
||||
|
||||
return 0;
|
||||
|
@ -3,21 +3,23 @@ target=$OVNI_TEST_BIN
|
||||
$target
|
||||
ovnisort ovni
|
||||
ovnidump ovni
|
||||
ovnidump ovni | awk 'NR == 1 {next} NR==2{t=$1} {print $1-t,$2} NR==13{exit}' > found
|
||||
ovnidump ovni | awk '{print $1,$2}' > found
|
||||
|
||||
cat > expected <<EOF
|
||||
0 OB.
|
||||
1 OB.
|
||||
2 OB.
|
||||
3 OB.
|
||||
4 OB.
|
||||
5 OB.
|
||||
6 OU[
|
||||
7 OU]
|
||||
8 OB.
|
||||
9 OB.
|
||||
10 OU[
|
||||
11 OU]
|
||||
1 OHx
|
||||
100 OB.
|
||||
101 OB.
|
||||
102 OB.
|
||||
103 OB.
|
||||
104 OB.
|
||||
105 OB.
|
||||
106 OU[
|
||||
107 OU]
|
||||
108 OB.
|
||||
109 OB.
|
||||
110 OU[
|
||||
111 OU]
|
||||
200 OHe
|
||||
EOF
|
||||
|
||||
diff -s found expected
|
||||
|
Loading…
Reference in New Issue
Block a user