|
From: <sv...@va...> - 2013-05-10 13:15:05
|
petarj 2013-05-10 14:14:54 +0100 (Fri, 10 May 2013)
New Revision: 13385
Log:
mips: add allexec tests for mips64
Initial patch for none/tests/mips64/.
allexec tests added.
Added directories:
trunk/none/tests/mips64/
Added files:
trunk/none/tests/mips64/Makefile.am
trunk/none/tests/mips64/allexec.c
trunk/none/tests/mips64/filter_stderr
Modified files:
trunk/configure.in
trunk/none/tests/Makefile.am
trunk/none/tests/allexec_prepare_prereq
Added: trunk/none/tests/mips64/
Modified: trunk/none/tests/Makefile.am (+5 -1)
===================================================================
--- trunk/none/tests/Makefile.am 2013-05-09 22:29:23 +01:00 (rev 13384)
+++ trunk/none/tests/Makefile.am 2013-05-10 14:14:54 +01:00 (rev 13385)
@@ -25,6 +25,9 @@
if VGCONF_ARCHS_INCLUDE_MIPS32
SUBDIRS += mips32
endif
+if VGCONF_ARCHS_INCLUDE_MIPS64
+SUBDIRS += mips64
+endif
# OS-specific tests
if VGCONF_OS_IS_LINUX
@@ -39,7 +42,8 @@
SUBDIRS += x86-linux
endif
-DIST_SUBDIRS = x86 amd64 ppc32 ppc64 arm s390x mips32 linux darwin x86-linux .
+DIST_SUBDIRS = x86 amd64 ppc32 ppc64 arm s390x mips32 mips64 linux darwin \
+ x86-linux .
dist_noinst_SCRIPTS = \
filter_cmdline0 \
Property changed: trunk/none/tests/mips64/filter_stderr (+0 -0)
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/none/tests/mips64/filter_stderr (+4 -0)
===================================================================
--- trunk/none/tests/mips64/filter_stderr 2013-05-09 22:29:23 +01:00 (rev 13384)
+++ trunk/none/tests/mips64/filter_stderr 2013-05-10 14:14:54 +01:00 (rev 13385)
@@ -0,0 +1,4 @@
+#! /bin/sh
+
+../filter_stderr
+
Added: trunk/none/tests/mips64/allexec.c (+50 -0)
===================================================================
--- trunk/none/tests/mips64/allexec.c 2013-05-09 22:29:23 +01:00 (rev 13384)
+++ trunk/none/tests/mips64/allexec.c 2013-05-10 14:14:54 +01:00 (rev 13385)
@@ -0,0 +1,50 @@
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+
+extern char **environ;
+
+#define S(...) (fprintf(stdout, __VA_ARGS__),fflush(stdout))
+#define FORKEXECWAIT(exec_call) do { \
+ int status;\
+ pid_t child = fork(); \
+ if (child == 0) {exec_call; perror ("exec failed");} \
+ else if (child == -1) perror ("cannot fork\n"); \
+ else if (child != wait (&status)) perror ("error waiting child"); \
+ else S("child exited\n"); \
+ } while (0)
+
+void test_allexec (char *exec)
+{
+ FORKEXECWAIT (execlp(exec, exec, NULL));
+ FORKEXECWAIT (execlp(exec, exec, "constant_arg1", "constant_arg2", NULL));
+ FORKEXECWAIT (execve(exec, NULL, environ));
+}
+
+
+/* If a single argument "exec" is given, will execute itself
+ (in bi-arch, a 32 bit and 64 bit variant) via various exec system calls.
+ Note that this test can only be run after the prerequisite have been
+ prepared by allexec_prepare_prereq, which will a.o. make links
+ for the allexec32 and allexec64 executables. On single arch build,
+ these links points to the same executable to ensure this test works
+ everywhere the same.
+ No arguments or more arguments means just print its args. */
+int main(int argc, char **argv, char **envp)
+{
+ if ( (argc == 2) && (strcmp (argv[1], "exec") == 0)) {
+ S("%s will exec ./allexec32\n", argv[0]);
+ test_allexec ("./allexec32");
+ S("%s will exec ./allexec64\n", argv[0]);
+ test_allexec ("./allexec64");
+ } else {
+ int i;
+ S("program exec-ed:");
+ for (i = 0; i < argc; i++) S(" %s", argv[i]);
+ S("\n");
+ }
+ return 0;
+}
Modified: trunk/none/tests/allexec_prepare_prereq (+1 -1)
===================================================================
--- trunk/none/tests/allexec_prepare_prereq 2013-05-09 22:29:23 +01:00 (rev 13384)
+++ trunk/none/tests/allexec_prepare_prereq 2013-05-10 14:14:54 +01:00 (rev 13385)
@@ -32,6 +32,6 @@
pair ppc32 ppc64
pair s390x_unexisting_in_32bits s390x
pair arm arm_unexisting_in_64bits
-pair mips32 mips_unexisting_in_64bits
+pair mips32 mips64
exit 0
Added: trunk/none/tests/mips64/Makefile.am (+14 -0)
===================================================================
--- trunk/none/tests/mips64/Makefile.am 2013-05-09 22:29:23 +01:00 (rev 13384)
+++ trunk/none/tests/mips64/Makefile.am 2013-05-10 14:14:54 +01:00 (rev 13385)
@@ -0,0 +1,14 @@
+
+include $(top_srcdir)/Makefile.tool-tests.am
+
+dist_noinst_SCRIPTS = filter_stderr
+
+check_PROGRAMS = \
+ allexec
+
+AM_CFLAGS += @FLAG_M64@
+AM_CXXFLAGS += @FLAG_M64@
+AM_CCASFLAGS += @FLAG_M64@
+
+allexec_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_NONNULL@
+
Modified: trunk/configure.in (+1 -0)
===================================================================
--- trunk/configure.in 2013-05-09 22:29:23 +01:00 (rev 13384)
+++ trunk/configure.in 2013-05-10 14:14:54 +01:00 (rev 13385)
@@ -2662,6 +2662,7 @@
none/tests/arm/Makefile
none/tests/s390x/Makefile
none/tests/mips32/Makefile
+ none/tests/mips64/Makefile
none/tests/linux/Makefile
none/tests/darwin/Makefile
none/tests/x86-linux/Makefile
|