Skip to contentSkip to conversation

-- Try again for GLIB v2.28 compatibility

PATCH Applied Brian Gix 4 participants 9 messages Jan 24, 2017 – Jan 25, 2017 Bluetooth drivers

lore
Share & tools
lore

Brian Gix

author
#0 lore raw

v5 cover -- Try again for GLIB v2.28 compatibility

v4 still wasn't v2.28 compatible. This one should be.

author
#1 lore raw

PATCH v5 1/2 Add test-midi to ignore list

---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)
.gitignore +1 -0
index 6257505..c0745b4 100644
@@ -138,6 +138,7 @@ unit/test-avdtp
 unit/test-avctp
 unit/test-avrcp
 unit/test-gatt
+unit/test-midi
 unit/test-gattrib
 unit/test-*.log
 unit/test-*.trs
Signature · 1 line
1.9.1
author
#2 lore raw

PATCH v5 2/2 Make unit test compatible with GLIB v2.28

In reply to Brian Gix
---
 unit/test-midi.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
unit/test-midi.c +6 -2
index d318b07..3995c86 100644
@@ -282,8 +282,12 @@ static void compare_events(const snd_seq_event_t *ev1,
 		                ev2->data.control.value);
 		break;
 	case SND_SEQ_EVENT_SYSEX:
-		g_assert_cmpmem(ev1->data.ext.ptr, ev1->data.ext.len,
-		                ev2->data.ext.ptr, ev2->data.ext.len);
+		g_assert_cmpint(ev1->data.ext.len,
+		                ==,
+		                ev2->data.ext.len);
+		g_assert(memcmp(ev1->data.ext.ptr,
+		                ev2->data.ext.ptr,
+		                ev2->data.ext.len) == 0);
 		break;
 	default:
 		g_assert_not_reached();
Signature · 1 line
1.9.1
author
#3 lore raw

RE: [PATCH v5 2/2] Make unit test compatible with GLIB v2.28

H Luiz, Felipe, Szymon,

Quoted 24 lines

From: Gix, Brian

---
 unit/test-midi.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
unit/test-midi.c +6 -2
@@ -282,8 +282,12 @@ static void compare_events(const snd_seq_event_t
 *ev1,
 		                ev2->data.control.value);
 		break;
 	case SND_SEQ_EVENT_SYSEX:
-		g_assert_cmpmem(ev1->data.ext.ptr, ev1->data.ext.len,
-		                ev2->data.ext.ptr, ev2->data.ext.len);
+		g_assert_cmpint(ev1->data.ext.len,
+		                ==,
+		                ev2->data.ext.len);
+		g_assert(memcmp(ev1->data.ext.ptr,
+		                ev2->data.ext.ptr,
+		                ev2->data.ext.len) == 0);
 		break;
 	default:
Quoted 1 line

g_assert_not_reached();

Here is a straightforward rework of the g_assert_cmpmem assert.

It was used only once, and both replacement asserts existed pre-v2.28

#4 lore raw

Re: [PATCH v5 2/2] Make unit test compatible with GLIB v2.28

Hi Brian,

Quoted 32 lines · Brian

H Luiz, Felipe, Szymon,

Quoted 24 lines

From: Gix, Brian

---
 unit/test-midi.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
unit/test-midi.c +6 -2
@@ -282,8 +282,12 @@ static void compare_events(const snd_seq_event_t
 *ev1,
 		                ev2->data.control.value);
 		break;
 	case SND_SEQ_EVENT_SYSEX:
-		g_assert_cmpmem(ev1->data.ext.ptr, ev1->data.ext.len,
-		                ev2->data.ext.ptr, ev2->data.ext.len);
+		g_assert_cmpint(ev1->data.ext.len,
+		                ==,
+		                ev2->data.ext.len);
+		g_assert(memcmp(ev1->data.ext.ptr,
+		                ev2->data.ext.ptr,
+		                ev2->data.ext.len) == 0);
 		break;
 	default:
Quoted 1 line

g_assert_not_reached();

Here is a straightforward rework of the g_assert_cmpmem assert.

Quoted 2 lines

It was used only once, and both replacement asserts existed pre-v2.28

Fine by me, but make sure you add a relevant comment in the git message, please.

Just the title is not enough. You could write something like:

g_assert_cmpmem was added in version X of glib and since we don't want to bump the required version of glib for BlueZ because of a unit-test, we use g_assert_cmpint and g_assert to replace previous code.

Signature · 1 line
Felipe
author
#5 lore raw

RE: [PATCH v5 2/2] Make unit test compatible with GLIB v2.28

Hi Felipe,

Quoted 41 lines · On 25/1/17 Felipe Ferreri Tonello wrote:

Hi Brian,

Quoted 9 lines · Brian

H Luiz, Felipe, Szymon,

Quoted 6 lines

From: Gix, Brian

---
 unit/test-midi.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
Quoted 5 lines

unit/test-midi.c static void compare_events(const

Quoted 5 lines
unit/test-midi.c index renamed from unit/test-midi.c +0 -0

d318b07..3995c86 100644

unit/test-midi.c +0 -0
@@ -282,8 +282,12 @@ static void compare_events(const

snd_seq_event_t

Quoted 19 lines
Quoted 14 lines
unit/test-midi.c +6 -2
 *ev1,
 		                ev2->data.control.value);
 		break;
 	case SND_SEQ_EVENT_SYSEX:
-		g_assert_cmpmem(ev1->data.ext.ptr, ev1->data.ext.len,
-		                ev2->data.ext.ptr, ev2->data.ext.len);
+		g_assert_cmpint(ev1->data.ext.len,
+		                ==,
+		                ev2->data.ext.len);
+		g_assert(memcmp(ev1->data.ext.ptr,
+		                ev2->data.ext.ptr,
+		                ev2->data.ext.len) == 0);
 		break;
 	default:
Quoted 1 line

g_assert_not_reached();

Here is a straightforward rework of the g_assert_cmpmem assert.

Quoted 2 lines

It was used only once, and both replacement asserts existed pre-v2.28

Quoted 8 lines

Fine by me, but make sure you add a relevant comment in the git message, please.

Just the title is not enough. You could write something like:

g_assert_cmpmem was added in version X of glib and since we don't want to bump the required version of glib for BlueZ because of a unit-test, we use g_assert_cmpint and g_assert to replace previous code.

I can put this in the comment if people like, but it is a very straightforward change.

You don't think the existing comment makes it clear that the change is being done to avoid up-reving GLIB?

It is a *very* isolated change that affects only asserts, for the reason given in the headline. I think more verbiage would be excessive.

--Brian

#6 lore raw

Re: [PATCH v5 2/2] Make unit test compatible with GLIB v2.28

Hi Brian,

Quoted 49 lines · Brian

Hi Felipe,

Quoted 46 lines · On 25/1/17 Felipe Ferreri Tonello wrote:

Hi Brian,

Quoted 9 lines · Brian

H Luiz, Felipe, Szymon,

Quoted 6 lines

From: Gix, Brian

---
 unit/test-midi.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
Quoted 5 lines

unit/test-midi.c static void compare_events(const

Quoted 5 lines
unit/test-midi.c index renamed from unit/test-midi.c +0 -0

d318b07..3995c86 100644

unit/test-midi.c +0 -0
@@ -282,8 +282,12 @@ static void compare_events(const

snd_seq_event_t

Quoted 19 lines
Quoted 14 lines
unit/test-midi.c +6 -2
 *ev1,
 		                ev2->data.control.value);
 		break;
 	case SND_SEQ_EVENT_SYSEX:
-		g_assert_cmpmem(ev1->data.ext.ptr, ev1->data.ext.len,
-		                ev2->data.ext.ptr, ev2->data.ext.len);
+		g_assert_cmpint(ev1->data.ext.len,
+		                ==,
+		                ev2->data.ext.len);
+		g_assert(memcmp(ev1->data.ext.ptr,
+		                ev2->data.ext.ptr,
+		                ev2->data.ext.len) == 0);
 		break;
 	default:
Quoted 1 line

g_assert_not_reached();

Here is a straightforward rework of the g_assert_cmpmem assert.

Quoted 2 lines

It was used only once, and both replacement asserts existed pre-v2.28

Fine by me, but make sure you add a relevant comment in the git message, please.

Just the title is not enough. You could write something like:

Quoted 8 lines
Quoted 3 lines

g_assert_cmpmem was added in version X of glib and since we don't want to bump the required version of glib for BlueZ because of a unit-test, we use g_assert_cmpint and g_assert to replace previous code.

I can put this in the comment if people like, but it is a very straightforward change.

You don't think the existing comment makes it clear that the change is being done to avoid up-reving GLIB?

IMO, no.

It doesn't make clear why you decided to change the code instead of change the glib requirement.

Quoted 2 lines

It is a *very* isolated change that affects only asserts, for the reason given in the headline. I think more verbiage would be excessive.

Well, I have given my opinion, but this is too small for me to push it. It is up to Luiz to decide if he is ok with it.

Signature · 1 line
Felipe
#7 lore raw

Re: [PATCH v5 2/2] Make unit test compatible with GLIB v2.28

Hi,

Quoted 63 lines · Felipe Ferreri Tonello

Hi Brian,

Quoted 49 lines · Brian

Hi Felipe,

Quoted 46 lines · On 25/1/17 Felipe Ferreri Tonello wrote:

Hi Brian,

Quoted 9 lines · Brian

H Luiz, Felipe, Szymon,

Quoted 6 lines

From: Gix, Brian

---
 unit/test-midi.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
Quoted 5 lines

unit/test-midi.c static void compare_events(const

Quoted 5 lines
unit/test-midi.c index renamed from unit/test-midi.c +0 -0

d318b07..3995c86 100644

unit/test-midi.c +0 -0
@@ -282,8 +282,12 @@ static void compare_events(const

snd_seq_event_t

Quoted 17 lines
Quoted 14 lines
unit/test-midi.c +6 -2
 *ev1,
                           ev2->data.control.value);
           break;
   case SND_SEQ_EVENT_SYSEX:
-          g_assert_cmpmem(ev1->data.ext.ptr, ev1->data.ext.len,
-                          ev2->data.ext.ptr, ev2->data.ext.len);
+          g_assert_cmpint(ev1->data.ext.len,
+                          ==,
+                          ev2->data.ext.len);
+          g_assert(memcmp(ev1->data.ext.ptr,
+                          ev2->data.ext.ptr,
+                          ev2->data.ext.len) == 0);
           break;
   default:
Quoted 1 line
           g_assert_not_reached();
Quoted 4 lines

Here is a straightforward rework of the g_assert_cmpmem assert.

It was used only once, and both replacement asserts existed pre-v2.28

Fine by me, but make sure you add a relevant comment in the git message, please.

Just the title is not enough. You could write something like:

Quoted 8 lines
Quoted 3 lines

g_assert_cmpmem was added in version X of glib and since we don't want to bump the required version of glib for BlueZ because of a unit-test, we use g_assert_cmpint and g_assert to replace previous code.

I can put this in the comment if people like, but it is a very straightforward change.

You don't think the existing comment makes it clear that the change is being done to avoid up-reving GLIB?

IMO, no.

Quoted 8 lines

It doesn't make clear why you decided to change the code instead of change the glib requirement.

Quoted 2 lines

It is a *very* isolated change that affects only asserts, for the reason given in the headline. I think more verbiage would be excessive.

Well, I have given my opinion, but this is too small for me to push it. It is up to Luiz to decide if he is ok with it.

The more information the better, but in this case I can added it myself.