**** BEGIN LOGGING AT Thu Jun 30 02:59:57 2011 Jun 30 23:51:17 ERROR:unit/test-stkutil.c:21960:test_envelope_encoding: assertion failed: (memcmp(pdu, test->pdu, pdu_len) == 0) Jun 30 23:51:18 /bin/sh: line 5: 10008 Aborted (core dumped) ${dir}$tst Jun 30 23:51:25 I have this error on a PowerPC machine. Jun 30 23:51:44 denkenz: Could we have an endian bug in here. Jul 01 00:26:53 denkenz: Failing test case is /teststk/Event: Call Connected 1.1.1: ** Jul 01 01:45:18 holtmann: no idea, it is possible Jul 01 01:47:57 pretty unlikely though, there are no data members with multiple bytes in there it seems Jul 01 01:53:56 This might be an alignment issue Jul 01 01:54:13 .list = { *(uint8_t *) data where data is a const void Jul 01 01:56:20 That could be. Jul 01 01:56:29 Does the --verbose give me the PDU outputs? Jul 01 01:56:49 Don't think so Jul 01 02:00:45 static const unsigned char event_download_call_connected_111[] = { Jul 01 02:00:45 0xd6, 0x0a, 0x99, 0x01, 0x01, 0x82, 0x02, 0x82, Jul 01 02:00:45 0x81, 0x9c, 0x01, 0x80, Jul 01 02:00:45 /* Jul 01 02:00:46 * Byte 3 changed to 0x99 and byte 10 to 0x9c (Comprehension Jul 01 02:00:46 * Required should be set according to TS 102 223 7.5.2.2) Jul 01 02:00:48 */ Jul 01 02:00:49 }; Jul 01 02:00:51 d6 0a 99 01 00 82 02 82 81 9c 01 80 Jul 01 02:01:14 So the 5th byte is wrong. Jul 01 02:02:42 static const unsigned char event_download_call_connected_112[] = { Jul 01 02:02:43 0xd6, 0x0a, 0x99, 0x01, 0x01, 0x82, 0x02, 0x83, Jul 01 02:02:43 0x81, 0x9c, 0x01, 0x80, Jul 01 02:02:43 /* Jul 01 02:02:46 * Byte 3 changed to 0x99 and byte 10 to 0x9c (Comprehension Jul 01 02:02:46 * Required should be set according to TS 102 223 7.5.2.2) Jul 01 02:02:48 */ Jul 01 02:02:50 }; Jul 01 02:02:52 d6 0a 99 01 00 82 02 83 81 9c 01 80 Jul 01 02:02:55 Some on the second test case. Jul 01 02:05:42 Seems also be true for the disconnected ones. Jul 01 02:09:24 Heh, that code is not easiest thing to remember Jul 01 02:10:26 MT Call 1.1.1: OK Jul 01 02:10:32 MT Call 1.1.2: OK Jul 01 02:10:38 This two are fine. The rest seems to fail. Jul 01 02:12:38 so I suspect this is an alignment issue Jul 01 02:13:02 But it is more than just the transaction id encoder. Jul 01 02:13:30 User Activity 1.1.1 and Location Status also fails. Jul 01 02:14:25 What is failing is actually the event list encoder Jul 01 02:14:48 Why does it succeed for MT Call? Jul 01 02:16:11 MT call results in 0 Jul 01 02:16:17 so its pure luck Jul 01 02:16:24 Anyway, it is alignment issue Jul 01 02:16:37 struct stk_envelope_event_download { Jul 01 02:16:38 enum stk_event_type type; Jul 01 02:16:51 then Jul 01 02:16:52 if (build_dataobj(builder, Jul 01 02:16:52 build_dataobj_event_type, DATAOBJ_FLAG_CR, Jul 01 02:16:52 &evt->type, Jul 01 02:17:08 then Jul 01 02:17:08 const struct stk_event_list list = { Jul 01 02:17:08 .list = { *(uint8_t *) data }, Jul 01 02:17:18 So we're casting an enum into a unsigned char Jul 01 02:17:35 and the enum is probably an int? Jul 01 02:17:47 Seems like it. And the first two succeed because type for MT Call is 0x00. Jul 01 02:18:09 Still, casting to an int should fail, not from an int Jul 01 02:18:16 So that is still a bit fishy Jul 01 02:18:40 If the alignment is off it is off. That x86 magically fixes this for you is a different story. Jul 01 02:19:10 Not for byte-by-byte access Jul 01 02:19:16 That should always be ok Jul 01 02:19:37 Yes, but you getting the ptr here. Jul 01 02:19:58 So how do we fix this. Jul 01 02:20:36 try using (enum stk_event_type *) data Jul 01 02:22:36 yes, this makes sense now, this should fix it Jul 01 02:23:33 @@ -5921,10 +5921,11 @@ static gboolean build_envelope_event_download(struct stk Jul 01 02:23:33 { Jul 01 02:23:34 const struct stk_envelope_event_download *evt = Jul 01 02:23:34 &envelope->event_download; Jul 01 02:23:34 + uint8_t type = evt->type; Jul 01 02:23:34 Jul 01 02:23:36 if (build_dataobj(builder, Jul 01 02:23:38 build_dataobj_event_type, DATAOBJ_FLAG_CR, Jul 01 02:23:40 - &evt->type, Jul 01 02:23:42 + &type, Jul 01 02:23:44 This fixes it. Jul 01 02:23:48 And then the last ones fail: Jul 01 02:23:52 ERROR:unit/test-stkutil.c:21960:test_envelope_encoding: assertion failed: (memcmp(pdu, test->pdu, pdu_len) == 0) Jul 01 02:25:47 const struct stk_event_list list = { Jul 01 02:25:47 - .list = { *(uint8_t *) data }, Jul 01 02:25:48 + .list = { *(enum stk_event_type *) data }, Jul 01 02:25:48 .len = 1, Jul 01 02:25:51 This patch also works. Jul 01 02:26:03 denkenz: Which one do you prefer? Jul 01 02:28:44 probably the latter, it is more correct Jul 01 02:29:00 or at least more compact Jul 01 02:29:40 We might need to tell gcc to make enums the smallest data type Jul 01 02:29:47 since it is wasting 4 bytes for a 1 byte enum Jul 01 02:30:34 Any idea for the failing Data Available 1.1.1 Jul 01 02:30:47 paste the resultant output Jul 01 02:31:54 Channel Status is fine. Jul 01 02:32:31 ah, I think I know Jul 01 02:32:46 struct { Jul 01 02:32:47 struct stk_channel channel; Jul 01 02:32:47 unsigned int channel_data_len; Jul 01 02:32:47 } data_available; Jul 01 02:32:53 change unsigned int to unsigned short Jul 01 02:33:22 Data Available 1.1.1: d6 0e 99 01 09 82 02 82 81 b8 02 81 00 b7 01 00 Jul 01 02:34:39 Yep, that should fix this Jul 01 02:34:59 Yep. That was it. **** ENDING LOGGING AT Fri Jul 01 02:59:57 2011