* [PATCH 0/2] glib-2.0: Don't check function "qsort_r" in configure.ac
@ 2012-02-06 6:41 Xiaofeng Yan
2012-02-06 6:41 ` [PATCH 1/2] glib-2.0: Don't check function qsort_r Xiaofeng Yan
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Xiaofeng Yan @ 2012-02-06 6:41 UTC (permalink / raw)
To: openembedded-core
From: Xiaofeng Yan <xiaofeng.yan@windriver.com>
The function "g_qsort_with_data" has two kinds of realization. One calls qsort_r
from libglib, the other realize itself. the realization method is controlled by macro "HAVE_QSORT_R".
qsort_r from libglib cause sort error. Add no-check-qsort_r.patch for fixing this problem.
This patch is to fix bug 1959. After this patch is merged into OE-core I will open a new bug to
track the reason why qsort_r report normally. For finishing lsb test in YOCTO 1.2 M3 this patch
is applied temporarily.
Pull URL: git://git.pokylinux.org/poky-contrib.git
Branch: xiaofeng/1959
Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=xiaofeng/1959
Thanks,
Xiaofeng Yan <xiaofeng.yan@windriver.com>
---
Xiaofeng Yan (2):
glib-2.0: Don't check function qsort_r
glib-2.0: Add patch "no-check-qsort_r.patch"
.../glib-2.0/glib-2.0/no-check-qsort_r.patch | 61 ++++++++++++++++++++
meta/recipes-core/glib-2.0/glib-2.0_2.30.2.bb | 3 +-
2 files changed, 63 insertions(+), 1 deletions(-)
create mode 100644 meta/recipes-core/glib-2.0/glib-2.0/no-check-qsort_r.patch
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH 1/2] glib-2.0: Don't check function qsort_r 2012-02-06 6:41 [PATCH 0/2] glib-2.0: Don't check function "qsort_r" in configure.ac Xiaofeng Yan @ 2012-02-06 6:41 ` Xiaofeng Yan 2012-02-06 9:13 ` Phil Blundell 2012-02-06 6:41 ` [PATCH 2/2] glib-2.0: Add patch "no-check-qsort_r.patch" Xiaofeng Yan 2012-02-06 7:05 ` [PATCH 0/2] glib-2.0: Don't check function "qsort_r" in configure.ac Martin Jansa 2 siblings, 1 reply; 12+ messages in thread From: Xiaofeng Yan @ 2012-02-06 6:41 UTC (permalink / raw) To: openembedded-core From: Xiaofeng Yan <xiaofeng.yan@windriver.com> function "g_qsort_with_data" has two kinds of realization. One calls qsort_r from libglib, the other realize itself. qsort_r from libglib cause sort error. For fixing this problem no checking "qsort_r" in configure.ac. [YOCTO #1959] Signed-off-by: Xiaofeng Yan <xiaofeng.yan@windriver.com> --- .../glib-2.0/glib-2.0/no-check-qsort_r.patch | 61 ++++++++++++++++++++ 1 files changed, 61 insertions(+), 0 deletions(-) create mode 100644 meta/recipes-core/glib-2.0/glib-2.0/no-check-qsort_r.patch diff --git a/meta/recipes-core/glib-2.0/glib-2.0/no-check-qsort_r.patch b/meta/recipes-core/glib-2.0/glib-2.0/no-check-qsort_r.patch new file mode 100644 index 0000000..99e229c --- /dev/null +++ b/meta/recipes-core/glib-2.0/glib-2.0/no-check-qsort_r.patch @@ -0,0 +1,61 @@ +Upstream-Status: Pending + +function "g_qsort_with_data" has two kinds of realization. One calls qsort_r +from libglib, the other realize itself. +qsort_r from libglib cause sort error. Don't check qsort_r for fixing this problem. + +Xiaofeng Yan <xiaofeng.yan@windriver.com> + +Index: glib-2.30.0/configure.ac +=================================================================== +--- a/configure.ac 2012-02-06 11:15:37.885295264 +0800 ++++ b/configure.ac.new 2012-02-06 11:16:04.239795382 +0800 +@@ -584,47 +584,7 @@ + dnl don't use AC_CHECK_FUNCS here, otherwise HAVE_QSORT_R will + dnl be automatically defined, which we don't want to do + dnl until we have checked this function is actually usable +-AC_CHECK_FUNC([qsort_r]) +- +-# BSD has a qsort_r with wrong argument order +-if test x$ac_cv_func_qsort_r = xyes ; then +- AC_CACHE_CHECK([if qsort_r uses glibc compatible argument order], glib_cv_have_qsort_r, [ +- AC_RUN_IFELSE([AC_LANG_SOURCE([[ +- #define _GNU_SOURCE +- #include <stdlib.h> +- +- static int +- cmp (const void *a, const void *b, void *c) +- { +- const int *ia = a; +- const int *ib = b; +- +- if (*ia < *ib) +- return -1; +- else if (*ia > *ib) +- return 1; +- else +- return 0; +- } +- +- int +- main (int argc, char **argv) +- { +- int arr[3] = { 1, 2, 0 }; +- int d = 3; +- +- qsort_r (arr, 3, sizeof (int), cmp, &d); +- +- if (arr[0] == 0 && arr[1] == 1 && arr[2] == 2) +- return 0; +- else +- return 1; +- }]])],[glib_cv_have_qsort_r=yes],[glib_cv_have_qsort_r=no])]) +-fi +- +-if test x$glib_cv_have_qsort_r = xyes ; then +- AC_DEFINE(HAVE_QSORT_R, 1, [Define to 1 if you have the 'qsort_r' function]) +-fi ++#AC_CHECK_FUNC([qsort_r]) + + AC_CHECK_SIZEOF(char) + AC_CHECK_SIZEOF(short) -- 1.7.0.4 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] glib-2.0: Don't check function qsort_r 2012-02-06 6:41 ` [PATCH 1/2] glib-2.0: Don't check function qsort_r Xiaofeng Yan @ 2012-02-06 9:13 ` Phil Blundell 2012-02-06 15:34 ` Khem Raj 0 siblings, 1 reply; 12+ messages in thread From: Phil Blundell @ 2012-02-06 9:13 UTC (permalink / raw) To: Patches and discussions about the oe-core layer On Mon, 2012-02-06 at 14:41 +0800, Xiaofeng Yan wrote: > From: Xiaofeng Yan <xiaofeng.yan@windriver.com> > > function "g_qsort_with_data" has two kinds of realization. One calls qsort_r > from libglib, the other realize itself. > qsort_r from libglib cause sort error. > For fixing this problem no checking "qsort_r" in configure.ac. > > [YOCTO #1959] This description doesn't make much sense. libglib is part of glib-2.0 itself; I guess you meant to say that qsort_r is from libc6. But, even leaving that aside, if qsort_r is broken then the appropriate patch would be to fix it, not just to hack glib to use a standalone implementation. So this patch seems like the wrong thing by any measure. Does glibc's own testsuite also have failures for qsort_r? p. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] glib-2.0: Don't check function qsort_r 2012-02-06 9:13 ` Phil Blundell @ 2012-02-06 15:34 ` Khem Raj 2012-02-06 19:13 ` Peter Tworek 0 siblings, 1 reply; 12+ messages in thread From: Khem Raj @ 2012-02-06 15:34 UTC (permalink / raw) To: Patches and discussions about the oe-core layer On Mon, Feb 6, 2012 at 1:13 AM, Phil Blundell <philb@gnu.org> wrote: > On Mon, 2012-02-06 at 14:41 +0800, Xiaofeng Yan wrote: >> From: Xiaofeng Yan <xiaofeng.yan@windriver.com> >> >> function "g_qsort_with_data" has two kinds of realization. One calls qsort_r >> from libglib, the other realize itself. >> qsort_r from libglib cause sort error. >> For fixing this problem no checking "qsort_r" in configure.ac. >> >> [YOCTO #1959] > > This description doesn't make much sense. libglib is part of glib-2.0 > itself; I guess you meant to say that qsort_r is from libc6. But, even > leaving that aside, if qsort_r is broken then the appropriate patch > would be to fix it, not just to hack glib to use a standalone > implementation. So this patch seems like the wrong thing by any > measure. > > Does glibc's own testsuite also have failures for qsort_r? glibc one works ok last time I checked however uclibc does not implement it > > p. > > > > _______________________________________________ > Openembedded-core mailing list > Openembedded-core@lists.openembedded.org > http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] glib-2.0: Don't check function qsort_r 2012-02-06 15:34 ` Khem Raj @ 2012-02-06 19:13 ` Peter Tworek 2012-02-06 22:54 ` Khem Raj 0 siblings, 1 reply; 12+ messages in thread From: Peter Tworek @ 2012-02-06 19:13 UTC (permalink / raw) To: Patches and discussions about the oe-core layer On 02/06/2012 04:34 PM, Khem Raj wrote: > On Mon, Feb 6, 2012 at 1:13 AM, Phil Blundell<philb@gnu.org> wrote: >> On Mon, 2012-02-06 at 14:41 +0800, Xiaofeng Yan wrote: >>> From: Xiaofeng Yan<xiaofeng.yan@windriver.com> >>> >>> function "g_qsort_with_data" has two kinds of realization. One calls qsort_r >>> from libglib, the other realize itself. >>> qsort_r from libglib cause sort error. >>> For fixing this problem no checking "qsort_r" in configure.ac. >>> >>> [YOCTO #1959] >> This description doesn't make much sense. libglib is part of glib-2.0 >> itself; I guess you meant to say that qsort_r is from libc6. But, even >> leaving that aside, if qsort_r is broken then the appropriate patch >> would be to fix it, not just to hack glib to use a standalone >> implementation. So this patch seems like the wrong thing by any >> measure. >> >> Does glibc's own testsuite also have failures for qsort_r? > glibc one works ok last time I checked however uclibc does not implement it Yes, it does. It was implemented somewhere in between 0.9.32 and 0.9.33 [1]. Last time I've checked it even worked fine with glib-2.0. You just need to change glib_cv_have_qsort to yes in meta/site/common-uclibc. /ptw [1] http://git.uclibc.org/uClibc/commit/?id=515d54433138596e81267237542bd9168b8cc787 ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] glib-2.0: Don't check function qsort_r 2012-02-06 19:13 ` Peter Tworek @ 2012-02-06 22:54 ` Khem Raj 0 siblings, 0 replies; 12+ messages in thread From: Khem Raj @ 2012-02-06 22:54 UTC (permalink / raw) To: Peter Tworek; +Cc: Patches and discussions about the oe-core layer On Mon, Feb 6, 2012 at 11:13 AM, Peter Tworek <tworaz666@gmail.com> wrote: > Yes, it does. It was implemented somewhere in between 0.9.32 and 0.9.33 [1]. > Last time I've checked it even worked fine with glib-2.0. You just need to > change glib_cv_have_qsort to yes in meta/site/common-uclibc. yes I was merely pointing out the need since we still dont have 0.9.33 in metadata ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 2/2] glib-2.0: Add patch "no-check-qsort_r.patch" 2012-02-06 6:41 [PATCH 0/2] glib-2.0: Don't check function "qsort_r" in configure.ac Xiaofeng Yan 2012-02-06 6:41 ` [PATCH 1/2] glib-2.0: Don't check function qsort_r Xiaofeng Yan @ 2012-02-06 6:41 ` Xiaofeng Yan 2012-02-06 15:33 ` Khem Raj 2012-02-06 7:05 ` [PATCH 0/2] glib-2.0: Don't check function "qsort_r" in configure.ac Martin Jansa 2 siblings, 1 reply; 12+ messages in thread From: Xiaofeng Yan @ 2012-02-06 6:41 UTC (permalink / raw) To: openembedded-core From: Xiaofeng Yan <xiaofeng.yan@windriver.com> Apply this patch for avoiding sort error. Please check no-check-qsort_r.patch for detailed information. Signed-off-by: Xiaofeng Yan <xiaofeng.yan@windriver.com> --- meta/recipes-core/glib-2.0/glib-2.0_2.30.2.bb | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/meta/recipes-core/glib-2.0/glib-2.0_2.30.2.bb b/meta/recipes-core/glib-2.0/glib-2.0_2.30.2.bb index bdf92aa..a5ec28a 100644 --- a/meta/recipes-core/glib-2.0/glib-2.0_2.30.2.bb +++ b/meta/recipes-core/glib-2.0/glib-2.0_2.30.2.bb @@ -1,6 +1,6 @@ require glib.inc -PR = "r2" +PR = "r3" PE = "1" DEPENDS += "libffi python-argparse-native zlib" @@ -14,6 +14,7 @@ SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.bz2 \ file://60_wait-longer-for-threads-to-die.patch \ file://g_once_init_enter.patch \ file://glib-2.0_fix_for_x32.patch \ + file://file://no-check-qsort_r.patch \ " SRC_URI[md5sum] = "b40f3889e8d24e1b367763673ca6deb5" SRC_URI[sha256sum] = "94b1f1a1456c67060ca868d299bef3f7268a2c1c5c360aabb7149d4d9b2fdcd3" -- 1.7.0.4 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 2/2] glib-2.0: Add patch "no-check-qsort_r.patch" 2012-02-06 6:41 ` [PATCH 2/2] glib-2.0: Add patch "no-check-qsort_r.patch" Xiaofeng Yan @ 2012-02-06 15:33 ` Khem Raj 2012-02-07 5:40 ` Xiaofeng Yan 0 siblings, 1 reply; 12+ messages in thread From: Khem Raj @ 2012-02-06 15:33 UTC (permalink / raw) To: Patches and discussions about the oe-core layer On Sun, Feb 5, 2012 at 10:41 PM, Xiaofeng Yan <xiaofeng.yan@windriver.com> wrote: > > + file://file://no-check-qsort_r.patch \ really ? ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/2] glib-2.0: Add patch "no-check-qsort_r.patch" 2012-02-06 15:33 ` Khem Raj @ 2012-02-07 5:40 ` Xiaofeng Yan 0 siblings, 0 replies; 12+ messages in thread From: Xiaofeng Yan @ 2012-02-07 5:40 UTC (permalink / raw) To: openembedded-core On 2012年02月06日 23:33, Khem Raj wrote: > On Sun, Feb 5, 2012 at 10:41 PM, Xiaofeng Yan > <xiaofeng.yan@windriver.com> wrote: >> + file://file://no-check-qsort_r.patch \ > really ? > > _______________________________________________ > Openembedded-core mailing list > Openembedded-core@lists.openembedded.org > http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core I run qsort-test.c in core-image-lsb-sdk, The result is ok. I didn't know how to resolve this bug. I think I need to apply this patch only in core-image-lsb-qt3 and other images don't apply this patch. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/2] glib-2.0: Don't check function "qsort_r" in configure.ac 2012-02-06 6:41 [PATCH 0/2] glib-2.0: Don't check function "qsort_r" in configure.ac Xiaofeng Yan 2012-02-06 6:41 ` [PATCH 1/2] glib-2.0: Don't check function qsort_r Xiaofeng Yan 2012-02-06 6:41 ` [PATCH 2/2] glib-2.0: Add patch "no-check-qsort_r.patch" Xiaofeng Yan @ 2012-02-06 7:05 ` Martin Jansa 2012-02-06 7:37 ` Xiaofeng Yan 2 siblings, 1 reply; 12+ messages in thread From: Martin Jansa @ 2012-02-06 7:05 UTC (permalink / raw) To: Patches and discussions about the oe-core layer [-- Attachment #1: Type: text/plain, Size: 2141 bytes --] On Mon, Feb 06, 2012 at 02:41:09PM +0800, Xiaofeng Yan wrote: > From: Xiaofeng Yan <xiaofeng.yan@windriver.com> > > The function "g_qsort_with_data" has two kinds of realization. One calls qsort_r > from libglib, the other realize itself. the realization method is controlled by macro "HAVE_QSORT_R". > qsort_r from libglib cause sort error. Add no-check-qsort_r.patch for fixing this problem. > This patch is to fix bug 1959. After this patch is merged into OE-core I will open a new bug to > track the reason why qsort_r report normally. For finishing lsb test in YOCTO 1.2 M3 this patch > is applied temporarily. > > Pull URL: git://git.pokylinux.org/poky-contrib.git > Branch: xiaofeng/1959 > Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=xiaofeng/1959 > > Thanks, > Xiaofeng Yan <xiaofeng.yan@windriver.com> > --- no-check-qsort_r.patch is the same as remove.test.for.qsort_r.patch from http://git.openembedded.org/openembedded-core/commit/?id=74f43e3b269c01dba7cd5215a8e825229bd5ecff which was later removed from glib-2.0-native in http://git.openembedded.org/openembedded-core/commit/?id=37579d7d74d127c90c1e078d05c5bf4ba0b3f755 and later removed completely in http://git.openembedded.org/openembedded-core/commit/?id=812342e44e9e361a0fa93cfcfe65cf4dd6f2fb57 Are you sure this patch is right fix? And no need to split adding patch itself and adding it to SRC_URI to 2 patches. Cheers, > > > Xiaofeng Yan (2): > glib-2.0: Don't check function qsort_r > glib-2.0: Add patch "no-check-qsort_r.patch" > > .../glib-2.0/glib-2.0/no-check-qsort_r.patch | 61 ++++++++++++++++++++ > meta/recipes-core/glib-2.0/glib-2.0_2.30.2.bb | 3 +- > 2 files changed, 63 insertions(+), 1 deletions(-) > create mode 100644 meta/recipes-core/glib-2.0/glib-2.0/no-check-qsort_r.patch > > > _______________________________________________ > Openembedded-core mailing list > Openembedded-core@lists.openembedded.org > http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core -- Martin 'JaMa' Jansa jabber: Martin.Jansa@gmail.com [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 205 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/2] glib-2.0: Don't check function "qsort_r" in configure.ac 2012-02-06 7:05 ` [PATCH 0/2] glib-2.0: Don't check function "qsort_r" in configure.ac Martin Jansa @ 2012-02-06 7:37 ` Xiaofeng Yan 2012-02-06 9:16 ` Xiaofeng Yan 0 siblings, 1 reply; 12+ messages in thread From: Xiaofeng Yan @ 2012-02-06 7:37 UTC (permalink / raw) To: openembedded-core [-- Attachment #1: Type: text/plain, Size: 2335 bytes --] On 2012年02月06日 15:05, Martin Jansa wrote: > On Mon, Feb 06, 2012 at 02:41:09PM +0800, Xiaofeng Yan wrote: >> From: Xiaofeng Yan<xiaofeng.yan@windriver.com> >> >> The function "g_qsort_with_data" has two kinds of realization. One calls qsort_r >> from libglib, the other realize itself. the realization method is controlled by macro "HAVE_QSORT_R". >> qsort_r from libglib cause sort error. Add no-check-qsort_r.patch for fixing this problem. >> This patch is to fix bug 1959. After this patch is merged into OE-core I will open a new bug to >> track the reason why qsort_r report normally. For finishing lsb test in YOCTO 1.2 M3 this patch >> is applied temporarily. >> >> Pull URL: git://git.pokylinux.org/poky-contrib.git >> Branch: xiaofeng/1959 >> Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=xiaofeng/1959 >> >> Thanks, >> Xiaofeng Yan<xiaofeng.yan@windriver.com> >> --- > no-check-qsort_r.patch is the same as remove.test.for.qsort_r.patch from > http://git.openembedded.org/openembedded-core/commit/?id=74f43e3b269c01dba7cd5215a8e825229bd5ecff > > which was later removed from glib-2.0-native in > http://git.openembedded.org/openembedded-core/commit/?id=37579d7d74d127c90c1e078d05c5bf4ba0b3f755 > > and later removed completely in > http://git.openembedded.org/openembedded-core/commit/?id=812342e44e9e361a0fa93cfcfe65cf4dd6f2fb57 > > Are you sure this patch is right fix? And no need to split adding patch > itself and adding it to SRC_URI to 2 patches. > > Cheers, > Hi Martin Jansa, I reviewed the above link, no-check-qsort_r.patch is the same as remove.test.for.qsort_r.patch really. Please check attachment for the test program from LSB 4.1. I think we need this patch because it is an error really. LSB report the next information: After sorting array, the 0-th element of array should be 1, but is 2 After sorting array, the 1-th element of array should be 2, but is 1 After sorting array, the 2-th element of array should be 3, but is 5 After sorting array, the 4-th element of array should be 5, but is 3 I can reuse this patch which was removed before if you think this is a bug. Do you any suggestion? Compile this test program. $ gcc -g `pkg-config --cflags glib-2.0` gobject_value_arrays.c -o gobject -lgobject-2.0 [-- Attachment #2: gobject_value_arrays.c --] [-- Type: text/x-csrc, Size: 15339 bytes --] ///////////////////////////////////////////////////////////////////////////// // Copyright (C) 2010 The Linux Foundation. All rights reserved. // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // This file contains tests for the following library: // libgobject-2.0, // section: "GVALUE_ARRAYS". // // This C file was generated by the T2C system developed in ISPRAS // for The Linux Foundation. ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // To build a standalone version of the tests, i.e. the one that does not // depend on TETware Lite test harness, please follow the instructions below. // (A standalone executable like this can prove useful for debugging.) // // 1. Make sure the T2C_ROOT and T2C_SUITE_ROOT environment variables are set properly. // T2C_ROOT should contain a path to the main directory of T2C Framework. // For example, the executable of the T2C C code generator is $T2C_ROOT/t2c/bin/t2c. // T2C_SUITE_ROOT is main test suite directory, the one where the tet execution // configuration file (tetexec.cfg) resides as well as tet_code file etc. // // 2. If the standalone version of the tests is to be built with lsbcc or lsbc++, // make sure that lsbcc (or lsbc++, respectively) is somewhere in your PATH. // You should also add a path to the LSB pkg-config data // (usually /opt/lsb/lib/pkgconfig or /opt/lsb/lib64/pkgconfig) to the beginning of // the string contained in PKG_CONFIG_PATH environment variable. // // 3. Before building the standalone version of a test, check if the following // files and directories exist: // $T2C_SUITE_ROOT/gobject-t2c/tests // $T2C_SUITE_ROOT/gobject-t2c/tests/common.mk // $T2C_SUITE_ROOT/gobject-t2c/tests/gobject_value_arrays/ // $T2C_SUITE_ROOT/gobject-t2c/tests/gobject_value_arrays/gobject_value_arrays.c // $T2C_SUITE_ROOT/gobject-t2c/tests/gobject_value_arrays/Makefile // // If some of these are missing, just run ./gen_code.sh script from the $T2C_SUITE_ROOT // directory. After that all necessary files and directories should exist. // // 4. Execute the following commands: // cd $T2C_SUITE_ROOT/gobject-t2c/tests/gobject_value_arrays/ // make clean // make debug // // The C-code of the tests is the same both for release and debug (standalone) // versions. // main() function for standalone execution is defined in // "$T2C_ROOT/t2c/debug/src/dbg_main.c" along with some utility stuff. // The TET API stubs are declared in "$T2C_ROOT/t2c/debug/include/tet_api.h" // // Note that all the test purposes of a standalone test are executed // in the same process to simplify debugging (some debuggers may not // handle fork() calls properly by default). // // WAIT_TIME configuration parameter has no effect on the standalone tests. // They will not be interrupted, no matter how long they run. Otherwise they // could be stopped in the middle of the debugging process (because their time // had expired) which is probably not what you want. ///////////////////////////////////////////////////////////////////////////// #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <unistd.h> #include <glib-object.h> const char* test_name_ = "gobject_value_arrays"; const char* suite_subdir_ = "gobject-t2c"; // List of requirement catalogs to be loaded const char* rcat_names_[] = { "gobject_value_arrays", NULL }; const char* rel_href_path_ = "gobject-t2c/tests/gobject_value_arrays/gobject_value_arrays.html#%s%d\">"; char* t2c_href_tpl_ = NULL; char* t2c_href_full_tpl_ = NULL; // Name of the env. variable that is used to determine whether the REQ // implementation should output just IDs (value = 0, default) or hyperlinks // to the html representation, enclosed in some pseudotags for DTK Manager // (value != 0). const char* t2c_gen_hlinks_name = "T2C_GEN_HLINKS"; int gen_hlinks = 0; char* init_fail_reason_ = NULL; /* g_value_array_append DONE g_value_array_copy DONE g_value_array_free DONE g_value_array_get_nth DONE g_value_array_insert DONE g_value_array_new DONE g_value_array_prepend DONE g_value_array_remove DONE g_value_array_sort DONE g_value_array_sort_with_data DONE */ //Global variables, used in get_value function //They must be declared as global , because get_value can return pointers to these variables. gint gintVar; guint guintVar; gint64 gint64Var; guint64 huint64Var; gchar gcharVar; guchar gucharVar; glong glongVar; gulong gulongVar; guchar gucharVar; gfloat gfloatVar; gdouble gdoubleVar; gboolean gbooleanVar; char* message; // set_value function generates this message , and it contains the unique text for each GType char* sortMessage; //this message will be generated in cmp or cmp_data interfaces GType sortType; // //This function gets the GType and calls the correct set interface for this type //For example, it calls g_value_set_int for G_TYPE_INT. // void set_value(GType initType,GValue* value, void* vl ) { if(initType==G_TYPE_INT) { g_value_set_int(value,*((gint *)vl)); message="The function should return %d,but returns %d"; return; } else if(initType==G_TYPE_CHAR) { g_value_set_char(value,*((gchar *)vl)); message="The function should return %c,but returns %c"; return; } else if(initType==G_TYPE_UCHAR) { g_value_set_uchar(value,*((guchar *)vl)); message="The function should return %u,but returns %u"; return; } else if(initType==G_TYPE_LONG) { g_value_set_long(value,*((glong *)vl)); message="The function should return %ld,but returns %ld"; return; } else if(initType==G_TYPE_ULONG) { g_value_set_ulong(value,*((gulong *)vl)); return; } else if(initType==G_TYPE_INT64) { g_value_set_int64(value,*((gint64 *)vl)); return; } else if(initType==G_TYPE_UINT) { g_value_set_uint(value,*((guint *)vl)); message="The function should return %u,but returns %u"; return; } else if(initType==G_TYPE_BOOLEAN) { g_value_set_boolean(value,*((gboolean *)vl)); return; } else if(initType==G_TYPE_DOUBLE) { g_value_set_double(value,*((gdouble *)vl)); message="The function should return %f,but returns %f"; return; } else if(initType==G_TYPE_FLOAT) { g_value_set_float(value,*((gfloat *)vl)); message="The function should return %f,but returns %f"; return; } return ; } void* get_value(GType initType,GValue* value ) { if(initType==G_TYPE_INT) { gintVar=g_value_get_int(value); return (void*)(&gintVar); } else if(initType==G_TYPE_CHAR) { gcharVar=g_value_get_char(value); return (void*)(&gcharVar); } else if(initType==G_TYPE_UCHAR) { gucharVar=g_value_get_uchar(value); return (void*)(&gucharVar); } else if(initType==G_TYPE_LONG) { glongVar=g_value_get_long(value); return (void*)(&glongVar); } else if(initType==G_TYPE_ULONG) { gulongVar=g_value_get_ulong(value); return (void*)(&gulongVar); } else if(initType==G_TYPE_INT64) { gint64Var=g_value_get_int64(value); return (void*)(&gint64Var); } else if(initType==G_TYPE_UINT) { guintVar=g_value_get_uint(value); return (void*)(&gintVar); } else if(initType==G_TYPE_BOOLEAN) { gbooleanVar=g_value_get_boolean(value); return (void*)(&gbooleanVar); } else if(initType==G_TYPE_DOUBLE) { gdoubleVar=g_value_get_double(value); return (void*)(&gdoubleVar); } else if(initType==G_TYPE_FLOAT) { gfloatVar=g_value_get_float(value); return (void*)(&gfloatVar); } return (void *)NULL; } ///////////////////////////////////////////////////////////////////////// //compare function for g_value_array_sort gint cmp (gconstpointer a, gconstpointer b) { if(sortType==G_TYPE_INT) { GValue* aValue=(GValue*)a; gint a1=g_value_get_int(aValue); GValue* bValue=(GValue*)b; gint b1=g_value_get_int(bValue); sortMessage="After sorting array, the %d-th element of array should be %d, but is %d"; if (a1 - b1 < 0) return -1; if (a1 - b1 > 0) return 1; return 0; } if(sortType==G_TYPE_CHAR) { GValue* aValue=(GValue*)a; gchar a1=g_value_get_char(aValue); GValue* bValue=(GValue*)b; gchar b1=g_value_get_char(bValue); sortMessage="After sorting array, the %d-th element of array should be %c, but is %c"; if (a1 - b1 < 0) return -1; if (a1 - b1 > 0) return 1; return 0; } if(sortType==G_TYPE_UCHAR) { GValue* aValue=(GValue*)a; guchar a1=g_value_get_uchar(aValue); GValue* bValue=(GValue*)b; guchar b1=g_value_get_uchar(bValue); sortMessage="After sorting array, the %d-th element of array should be %u, but is %u"; if (a1 - b1 < 0) return -1; if (a1 - b1 > 0) return 1; return 0; } if(sortType==G_TYPE_DOUBLE) { GValue* aValue=(GValue*)a; gdouble a1=g_value_get_double(aValue); GValue* bValue=(GValue*)b; gdouble b1=g_value_get_double(bValue); sortMessage="After sorting array, the %d-th element of array should be %f, but is %f"; if (a1 - b1 < 0) return -1; if (a1 - b1 > 0) return 1; return 0; } return -1; } gint cmp_data (gconstpointer a, gconstpointer b,gpointer userData) { if(sortType==G_TYPE_INT) { GValue* aValue=(GValue*)a; gint a1=g_value_get_int(aValue); GValue* bValue=(GValue*)b; gint b1=g_value_get_int(bValue); GValue* userValue=(GValue*)userData; gint user=g_value_get_int(userValue); sortMessage="After sorting array, the %d-th element of array should be %d, but is %d"; if (a1 - b1 < user) return -1; if (a1 - b1 > user) return 1; return 0; } if(sortType==G_TYPE_CHAR) { GValue* aValue=(GValue*)a; gchar a1=g_value_get_char(aValue); GValue* bValue=(GValue*)b; gchar b1=g_value_get_char(bValue); GValue* userValue=(GValue*)userData; gchar user=g_value_get_char(userValue); sortMessage="After sorting array, the %d-th element of array should be %c, but is %c"; if (a1 - b1 < user) return -1; if (a1 - b1 > user) return 1; return 0; } if(sortType==G_TYPE_UCHAR) { GValue* aValue=(GValue*)a; guchar a1=g_value_get_uchar(aValue); GValue* bValue=(GValue*)b; guchar b1=g_value_get_uchar(bValue); GValue* userValue=(GValue*)userData; guchar user=g_value_get_uchar(userValue); sortMessage="After sorting array, the %d-th element of array should be %u, but is %u"; if (a1 - b1 < user) return -1; if (a1 - b1 > user) return 1; return 0; } if(sortType==G_TYPE_DOUBLE) { GValue* aValue=(GValue*)a; gdouble a1=g_value_get_double(aValue); GValue* bValue=(GValue*)b; gdouble b1=g_value_get_double(bValue); GValue* userValue=(GValue*)userData; gdouble user=g_value_get_double(userValue); sortMessage="After sorting array, the %d-th element of array should be %f, but is %f"; if (a1 - b1 < user) return -1; if (a1 - b1 > user) return 1; return 0; } return -1; } void main () { #define COUNT 6 #define TYPE G_TYPE_INT #define BUILT_IN_TYPE gint #define DATA_ARRAY {2,1,5,4,3,6} #define RESULT_ARRAY {1,2,3,4,5,6} #define USER_DATA 1 int i; gboolean check=TRUE; gboolean check_count=TRUE; sortType=TYPE; GValueArray* array=NULL; g_type_init(); array=g_value_array_new (COUNT); BUILT_IN_TYPE data_array []=DATA_ARRAY; BUILT_IN_TYPE result_array[]=RESULT_ARRAY; GValue a_value[COUNT]={{0,}}; BUILT_IN_TYPE user=USER_DATA; GValue userValue={0}; g_value_init (&userValue, TYPE); set_value(TYPE,&userValue,(void*)(&user)); for(i=0;i<COUNT;i++) { g_value_init (&a_value[i], TYPE); set_value(TYPE,&a_value[i],(void*)(&data_array[i])); } for(i=0;i<COUNT;i++) { array=g_value_array_append(array,&a_value[i]); } if(array->n_values!=COUNT) { printf("Before sorting the array should contain %d values, but contains %d",COUNT,array->n_values); } g_value_array_sort_with_data(array,cmp_data,(void*)&userValue); if(array->n_values!=COUNT) { printf("After sorting the array should contain %d values, but contains %d",COUNT,array->n_values); } /* * number of values contained in the array */ for(i=0;i<COUNT;i++) { GValue* retValue=g_value_array_get_nth(array,i); void *ret1=get_value(TYPE,retValue); BUILT_IN_TYPE ret= *((BUILT_IN_TYPE *)ret1); if(ret!=result_array[i]) { printf ("ret is %d ", ret); printf ("result_array[%d] is %d ", i, result_array[i]); printf("FAILED !!! \n"); } } for (i=0; i < sizeof(result_array)/sizeof(result_array[0]); i++) { printf("%d ", result_array[i]); } } ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/2] glib-2.0: Don't check function "qsort_r" in configure.ac 2012-02-06 7:37 ` Xiaofeng Yan @ 2012-02-06 9:16 ` Xiaofeng Yan 0 siblings, 0 replies; 12+ messages in thread From: Xiaofeng Yan @ 2012-02-06 9:16 UTC (permalink / raw) To: openembedded-core [-- Attachment #1: Type: text/plain, Size: 2975 bytes --] On 2012年02月06日 15:37, Xiaofeng Yan wrote: > On 2012年02月06日 15:05, Martin Jansa wrote: >> On Mon, Feb 06, 2012 at 02:41:09PM +0800, Xiaofeng Yan wrote: >>> From: Xiaofeng Yan<xiaofeng.yan@windriver.com> >>> >>> The function "g_qsort_with_data" has two kinds of realization. One >>> calls qsort_r >>> from libglib, the other realize itself. the realization method is >>> controlled by macro "HAVE_QSORT_R". >>> qsort_r from libglib cause sort error. Add no-check-qsort_r.patch >>> for fixing this problem. >>> This patch is to fix bug 1959. After this patch is merged into >>> OE-core I will open a new bug to >>> track the reason why qsort_r report normally. For finishing lsb test >>> in YOCTO 1.2 M3 this patch >>> is applied temporarily. >>> >>> Pull URL: git://git.pokylinux.org/poky-contrib.git >>> Branch: xiaofeng/1959 >>> Browse: >>> http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=xiaofeng/1959 >>> >>> Thanks, >>> Xiaofeng Yan<xiaofeng.yan@windriver.com> >>> --- >> no-check-qsort_r.patch is the same as remove.test.for.qsort_r.patch from >> http://git.openembedded.org/openembedded-core/commit/?id=74f43e3b269c01dba7cd5215a8e825229bd5ecff >> >> >> which was later removed from glib-2.0-native in >> http://git.openembedded.org/openembedded-core/commit/?id=37579d7d74d127c90c1e078d05c5bf4ba0b3f755 >> >> >> and later removed completely in >> http://git.openembedded.org/openembedded-core/commit/?id=812342e44e9e361a0fa93cfcfe65cf4dd6f2fb57 >> >> >> Are you sure this patch is right fix? And no need to split adding patch >> itself and adding it to SRC_URI to 2 patches. >> >> Cheers, >> > Hi Martin Jansa, > I reviewed the above link, no-check-qsort_r.patch is the same as > remove.test.for.qsort_r.patch really. Please check attachment for the > test program from LSB 4.1. I think we need this patch because it is an > error really. LSB report the next information: > > After sorting array, the 0-th element of array should be 1, but is 2 > After sorting array, the 1-th element of array should be 2, but is 1 > After sorting array, the 2-th element of array should be 3, but is 5 > After sorting array, the 4-th element of array should be 5, but is 3 > > > I can reuse this patch which was removed before if you think this is a > bug. Do you any suggestion? > > Compile this test program. > $ gcc -g `pkg-config --cflags glib-2.0` gobject_value_arrays.c -o > gobject -lgobject-2.0 > > I reviewed the origin patch from Martin Jansa and found that my patch is different from him. My patch is to remove the check of qsort_r and the origin had still this check. I also update my patch because it have two file:// in SRC_URI. Thank Martin Jansa. > > _______________________________________________ > Openembedded-core mailing list > Openembedded-core@lists.openembedded.org > http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core [-- Attachment #2: Type: text/html, Size: 5422 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2012-02-07 5:48 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-02-06 6:41 [PATCH 0/2] glib-2.0: Don't check function "qsort_r" in configure.ac Xiaofeng Yan 2012-02-06 6:41 ` [PATCH 1/2] glib-2.0: Don't check function qsort_r Xiaofeng Yan 2012-02-06 9:13 ` Phil Blundell 2012-02-06 15:34 ` Khem Raj 2012-02-06 19:13 ` Peter Tworek 2012-02-06 22:54 ` Khem Raj 2012-02-06 6:41 ` [PATCH 2/2] glib-2.0: Add patch "no-check-qsort_r.patch" Xiaofeng Yan 2012-02-06 15:33 ` Khem Raj 2012-02-07 5:40 ` Xiaofeng Yan 2012-02-06 7:05 ` [PATCH 0/2] glib-2.0: Don't check function "qsort_r" in configure.ac Martin Jansa 2012-02-06 7:37 ` Xiaofeng Yan 2012-02-06 9:16 ` Xiaofeng Yan
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox