public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/elfix:elfix-0.3.x commit in: /, tests/gnustack/, tests/, tests/pxtpax/
@ 2011-11-15 19:42 Anthony G. Basile
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony G. Basile @ 2011-11-15 19:42 UTC (permalink / raw
  To: gentoo-commits

commit:     3942fe38eb32df53e481c95b37ad9d127535ab96
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 15 18:43:32 2011 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Nov 15 19:41:52 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=3942fe38

tests/pxtpax: compare file's and process's pax flags

---
 configure.ac                        |   15 ++++++++----
 tests/Makefile.am                   |   29 +------------------------
 tests/{ => gnustack}/Makefile.am    |    0
 tests/{ => gnustack}/bad-gnustack.c |    0
 tests/{ => gnustack}/bad32.asm      |    0
 tests/{ => gnustack}/bad64.asm      |    0
 tests/pxtpax/Makefile               |   15 +++++++++++++
 tests/pxtpax/Makefile.am            |    7 ++++++
 tests/pxtpax/daemon.c               |   20 +++++++++++++++++
 tests/pxtpax/init.sh                |   40 +++++++++++++++++++++++++++++++++++
 tests/pxtpax/test.sh                |   30 ++++++++++++++++++++++++++
 11 files changed, 123 insertions(+), 33 deletions(-)

diff --git a/configure.ac b/configure.ac
index 044a1da..42c86b6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -49,10 +49,15 @@ AC_TYPE_UINT16_T
 # Checks for library functions.
 AC_FUNC_ERROR_AT_LINE
 
-AC_CONFIG_FILES([Makefile
-                 src/Makefile
-                 scripts/Makefile
-                 doc/Makefile
-                 tests/Makefile])
+AC_CONFIG_FILES([
+	Makefile
+	src/Makefile
+	scripts/Makefile
+	doc/Makefile
+	tests/Makefile
+	tests/gnustack/Makefile
+	tests/gnustack/Makefile
+	tests/pxtpax/Makefile
+])
 
 AC_OUTPUT

diff --git a/tests/Makefile.am b/tests/Makefile.am
index b0b054f..9744798 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,28 +1 @@
-noinst_PROGRAMS = bad-gnustack
-bad_gnustack_SOURCES = bad-gnustack.c
-bad_gnustack_DEPENDENCIES = bad-asm.o
-bad_gnustack_LDADD = bad-asm.o
-
-EXTRA_DIST = bad64.asm bad32.asm
-
-ARCH = $(shell uname -m | sed -e 's/i./x/')
-
-bad-asm.o: bad64.asm bad32.asm
-	[[ "$(ARCH)" == "x86" ]] && yasm -f elf -m x86 bad32.asm && mv bad32.o bad-asm.o || true
-	[[ "$(ARCH)" == "x86_64" ]] && yasm -f elf -m amd64 bad64.asm && mv bad64.o bad-asm.o || true
-
-check_SCRIPTS = test.sh
-TEST = $(check_SCRIPTS)
-
-test.sh:
-	@echo "================================================================================"
-	@echo
-	@echo "Fixing Bad GNU_STACK Elf"
-	@../src/fix-gnustack -f bad-gnustack
-	@echo
-	@echo "Fixed Bad GNU_STACK Elf"
-	@../src/fix-gnustack bad-gnustack
-	@echo
-	@echo "================================================================================"
-
-CLEANFILES = bad-asm.o test.sh
+SUBDIRS = gnustack xtpax

diff --git a/tests/Makefile.am b/tests/gnustack/Makefile.am
similarity index 100%
copy from tests/Makefile.am
copy to tests/gnustack/Makefile.am

diff --git a/tests/bad-gnustack.c b/tests/gnustack/bad-gnustack.c
similarity index 100%
rename from tests/bad-gnustack.c
rename to tests/gnustack/bad-gnustack.c

diff --git a/tests/bad32.asm b/tests/gnustack/bad32.asm
similarity index 100%
rename from tests/bad32.asm
rename to tests/gnustack/bad32.asm

diff --git a/tests/bad64.asm b/tests/gnustack/bad64.asm
similarity index 100%
rename from tests/bad64.asm
rename to tests/gnustack/bad64.asm

diff --git a/tests/pxtpax/Makefile b/tests/pxtpax/Makefile
new file mode 100644
index 0000000..bc2845b
--- /dev/null
+++ b/tests/pxtpax/Makefile
@@ -0,0 +1,15 @@
+
+.PHONY: all
+all: test
+
+.PHONY: test
+test: daemon init.sh test.sh
+	@echo "xattr  process"
+	@$(PWD)/test.sh
+
+daemon:	daemon.c
+	gcc -o $@ $^
+	paxctl-ng -cv $@
+
+clean:
+	rm -f daemon daemon.pid

diff --git a/tests/pxtpax/Makefile.am b/tests/pxtpax/Makefile.am
new file mode 100644
index 0000000..4770a08
--- /dev/null
+++ b/tests/pxtpax/Makefile.am
@@ -0,0 +1,7 @@
+noinst_PROGRAMS = daemon
+daemon_SOURCES = daemon.c
+
+EXTRA_DIST = init.sh  test.sh
+
+check_SCRIPTS = test.sh
+TEST = $(check_SCRIPTS)

diff --git a/tests/pxtpax/daemon.c b/tests/pxtpax/daemon.c
new file mode 100644
index 0000000..3459db9
--- /dev/null
+++ b/tests/pxtpax/daemon.c
@@ -0,0 +1,20 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+int main()
+{
+	pid_t p = fork();
+
+	if(p)
+		printf("%d\n", p);
+	else
+	{
+		close(STDIN_FILENO);
+		close(STDOUT_FILENO);
+		close(STDERR_FILENO);
+		for(;;) sleep(1);
+	}
+
+	exit(0) ;
+}

diff --git a/tests/pxtpax/init.sh b/tests/pxtpax/init.sh
new file mode 100755
index 0000000..4013b29
--- /dev/null
+++ b/tests/pxtpax/init.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+PATH=/sbin:/bin
+
+PWD=$(pwd)
+DAEMON="${PWD}"/daemon
+PIDFILE="${PWD}"/daemon.pid
+
+start()
+{
+	rm -f ${PIDFILE}
+	if [ -e ${DAEMON} ]
+	then
+		PID=$(${DAEMON})
+		if [ "x${PID}" != "x" ]
+		then
+			echo $PID  >> ${PIDFILE}
+		fi
+	else
+		echo "No daemon"
+	fi
+}
+
+stop()
+{
+	kill $(cat ${PIDFILE})
+	rm -f ${PIDFILE}
+}
+
+case "$1" in
+	start)
+		start
+		;;
+	stop)
+		stop
+		;;
+	*)
+		echo "Usage: $0 start | stop"
+		;;
+esac

