Skip to content

Commit 4db7ed0

Browse files
committed
Add test of binary inclusion in xml trace for integer values
In order to confirm that the binary is now included in the xml trace output. Lines may be separated with `\r\n` on windows, rather than just `\n`. So we need to match both kinds of separator in order to be platform independant. As we don't require the xml elements to be on separate lines and `\s` matches both `\r` and `\n` we can let `\s*` match all the line separators as well as any indentation characters. `uint32_t` for example fully specifies that an integer is unsigned and 32 bits. But it could be implemented as a `typedef unsigned` or a `typedef unsigned long`, so long as these underlying types fulfill the requirements. Therefore the regex for this needs to match both `16u` and `16ul` as the value.
1 parent 33d9e32 commit 4db7ed0

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include <assert.h>
2+
#include <inttypes.h>
3+
#include <math.h>
4+
#include <stdbool.h>
5+
#include <stddef.h>
6+
#include <stdlib.h>
7+
8+
int main()
9+
{
10+
int8_t i1 = 2;
11+
int16_t i2 = 3;
12+
int32_t i3 = 4;
13+
int64_t i4 = 5;
14+
15+
int8_t in1 = -2;
16+
int16_t in2 = -3;
17+
int32_t in3 = -4;
18+
int64_t in4 = -5;
19+
20+
uint8_t u8 = 'a';
21+
uint16_t u16 = 8;
22+
uint32_t u32 = 16;
23+
uint64_t u64 = 32;
24+
25+
void *ptr = malloc(1);
26+
27+
assert(false);
28+
29+
return 0;
30+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
CORE
2+
test.c
3+
--trace --xml-ui
4+
activate-multi-line-match
5+
^EXIT=10$
6+
^SIGNAL=0$
7+
VERIFICATION FAILED
8+
<full_lhs>u8</full_lhs>\s*<full_lhs_value binary="01100001">97</full_lhs_value>
9+
<full_lhs>u16</full_lhs>\s*<full_lhs_value binary="0{12}1000">8</full_lhs_value>
10+
<full_lhs>u32</full_lhs>\s*<full_lhs_value binary="0{27}10000">16ul?</full_lhs_value>
11+
<full_lhs>u64</full_lhs>\s*<full_lhs_value binary="0{58}100000">32ull?</full_lhs_value>
12+
<full_lhs>i1</full_lhs>\s*<full_lhs_value binary="0{6}10">2</full_lhs_value>
13+
<full_lhs>i2</full_lhs>\s*<full_lhs_value binary="0{14}11">3</full_lhs_value>
14+
<full_lhs>i3</full_lhs>\s*<full_lhs_value binary="0{29}100">4</full_lhs_value>
15+
<full_lhs>i4</full_lhs>\s*<full_lhs_value binary="0{61}101">5ll?</full_lhs_value>
16+
<full_lhs>in1</full_lhs>\s*<full_lhs_value binary="1{6}10">-2</full_lhs_value>
17+
<full_lhs>in2</full_lhs>\s*<full_lhs_value binary="1{14}01">-3</full_lhs_value>
18+
<full_lhs>in3</full_lhs>\s*<full_lhs_value binary="1{29}100">-4</full_lhs_value>
19+
<full_lhs>in4</full_lhs>\s*<full_lhs_value binary="1{61}011">-5ll?</full_lhs_value>
20+
--
21+
--
22+
Checks that the binary value is printed for integral types.

0 commit comments

Comments
 (0)