From ac5bf544b00ecb19a6c33016ab9ffe0ca8cd8594 Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Wed, 28 Oct 2009 22:12:14 -0700 Subject: [PATCH] Test for --embedded mode. --- Demos/embed/Makefile | 16 ++++++++++------ Demos/embed/assert_equal.py | 6 ++++++ Demos/embed/embedded.output | 2 ++ 3 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 Demos/embed/assert_equal.py create mode 100644 Demos/embed/embedded.output diff --git a/Demos/embed/Makefile b/Demos/embed/Makefile index 1356f9a2..4a5209e1 100644 --- a/Demos/embed/Makefile +++ b/Demos/embed/Makefile @@ -1,19 +1,23 @@ # Makefile for creating our standalone Cython program -PYVERSION=2.3 -PYPREFIX=/usr +PYVERSION=$(shell python -c "import sys; print sys.version[:3]") +PYPREFIX=$(shell python -c "import sys; print sys.prefix") INCLUDES=-I$(PYPREFIX)/include/python$(PYVERSION) - + embedded: embedded.o - gcc -o $@ $^ -lpython$(PYVERSION) + gcc -o $@ $^ -lpython$(PYVERSION) embedded.o: embedded.c - gcc -c $^ $(INCLUDES) + gcc -c $^ $(INCLUDES) embedded.c: embedded.pyx - @python ../../cython.py --embed embedded.pyx + @python ../../cython.py --embed embedded.pyx all: embedded clean: @echo Cleaning Demos/embed @rm -f *~ *.o *.so core core.* *.c embedded + +test: clean all + ./embedded > test.output + python assert_equal.py embedded.output test.output diff --git a/Demos/embed/assert_equal.py b/Demos/embed/assert_equal.py new file mode 100644 index 00000000..dfb42c56 --- /dev/null +++ b/Demos/embed/assert_equal.py @@ -0,0 +1,6 @@ +import sys +if open(sys.argv[1]).read() != open(sys.argv[2]).read(): + print "Files differ" + sys.exit(1) +else: + print "Files identical" diff --git a/Demos/embed/embedded.output b/Demos/embed/embedded.output new file mode 100644 index 00000000..6b27debd --- /dev/null +++ b/Demos/embed/embedded.output @@ -0,0 +1,2 @@ +__main__ +Hi, I'm embedded. -- 2.26.2