diff --git a/tests/pxtpax/test.sh b/tests/pxtpax/test.sh
new file mode 100755
index 0000000..6db0e4d
--- /dev/null
+++ b/tests/pxtpax/test.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+PWD=$(pwd)
+INITSH="${PWD}"/init.sh
+DAEMON="${PWD}"/daemon
+PIDFILE="${PWD}"/daemon.pid
+
+paxctl-ng -cv ${DAEMON}
+
+for pf in "p" "P"; do
+  for ef in "e" "E"; do
+    for mf in "m" "M"; do
+      for rf in "r" "R"; do
+        for sf in "s" "S"; do
+          flags="${pf}${ef}${mf}${rf}${sf}"
+          echo -n ${flags} " "
+          paxctl-ng -"${flags}" ${DAEMON} 2>&1 1>/dev/null
+          ${INITSH} start
+          if [ -f "${PIDFILE}" ]
+          then
+            rflags=$(cat /proc/$(cat ${PIDFILE})/status | grep ^PaX | awk '{ print $2 }')
+            echo -n ${rflags}
+            ${INITSH} stop
+          fi
+          echo
+        done
+      done
+    done
+  done
+done



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] proj/elfix:elfix-0.3.x commit in: /, tests/gnustack/, tests/, tests/pxtpax/
@ 2011-11-15 19:42 Anthony G. Basile
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony G. Basile @ 2011-11-15 19:42 UTC (permalink / raw
  To: gentoo-commits

commit:     02b921e118783ab4b00a412d94a20d476a5ff15e
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 15 19:25:18 2011 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Nov 15 19:42:25 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=02b921e1

Fix some bugs in tests/*

---
 configure.ac                        |    1 -
 tests/Makefile.am                   |    2 +-
 tests/gnustack/Makefile.am          |    4 ++--
 tests/pxtpax/Makefile               |   15 ---------------
 tests/pxtpax/Makefile.am            |    7 ++++++-
 tests/pxtpax/{test.sh => dotest.sh} |    8 ++++++--
 6 files changed, 15 insertions(+), 22 deletions(-)

diff --git a/configure.ac b/configure.ac
index 42c86b6..9ccd9a0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -56,7 +56,6 @@ AC_CONFIG_FILES([
 	doc/Makefile
 	tests/Makefile
 	tests/gnustack/Makefile
-	tests/gnustack/Makefile
 	tests/pxtpax/Makefile
 ])
 

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9744798..d1becd2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1 +1 @@
-SUBDIRS = gnustack xtpax
+SUBDIRS = gnustack pxtpax

diff --git a/tests/gnustack/Makefile.am b/tests/gnustack/Makefile.am
index b0b054f..af11d60 100644
--- a/tests/gnustack/Makefile.am
+++ b/tests/gnustack/Makefile.am
@@ -18,10 +18,10 @@ test.sh:
 	@echo "================================================================================"
 	@echo
 	@echo "Fixing Bad GNU_STACK Elf"
-	@../src/fix-gnustack -f bad-gnustack
+	@../../src/fix-gnustack -f bad-gnustack
 	@echo
 	@echo "Fixed Bad GNU_STACK Elf"
-	@../src/fix-gnustack bad-gnustack
+	@../../src/fix-gnustack bad-gnustack
 	@echo
 	@echo "================================================================================"
 

diff --git a/tests/pxtpax/Makefile b/tests/pxtpax/Makefile
deleted file mode 100644
index bc2845b..0000000
--- a/tests/pxtpax/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-
-.PHONY: all
-all: test
-
-.PHONY: test
-test: daemon init.sh test.sh
-	@echo "xattr  process"
-	@$(PWD)/test.sh
-
-daemon:	daemon.c
-	gcc -o $@ $^
-	paxctl-ng -cv $@
-
-clean:
-	rm -f daemon daemon.pid

diff --git a/tests/pxtpax/Makefile.am b/tests/pxtpax/Makefile.am
index 4770a08..55f9957 100644
--- a/tests/pxtpax/Makefile.am
+++ b/tests/pxtpax/Makefile.am
@@ -1,7 +1,12 @@
 noinst_PROGRAMS = daemon
 daemon_SOURCES = daemon.c
 
-EXTRA_DIST = init.sh  test.sh
+EXTRA_DIST = init.sh dotest.sh
 
 check_SCRIPTS = test.sh
 TEST = $(check_SCRIPTS)
+
+test.sh:
+	./dotest.sh
+
+CLEANFILES = daemon.pid

diff --git a/tests/pxtpax/test.sh b/tests/pxtpax/dotest.sh
similarity index 74%
rename from tests/pxtpax/test.sh
rename to tests/pxtpax/dotest.sh
index 6db0e4d..1003d0a 100755
--- a/tests/pxtpax/test.sh
+++ b/tests/pxtpax/dotest.sh
@@ -4,9 +4,11 @@ PWD=$(pwd)
 INITSH="${PWD}"/init.sh
 DAEMON="${PWD}"/daemon
 PIDFILE="${PWD}"/daemon.pid
+PAXCTLNG="../../src/paxctl-ng"
 
-paxctl-ng -cv ${DAEMON}
+${PAXCTLNG} -cv ${DAEMON} 2>&1 1>/dev/null
 
+echo "xattr  process"
 for pf in "p" "P"; do
   for ef in "e" "E"; do
     for mf in "m" "M"; do
@@ -14,13 +16,15 @@ for pf in "p" "P"; do
         for sf in "s" "S"; do
           flags="${pf}${ef}${mf}${rf}${sf}"
           echo -n ${flags} " "
-          paxctl-ng -"${flags}" ${DAEMON} 2>&1 1>/dev/null
+          ${PAXCTLNG} -"${flags}" ${DAEMON} 2>&1 1>/dev/null
           ${INITSH} start
           if [ -f "${PIDFILE}" ]
           then
             rflags=$(cat /proc/$(cat ${PIDFILE})/status | grep ^PaX | awk '{ print $2 }')
             echo -n ${rflags}
             ${INITSH} stop
+          else
+            echo -n "no daemon"
           fi
           echo
         done



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-11-15 19:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-15 19:42 [gentoo-commits] proj/elfix:elfix-0.3.x commit in: /, tests/gnustack/, tests/, tests/pxtpax/ Anthony G. Basile
  -- strict thread matches above, loose matches on Subject: below --
2011-11-15 19:42 Anthony G. Basile

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox