* [LTP] [PATCH v2] ldd01: remove all -m32/-m64 logic
@ 2014-09-24 8:13 Jan Stancek
2014-09-30 8:49 ` chrubis
0 siblings, 1 reply; 3+ messages in thread
From: Jan Stancek @ 2014-09-24 8:13 UTC (permalink / raw)
To: ltp-list
and build all binaries with same CFLAGS as rest of LTP build.
Also treat lddfile*.so and lddfile.out as data files.
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
testcases/commands/ade/ldd/Makefile | 13 +------
testcases/commands/ade/ldd/datafiles/Makefile | 40 ++++++++++++++++++++
testcases/commands/ade/ldd/datafiles/lddfile1.c | 5 ++
testcases/commands/ade/ldd/datafiles/lddfile2.c | 5 ++
testcases/commands/ade/ldd/datafiles/lddfile3.c | 5 ++
testcases/commands/ade/ldd/datafiles/lddfile4.c | 5 ++
testcases/commands/ade/ldd/datafiles/lddfile5.c | 5 ++
testcases/commands/ade/ldd/datafiles/main.c | 18 +++++++++
testcases/commands/ade/ldd/ldd01 | 46 ++++------------------
testcases/commands/ade/ldd/lddfile1.c | 5 --
testcases/commands/ade/ldd/lddfile2.c | 5 --
testcases/commands/ade/ldd/lddfile3.c | 5 --
testcases/commands/ade/ldd/lddfile4.c | 5 --
testcases/commands/ade/ldd/lddfile5.c | 5 --
testcases/commands/ade/ldd/main.c | 18 ---------
15 files changed, 93 insertions(+), 92 deletions(-)
create mode 100644 testcases/commands/ade/ldd/datafiles/Makefile
create mode 100644 testcases/commands/ade/ldd/datafiles/lddfile1.c
create mode 100644 testcases/commands/ade/ldd/datafiles/lddfile2.c
create mode 100644 testcases/commands/ade/ldd/datafiles/lddfile3.c
create mode 100644 testcases/commands/ade/ldd/datafiles/lddfile4.c
create mode 100644 testcases/commands/ade/ldd/datafiles/lddfile5.c
create mode 100644 testcases/commands/ade/ldd/datafiles/main.c
delete mode 100644 testcases/commands/ade/ldd/lddfile1.c
delete mode 100644 testcases/commands/ade/ldd/lddfile2.c
delete mode 100644 testcases/commands/ade/ldd/lddfile3.c
delete mode 100644 testcases/commands/ade/ldd/lddfile4.c
delete mode 100644 testcases/commands/ade/ldd/lddfile5.c
delete mode 100644 testcases/commands/ade/ldd/main.c
diff --git a/testcases/commands/ade/ldd/Makefile b/testcases/commands/ade/ldd/Makefile
index eae06cd..f37f21b 100644
--- a/testcases/commands/ade/ldd/Makefile
+++ b/testcases/commands/ade/ldd/Makefile
@@ -13,10 +13,6 @@
# 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.
-#
# Garrett Cooper, July 2009
#
@@ -24,13 +20,6 @@ top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/env_pre.mk
-CPPFLAGS += -fpic
-
INSTALL_TARGETS := ldd01
-MAKE_TARGETS := $(patsubst $(abs_srcdir)/%.c,%.obj,$(wildcard $(abs_srcdir)/*.c))
-
-$(MAKE_TARGETS): %.obj: %.o
- mv $^ $@
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
+include $(top_srcdir)/include/mk/generic_trunk_target.mk
diff --git a/testcases/commands/ade/ldd/datafiles/Makefile b/testcases/commands/ade/ldd/datafiles/Makefile
new file mode 100644
index 0000000..213cc74
--- /dev/null
+++ b/testcases/commands/ade/ldd/datafiles/Makefile
@@ -0,0 +1,40 @@
+#
+# commands/ade/ldd/datafiles testcases Makefile.
+#
+# Copyright (C) 2014, Linux Test Project.
+#
+# 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.
+
+top_srcdir ?= ../../../../..
+
+include $(top_srcdir)/include/mk/env_pre.mk
+
+CPPFLAGS += -fpic
+
+INSTALL_TARGETS := ldd*.so lddfile.out
+
+LDD_C_FILES := $(wildcard $(abs_srcdir)/lddfile*.c)
+LDD_SO_FILES := $(patsubst $(abs_srcdir)/%.c,%.obj.so,$(LDD_C_FILES))
+MAKE_TARGETS := lddfile.out
+CLEAN_TARGETS += *.obj $(LDD_SO_FILES)
+
+%.obj: %.o
+ mv $^ $@
+
+%.obj.so: %.obj
+ $(CC) $(CFLAGS) -shared -o $@ $^
+
+lddfile.out: main.obj $(LDD_SO_FILES)
+ $(CC) $(CFLAGS) -O -o $@ $(LDD_SO_FILES) main.obj
+
+INSTALL_DIR := testcases/data/ldd01
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/commands/ade/ldd/datafiles/lddfile1.c b/testcases/commands/ade/ldd/datafiles/lddfile1.c
new file mode 100644
index 0000000..ccb5786
--- /dev/null
+++ b/testcases/commands/ade/ldd/datafiles/lddfile1.c
@@ -0,0 +1,5 @@
+#include <stdio.h>
+void file1(void)
+{
+ printf("Control in function %s\n", __func__);
+}
diff --git a/testcases/commands/ade/ldd/datafiles/lddfile2.c b/testcases/commands/ade/ldd/datafiles/lddfile2.c
new file mode 100644
index 0000000..20aede3
--- /dev/null
+++ b/testcases/commands/ade/ldd/datafiles/lddfile2.c
@@ -0,0 +1,5 @@
+#include <stdio.h>
+void file2(void)
+{
+ printf("Control in function %s\n", __func__);
+}
diff --git a/testcases/commands/ade/ldd/datafiles/lddfile3.c b/testcases/commands/ade/ldd/datafiles/lddfile3.c
new file mode 100644
index 0000000..a4529f7
--- /dev/null
+++ b/testcases/commands/ade/ldd/datafiles/lddfile3.c
@@ -0,0 +1,5 @@
+#include <stdio.h>
+void file3(void)
+{
+ printf("Control in function %s\n", __func__);
+}
diff --git a/testcases/commands/ade/ldd/datafiles/lddfile4.c b/testcases/commands/ade/ldd/datafiles/lddfile4.c
new file mode 100644
index 0000000..9dc339d
--- /dev/null
+++ b/testcases/commands/ade/ldd/datafiles/lddfile4.c
@@ -0,0 +1,5 @@
+#include <stdio.h>
+void file4(void)
+{
+ printf("Control in function %s\n", __func__);
+}
diff --git a/testcases/commands/ade/ldd/datafiles/lddfile5.c b/testcases/commands/ade/ldd/datafiles/lddfile5.c
new file mode 100644
index 0000000..3fbb7f6
--- /dev/null
+++ b/testcases/commands/ade/ldd/datafiles/lddfile5.c
@@ -0,0 +1,5 @@
+#include <stdio.h>
+void file5(void)
+{
+ printf("Control in function %s\n", __func__);
+}
diff --git a/testcases/commands/ade/ldd/datafiles/main.c b/testcases/commands/ade/ldd/datafiles/main.c
new file mode 100644
index 0000000..69e278e
--- /dev/null
+++ b/testcases/commands/ade/ldd/datafiles/main.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+
+void file1(void);
+void file2(void);
+void file3(void);
+void file4(void);
+void file5(void);
+
+int main(void)
+{
+ file1();
+ file2();
+ file3();
+ file4();
+ file5();
+ printf("All Functions Executed\n");
+ return 0;
+}
diff --git a/testcases/commands/ade/ldd/ldd01 b/testcases/commands/ade/ldd/ldd01
index c60d3ac..87d3811 100755
--- a/testcases/commands/ade/ldd/ldd01
+++ b/testcases/commands/ade/ldd/ldd01
@@ -35,64 +35,36 @@ $trace_logic
CC=${CC:=gcc}
LDD=${LDD:=ldd}
TCdat=${TCdat:-`pwd`}
-TCtmp=${TCtmp:-/tmp/ldd01-$$}
-do_cleanup()
-{
- rm -rf $TCtmp
-}
-
-do_setup()
+do_test()
{
- mkdir $TCtmp
-
- # Check for ppc64 architecture or x86_64 architecture
- if uname -a | grep -iq powerpc; then
- file lddfile1.obj | grep 64-bit >/dev/null 2>&1
- if [ $? -eq 0 ]; then
- CFLAGS="-m64"
- fi
- elif uname -a | grep -iq x86_64; then
- file lddfile1.obj | grep 32-bit >/dev/null 2>&1
- if [ $? -eq 0 ]; then
- CFLAGS="-m32"
- fi
+ if [ -z "$LTPROOT" ]; then
+ export LD_LIBRARY_PATH=./datafiles:$LD_LIBRARY_PATH
+ LDDTESTFILE="./datafiles/lddfile.out"
+ else
+ export LD_LIBRARY_PATH=$LTPROOT/testcases/data/ldd01:$LD_LIBRARY_PATH
+ LDDTESTFILE="$LTPROOT/testcases/data/ldd01/lddfile.out"
fi
- $CC $CFLAGS -shared -o $TCtmp/lddfile1.obj.so $TCdat/lddfile1.obj
- $CC $CFLAGS -shared -o $TCtmp/lddfile2.obj.so $TCdat/lddfile2.obj
- $CC $CFLAGS -shared -o $TCtmp/lddfile3.obj.so $TCdat/lddfile3.obj
- $CC $CFLAGS -shared -o $TCtmp/lddfile4.obj.so $TCdat/lddfile4.obj
- $CC $CFLAGS -shared -o $TCtmp/lddfile5.obj.so $TCdat/lddfile5.obj
- $CC $CFLAGS -O -o $TCtmp/a.out $TCtmp/lddfile*.obj.so $TCdat/main.obj
-}
-do_test()
-{
echo " ASSERTION 1 "
-
- $LDD $TCtmp/a.out | grep -E "lddfile1.obj.so|lddfile2.obj.so|lddfile3.obj.so|lddfile4.obj.so|lddfile5.obj.so"
+ $LDD $LDDTESTFILE | grep -E "lddfile1.obj.so|lddfile2.obj.so|lddfile3.obj.so|lddfile4.obj.so|lddfile5.obj.so"
if [ $? -eq 0 ]; then
echo "ASSERTION #1 PASS"
else
echo "ASSERTION #1 FAIL"
- do_cleanup
return 1
fi
echo " ASSERTION 2 "
-
- $LDD -v $TCtmp/a.out | grep -E "GLIBC|lddfile1.obj.so|lddfile2.obj.so|lddfile3.obj.so|lddfile4.obj.so|lddfile5.obj.so"
+ $LDD -v $LDDTESTFILE | grep -E "GLIBC|lddfile1.obj.so|lddfile2.obj.so|lddfile3.obj.so|lddfile4.obj.so|lddfile5.obj.so"
if [ $? -eq 0 ]; then
echo "ASSERTION #2 PASS"
else
echo "ASSERTION #2 FAIL"
- do_cleanup
return 1
fi
echo "TEST PASSES"
- do_cleanup
return 0
}
-do_setup
do_test
diff --git a/testcases/commands/ade/ldd/lddfile1.c b/testcases/commands/ade/ldd/lddfile1.c
deleted file mode 100644
index 377f7a3..0000000
--- a/testcases/commands/ade/ldd/lddfile1.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <stdio.h>
-void file1()
-{
- printf("Control in function %s\n", __func__);
-}
diff --git a/testcases/commands/ade/ldd/lddfile2.c b/testcases/commands/ade/ldd/lddfile2.c
deleted file mode 100644
index 5fd2b4b..0000000
--- a/testcases/commands/ade/ldd/lddfile2.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <stdio.h>
-void file2()
-{
- printf("Control in function %s\n", __func__);
-}
diff --git a/testcases/commands/ade/ldd/lddfile3.c b/testcases/commands/ade/ldd/lddfile3.c
deleted file mode 100644
index d6b4cc9..0000000
--- a/testcases/commands/ade/ldd/lddfile3.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <stdio.h>
-void file3()
-{
- printf("Control in function %s\n", __func__);
-}
diff --git a/testcases/commands/ade/ldd/lddfile4.c b/testcases/commands/ade/ldd/lddfile4.c
deleted file mode 100644
index 1db89bb..0000000
--- a/testcases/commands/ade/ldd/lddfile4.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <stdio.h>
-void file4()
-{
- printf("Control in function %s\n", __func__);
-}
diff --git a/testcases/commands/ade/ldd/lddfile5.c b/testcases/commands/ade/ldd/lddfile5.c
deleted file mode 100644
index 2f46cdb..0000000
--- a/testcases/commands/ade/ldd/lddfile5.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <stdio.h>
-void file5()
-{
- printf("Control in function %s\n", __func__);
-}
diff --git a/testcases/commands/ade/ldd/main.c b/testcases/commands/ade/ldd/main.c
deleted file mode 100644
index 0f23b8b..0000000
--- a/testcases/commands/ade/ldd/main.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <stdio.h>
-
-void file1();
-void file2();
-void file3();
-void file4();
-void file5();
-
-int main()
-{
- file1();
- file2();
- file3();
- file4();
- file5();
- printf("All Functions Executed\n");
- return 0;
-}
--
1.7.1
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH v2] ldd01: remove all -m32/-m64 logic
2014-09-24 8:13 [LTP] [PATCH v2] ldd01: remove all -m32/-m64 logic Jan Stancek
@ 2014-09-30 8:49 ` chrubis
[not found] ` <225320409.2008145.1412168278476.JavaMail.zimbra@redhat.com>
0 siblings, 1 reply; 3+ messages in thread
From: chrubis @ 2014-09-30 8:49 UTC (permalink / raw)
To: Jan Stancek; +Cc: ltp-list
Hi!
> and build all binaries with same CFLAGS as rest of LTP build.
> Also treat lddfile*.so and lddfile.out as data files.
>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> ---
> testcases/commands/ade/ldd/Makefile | 13 +------
> testcases/commands/ade/ldd/datafiles/Makefile | 40 ++++++++++++++++++++
> testcases/commands/ade/ldd/datafiles/lddfile1.c | 5 ++
> testcases/commands/ade/ldd/datafiles/lddfile2.c | 5 ++
> testcases/commands/ade/ldd/datafiles/lddfile3.c | 5 ++
> testcases/commands/ade/ldd/datafiles/lddfile4.c | 5 ++
> testcases/commands/ade/ldd/datafiles/lddfile5.c | 5 ++
> testcases/commands/ade/ldd/datafiles/main.c | 18 +++++++++
> testcases/commands/ade/ldd/ldd01 | 46 ++++------------------
> testcases/commands/ade/ldd/lddfile1.c | 5 --
> testcases/commands/ade/ldd/lddfile2.c | 5 --
> testcases/commands/ade/ldd/lddfile3.c | 5 --
> testcases/commands/ade/ldd/lddfile4.c | 5 --
> testcases/commands/ade/ldd/lddfile5.c | 5 --
> testcases/commands/ade/ldd/main.c | 18 ---------
> 15 files changed, 93 insertions(+), 92 deletions(-)
> create mode 100644 testcases/commands/ade/ldd/datafiles/Makefile
> create mode 100644 testcases/commands/ade/ldd/datafiles/lddfile1.c
> create mode 100644 testcases/commands/ade/ldd/datafiles/lddfile2.c
> create mode 100644 testcases/commands/ade/ldd/datafiles/lddfile3.c
> create mode 100644 testcases/commands/ade/ldd/datafiles/lddfile4.c
> create mode 100644 testcases/commands/ade/ldd/datafiles/lddfile5.c
> create mode 100644 testcases/commands/ade/ldd/datafiles/main.c
> delete mode 100644 testcases/commands/ade/ldd/lddfile1.c
> delete mode 100644 testcases/commands/ade/ldd/lddfile2.c
> delete mode 100644 testcases/commands/ade/ldd/lddfile3.c
> delete mode 100644 testcases/commands/ade/ldd/lddfile4.c
> delete mode 100644 testcases/commands/ade/ldd/lddfile5.c
> delete mode 100644 testcases/commands/ade/ldd/main.c
>
> diff --git a/testcases/commands/ade/ldd/Makefile b/testcases/commands/ade/ldd/Makefile
> index eae06cd..f37f21b 100644
> --- a/testcases/commands/ade/ldd/Makefile
> +++ b/testcases/commands/ade/ldd/Makefile
> @@ -13,10 +13,6 @@
> # 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.
> -#
> # Garrett Cooper, July 2009
> #
>
> @@ -24,13 +20,6 @@ top_srcdir ?= ../../../..
>
> include $(top_srcdir)/include/mk/env_pre.mk
>
> -CPPFLAGS += -fpic
> -
> INSTALL_TARGETS := ldd01
>
> -MAKE_TARGETS := $(patsubst $(abs_srcdir)/%.c,%.obj,$(wildcard $(abs_srcdir)/*.c))
> -
> -$(MAKE_TARGETS): %.obj: %.o
> - mv $^ $@
> -
> -include $(top_srcdir)/include/mk/generic_leaf_target.mk
> +include $(top_srcdir)/include/mk/generic_trunk_target.mk
> diff --git a/testcases/commands/ade/ldd/datafiles/Makefile b/testcases/commands/ade/ldd/datafiles/Makefile
> new file mode 100644
> index 0000000..213cc74
> --- /dev/null
> +++ b/testcases/commands/ade/ldd/datafiles/Makefile
> @@ -0,0 +1,40 @@
> +#
> +# commands/ade/ldd/datafiles testcases Makefile.
> +#
> +# Copyright (C) 2014, Linux Test Project.
> +#
> +# 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.
> +
> +top_srcdir ?= ../../../../..
> +
> +include $(top_srcdir)/include/mk/env_pre.mk
> +
> +CPPFLAGS += -fpic
> +
> +INSTALL_TARGETS := ldd*.so lddfile.out
> +
> +LDD_C_FILES := $(wildcard $(abs_srcdir)/lddfile*.c)
> +LDD_SO_FILES := $(patsubst $(abs_srcdir)/%.c,%.obj.so,$(LDD_C_FILES))
> +MAKE_TARGETS := lddfile.out
> +CLEAN_TARGETS += *.obj $(LDD_SO_FILES)
> +
> +%.obj: %.o
> + mv $^ $@
> +
> +%.obj.so: %.obj
> + $(CC) $(CFLAGS) -shared -o $@ $^
Is the obj added here in order to avoid standard rules we have for
building binaries? Otherwise it looks useless to me.
> +lddfile.out: main.obj $(LDD_SO_FILES)
> + $(CC) $(CFLAGS) -O -o $@ $(LDD_SO_FILES) main.obj
> +
> +INSTALL_DIR := testcases/data/ldd01
> +
> +include $(top_srcdir)/include/mk/generic_leaf_target.mk
> diff --git a/testcases/commands/ade/ldd/datafiles/lddfile1.c b/testcases/commands/ade/ldd/datafiles/lddfile1.c
> new file mode 100644
> index 0000000..ccb5786
> --- /dev/null
> +++ b/testcases/commands/ade/ldd/datafiles/lddfile1.c
> @@ -0,0 +1,5 @@
> +#include <stdio.h>
> +void file1(void)
> +{
> + printf("Control in function %s\n", __func__);
> +}
> diff --git a/testcases/commands/ade/ldd/datafiles/lddfile2.c b/testcases/commands/ade/ldd/datafiles/lddfile2.c
> new file mode 100644
> index 0000000..20aede3
> --- /dev/null
> +++ b/testcases/commands/ade/ldd/datafiles/lddfile2.c
> @@ -0,0 +1,5 @@
> +#include <stdio.h>
> +void file2(void)
> +{
> + printf("Control in function %s\n", __func__);
> +}
> diff --git a/testcases/commands/ade/ldd/datafiles/lddfile3.c b/testcases/commands/ade/ldd/datafiles/lddfile3.c
> new file mode 100644
> index 0000000..a4529f7
> --- /dev/null
> +++ b/testcases/commands/ade/ldd/datafiles/lddfile3.c
> @@ -0,0 +1,5 @@
> +#include <stdio.h>
> +void file3(void)
> +{
> + printf("Control in function %s\n", __func__);
> +}
> diff --git a/testcases/commands/ade/ldd/datafiles/lddfile4.c b/testcases/commands/ade/ldd/datafiles/lddfile4.c
> new file mode 100644
> index 0000000..9dc339d
> --- /dev/null
> +++ b/testcases/commands/ade/ldd/datafiles/lddfile4.c
> @@ -0,0 +1,5 @@
> +#include <stdio.h>
> +void file4(void)
> +{
> + printf("Control in function %s\n", __func__);
> +}
> diff --git a/testcases/commands/ade/ldd/datafiles/lddfile5.c b/testcases/commands/ade/ldd/datafiles/lddfile5.c
> new file mode 100644
> index 0000000..3fbb7f6
> --- /dev/null
> +++ b/testcases/commands/ade/ldd/datafiles/lddfile5.c
> @@ -0,0 +1,5 @@
> +#include <stdio.h>
> +void file5(void)
> +{
> + printf("Control in function %s\n", __func__);
> +}
> diff --git a/testcases/commands/ade/ldd/datafiles/main.c b/testcases/commands/ade/ldd/datafiles/main.c
> new file mode 100644
> index 0000000..69e278e
> --- /dev/null
> +++ b/testcases/commands/ade/ldd/datafiles/main.c
> @@ -0,0 +1,18 @@
> +#include <stdio.h>
> +
> +void file1(void);
> +void file2(void);
> +void file3(void);
> +void file4(void);
> +void file5(void);
> +
> +int main(void)
> +{
> + file1();
> + file2();
> + file3();
> + file4();
> + file5();
> + printf("All Functions Executed\n");
> + return 0;
> +}
> diff --git a/testcases/commands/ade/ldd/ldd01 b/testcases/commands/ade/ldd/ldd01
> index c60d3ac..87d3811 100755
> --- a/testcases/commands/ade/ldd/ldd01
> +++ b/testcases/commands/ade/ldd/ldd01
> @@ -35,64 +35,36 @@ $trace_logic
> CC=${CC:=gcc}
> LDD=${LDD:=ldd}
> TCdat=${TCdat:-`pwd`}
We should not need the TCdat and CC anymore.
> -TCtmp=${TCtmp:-/tmp/ldd01-$$}
>
> -do_cleanup()
> -{
> - rm -rf $TCtmp
> -}
> -
> -do_setup()
> +do_test()
> {
> - mkdir $TCtmp
> -
> - # Check for ppc64 architecture or x86_64 architecture
> - if uname -a | grep -iq powerpc; then
> - file lddfile1.obj | grep 64-bit >/dev/null 2>&1
> - if [ $? -eq 0 ]; then
> - CFLAGS="-m64"
> - fi
> - elif uname -a | grep -iq x86_64; then
> - file lddfile1.obj | grep 32-bit >/dev/null 2>&1
> - if [ $? -eq 0 ]; then
> - CFLAGS="-m32"
> - fi
> + if [ -z "$LTPROOT" ]; then
> + export LD_LIBRARY_PATH=./datafiles:$LD_LIBRARY_PATH
> + LDDTESTFILE="./datafiles/lddfile.out"
> + else
> + export LD_LIBRARY_PATH=$LTPROOT/testcases/data/ldd01:$LD_LIBRARY_PATH
> + LDDTESTFILE="$LTPROOT/testcases/data/ldd01/lddfile.out"
> fi
Here you are expecting that the testcase is executed with the working
directory is LTPROOT, which may not be the case if somebody adds
tst_tmpdir to the test. Let's use
LD_LIBRARY_PATH="$LTPROOT/datafiles/:$LD_LIBRARY_PATH" instead.
Otherwise the auto detection is really nice to have. Maybe we can do
this even better and add a LTP_DATAROOT to test.sh which will
automatically point to a directory with the datafiles. If we define that
datafiles must be stored in subdirectory named 'datafiles' we can just
set the variable in test.sh and then do just:
export LD_LIBRARY_PATH="$LTP_DATAROOT:$LD_LIBRARY_PATH"
in the testcase. What do you think?
> - $CC $CFLAGS -shared -o $TCtmp/lddfile1.obj.so $TCdat/lddfile1.obj
> - $CC $CFLAGS -shared -o $TCtmp/lddfile2.obj.so $TCdat/lddfile2.obj
> - $CC $CFLAGS -shared -o $TCtmp/lddfile3.obj.so $TCdat/lddfile3.obj
> - $CC $CFLAGS -shared -o $TCtmp/lddfile4.obj.so $TCdat/lddfile4.obj
> - $CC $CFLAGS -shared -o $TCtmp/lddfile5.obj.so $TCdat/lddfile5.obj
> - $CC $CFLAGS -O -o $TCtmp/a.out $TCtmp/lddfile*.obj.so $TCdat/main.obj
> -}
>
> -do_test()
> -{
> echo " ASSERTION 1 "
> -
> - $LDD $TCtmp/a.out | grep -E "lddfile1.obj.so|lddfile2.obj.so|lddfile3.obj.so|lddfile4.obj.so|lddfile5.obj.so"
> + $LDD $LDDTESTFILE | grep -E "lddfile1.obj.so|lddfile2.obj.so|lddfile3.obj.so|lddfile4.obj.so|lddfile5.obj.so"
> if [ $? -eq 0 ]; then
> echo "ASSERTION #1 PASS"
> else
> echo "ASSERTION #1 FAIL"
> - do_cleanup
> return 1
> fi
>
> echo " ASSERTION 2 "
> -
> - $LDD -v $TCtmp/a.out | grep -E "GLIBC|lddfile1.obj.so|lddfile2.obj.so|lddfile3.obj.so|lddfile4.obj.so|lddfile5.obj.so"
> + $LDD -v $LDDTESTFILE | grep -E "GLIBC|lddfile1.obj.so|lddfile2.obj.so|lddfile3.obj.so|lddfile4.obj.so|lddfile5.obj.so"
> if [ $? -eq 0 ]; then
> echo "ASSERTION #2 PASS"
> else
> echo "ASSERTION #2 FAIL"
> - do_cleanup
> return 1
> fi
>
> echo "TEST PASSES"
> - do_cleanup
> return 0
> }
> -do_setup
> do_test
> diff --git a/testcases/commands/ade/ldd/lddfile1.c b/testcases/commands/ade/ldd/lddfile1.c
> deleted file mode 100644
> index 377f7a3..0000000
> --- a/testcases/commands/ade/ldd/lddfile1.c
> +++ /dev/null
> @@ -1,5 +0,0 @@
> -#include <stdio.h>
> -void file1()
> -{
> - printf("Control in function %s\n", __func__);
> -}
> diff --git a/testcases/commands/ade/ldd/lddfile2.c b/testcases/commands/ade/ldd/lddfile2.c
> deleted file mode 100644
> index 5fd2b4b..0000000
> --- a/testcases/commands/ade/ldd/lddfile2.c
> +++ /dev/null
> @@ -1,5 +0,0 @@
> -#include <stdio.h>
> -void file2()
> -{
> - printf("Control in function %s\n", __func__);
> -}
> diff --git a/testcases/commands/ade/ldd/lddfile3.c b/testcases/commands/ade/ldd/lddfile3.c
> deleted file mode 100644
> index d6b4cc9..0000000
> --- a/testcases/commands/ade/ldd/lddfile3.c
> +++ /dev/null
> @@ -1,5 +0,0 @@
> -#include <stdio.h>
> -void file3()
> -{
> - printf("Control in function %s\n", __func__);
> -}
> diff --git a/testcases/commands/ade/ldd/lddfile4.c b/testcases/commands/ade/ldd/lddfile4.c
> deleted file mode 100644
> index 1db89bb..0000000
> --- a/testcases/commands/ade/ldd/lddfile4.c
> +++ /dev/null
> @@ -1,5 +0,0 @@
> -#include <stdio.h>
> -void file4()
> -{
> - printf("Control in function %s\n", __func__);
> -}
> diff --git a/testcases/commands/ade/ldd/lddfile5.c b/testcases/commands/ade/ldd/lddfile5.c
> deleted file mode 100644
> index 2f46cdb..0000000
> --- a/testcases/commands/ade/ldd/lddfile5.c
> +++ /dev/null
> @@ -1,5 +0,0 @@
> -#include <stdio.h>
> -void file5()
> -{
> - printf("Control in function %s\n", __func__);
> -}
> diff --git a/testcases/commands/ade/ldd/main.c b/testcases/commands/ade/ldd/main.c
> deleted file mode 100644
> index 0f23b8b..0000000
> --- a/testcases/commands/ade/ldd/main.c
> +++ /dev/null
> @@ -1,18 +0,0 @@
> -#include <stdio.h>
> -
> -void file1();
> -void file2();
> -void file3();
> -void file4();
> -void file5();
> -
> -int main()
> -{
> - file1();
> - file2();
> - file3();
> - file4();
> - file5();
> - printf("All Functions Executed\n");
> - return 0;
> -}
> --
> 1.7.1
>
>
> ------------------------------------------------------------------------------
> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH v2] ldd01: remove all -m32/-m64 logic
[not found] ` <225320409.2008145.1412168278476.JavaMail.zimbra@redhat.com>
@ 2014-10-01 13:25 ` Cyril Hrubis
0 siblings, 0 replies; 3+ messages in thread
From: Cyril Hrubis @ 2014-10-01 13:25 UTC (permalink / raw)
To: Jan Stancek; +Cc: ltp-list
Hi!
> > Here you are expecting that the testcase is executed with the working
> > directory is LTPROOT, which may not be the case if somebody adds
> > tst_tmpdir to the test. Let's use
> > LD_LIBRARY_PATH="$LTPROOT/datafiles/:$LD_LIBRARY_PATH" instead.
> >
> > Otherwise the auto detection is really nice to have. Maybe we can do
> > this even better and add a LTP_DATAROOT to test.sh which will
> > automatically point to a directory with the datafiles. If we define that
> > datafiles must be stored in subdirectory named 'datafiles' we can just
> > set the variable in test.sh and then do just:
> >
> > export LD_LIBRARY_PATH="$LTP_DATAROOT:$LD_LIBRARY_PATH"
> >
> > in the testcase. What do you think?
>
> I think it's good idea - then we can avoid doing that in every testcase.
> Is this close to what you had in mind?
Yes, a few comments below.
> diff --git a/doc/test-writing-guidelines.txt b/doc/test-writing-guidelines.txt
> index a59fdd9..d157419 100644
> --- a/doc/test-writing-guidelines.txt
> +++ b/doc/test-writing-guidelines.txt
> @@ -181,10 +181,14 @@ IMPORTANT: The runtest files should have one entry per a test. Creating a
> ^^^^^^^^^^^^^^^
>
> If your test needs datafiles to work, these should be generally put into a
> -subdirectory named test name ('TCID' see below) and install it into the
> -'testcases/data/' directory. The datafiles can be accessed as
> -'$LTPROOT/testcases/data/TCID/...'. See
> -'testcases/network/rpc/basic_tests/rpc01/' for example.
> +subdirectory named "datafiles" and installed into the 'testcases/data/$TCID'
> +directory.
> +
> +If your test includes "test.sh" you can use LTP_DATAROOT
> + '$LTP_DATAROOT/...'
> +The datafiles can also be accessed as
> + '$LTPROOT/testcases/data/$TCID/...'
Maybe note here that LTP_DATAROOT is prefered because it works both in
the git checkout as well as after installation.
> +See 'testcases/network/rpc/basic_tests/rpc01/' for example.
>
> NOTE: There may be some convenience interface added later.
This note should be removed because with the LTP_DATAROOT we added
convenient way to get the path to the datafiles.
And ideally we should add similar interface to the C library as well,
but I'm not sure how we should shape the API. Maybe just a const char
*tst_dataroot(void) function that would return pointer to a static
string initialized on frist call and stored in the test library. But I'm
open to anything else if you have a better idea.
> diff --git a/testcases/lib/test.sh b/testcases/lib/test.sh
> index 10282f4..49e3d83 100644
> --- a/testcases/lib/test.sh
> +++ b/testcases/lib/test.sh
> @@ -144,4 +144,8 @@ export TST_TOTAL="$TST_TOTAL"
> # Setup LTPROOT, default to current directory if not set
> if [ -z "$LTPROOT" ]; then
> export LTPROOT="$PWD"
> + export LTP_DATAROOT="$LTPROOT/datafiles"
> +else
> + export LTP_DATAROOT="$LTPROOT/testcases/data/$TCID"
> fi
> +
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-10-01 13:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-24 8:13 [LTP] [PATCH v2] ldd01: remove all -m32/-m64 logic Jan Stancek
2014-09-30 8:49 ` chrubis
[not found] ` <225320409.2008145.1412168278476.JavaMail.zimbra@redhat.com>
2014-10-01 13:25 ` Cyril Hrubis
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.