Index: tests/python_tests/Makefile
===================================================================
--- tests/python_tests/Makefile	(revision ec550f769c681cfa831dc724f82ddacd21fc75cd)
+++ tests/python_tests/Makefile	(revision 3c30b595cd3f27758e8966a9935589bdb92486d5)
@@ -1,30 +1,459 @@
-
-DIRECTORY= acme_rockets_intersection_rt0 basic_attribute experiment_create_rt0 acme_rockets_rt0 basic_id         
-
-.PHONY : setup runcheck clean 
-runcheck: $(DIRECTORY)
-
-clean:
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# tests/python_tests/Makefile.  Generated from Makefile.in by configure.
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+
+#
+# python_tests
+#
+
+pkgdatadir = $(datadir)/abac
+pkgincludedir = $(includedir)/abac
+pkglibdir = $(libdir)/abac
+pkglibexecdir = $(libexecdir)/abac
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = i686-pc-linux-gnu
+host_triplet = i686-pc-linux-gnu
+subdir = tests/python_tests
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_openssl.m4 \
+	$(top_srcdir)/m4/ax_check_xml2.m4 \
+	$(top_srcdir)/m4/ax_check_xmlsec1.m4 \
+	$(top_srcdir)/m4/ax_pkg_swig.m4 \
+	$(top_srcdir)/m4/ax_python_devel.m4 \
+	$(top_srcdir)/m4/ax_swig_enable_cxx.m4 \
+	$(top_srcdir)/m4/ax_swig_python.m4 $(top_srcdir)/m4/libtool.m4 \
+	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = ${SHELL} /home/mei/Deter/abac0-master/missing --run aclocal-1.11
+AMTAR = ${SHELL} /home/mei/Deter/abac0-master/missing --run tar
+AR = ar
+AUTOCONF = ${SHELL} /home/mei/Deter/abac0-master/missing --run autoconf
+AUTOHEADER = ${SHELL} /home/mei/Deter/abac0-master/missing --run autoheader
+AUTOMAKE = ${SHELL} /home/mei/Deter/abac0-master/missing --run automake-1.11
+AWK = gawk
+AX_SWIG_PYTHON_CPPFLAGS = -I/usr/local/include/python2.7
+AX_SWIG_PYTHON_OPT = -python
+CC = gcc
+CCDEPMODE = depmode=gcc3
+CFLAGS = -g -O2
+CPP = gcc -E
+CPPFLAGS = 
+CXX = g++
+CXXCPP = g++ -E
+CXXDEPMODE = depmode=gcc3
+CXXFLAGS = -g -O2
+CYGPATH_W = echo
+DEFS = -DPACKAGE_NAME=\"ABAC\" -DPACKAGE_TARNAME=\"abac\" -DPACKAGE_VERSION=\"0.1.5\" -DPACKAGE_STRING=\"ABAC\ 0.1.5\" -DPACKAGE_BUGREPORT=\"faber@ISI.EDU\" -DPACKAGE_URL=\"\" -DPACKAGE=\"abac\" -DVERSION=\"0.1.5\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_PYTHON=\"2.7\" -DHAVE_INTTYPES_H=1 -DHAVE_STDDEF_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_PATHS_H=1 -DHAVE__BOOL=1 -DHAVE_STDBOOL_H=1 -DHAVE_PTRDIFF_T=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_ATEXIT=1 -DHAVE_MEMSET=1 -DHAVE_STRCHR=1 -DHAVE_STRDUP=1
+DEPDIR = .deps
+DSYMUTIL = 
+DUMPBIN = 
+ECHO_C = 
+ECHO_N = -n
+ECHO_T = 
+EGREP = /bin/grep -E
+EXEEXT = 
+FGREP = /bin/grep -F
+GREP = /bin/grep
+INSTALL = /usr/bin/install -c
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
+LD = /usr/bin/ld
+LDFLAGS = 
+LIBOBJS = 
+LIBS = 
+LIBTOOL = $(SHELL) $(top_builddir)/libtool
+LIPO = 
+LN_S = ln -s
+LTLIBOBJS = 
+MAKEINFO = ${SHELL} /home/mei/Deter/abac0-master/missing --run makeinfo
+MKDIR_P = /bin/mkdir -p
+NM = /usr/bin/nm -B
+NMEDIT = 
+OBJDUMP = objdump
+OBJEXT = o
+OPENSSL_INCLUDES =  
+OPENSSL_LDFLAGS =  
+OPENSSL_LIBS = -lssl -lcrypto  
+OTOOL = 
+OTOOL64 = 
+PACKAGE = abac
+PACKAGE_BUGREPORT = faber@ISI.EDU
+PACKAGE_NAME = ABAC
+PACKAGE_STRING = ABAC 0.1.5
+PACKAGE_TARNAME = abac
+PACKAGE_URL = 
+PACKAGE_VERSION = 0.1.5
+PATH_SEPARATOR = :
+PERL = perl
+PKG_CONFIG = /usr/bin/pkg-config
+PYTHON = /usr/local/bin/python
+PYTHON_CPPFLAGS = -I/usr/local/include/python2.7
+PYTHON_EXEC_PREFIX = ${exec_prefix}
+PYTHON_EXTRA_LDFLAGS = -Xlinker -export-dynamic
+PYTHON_EXTRA_LIBS =  -lpthread -ldl  -lutil -lm
+PYTHON_LDFLAGS = -L/usr/local/lib/python2.7/config -lpython2.7
+PYTHON_PLATFORM = linux2
+PYTHON_PREFIX = ${prefix}
+PYTHON_SITE_PKG = /usr/local/lib/python2.7/site-packages
+PYTHON_VERSION = 2.7
+RANLIB = ranlib
+SED = /bin/sed
+SET_MAKE = 
+SHELL = /bin/bash
+SITE_PERL = /usr/local/lib/site_perl
+STRIP = strip
+SWIG = /usr/local/bin/swig -c++
+SWIG_LIB = /usr/local/share/swig/2.0.4
+VERSION = 0.1.5
+XML2_CONFIG = /usr/bin/xml2-config
+XML2_INCLUDES = -I/usr/include/libxml2
+XML2_LDFLAGS = -lxml2
+XML2_LIBS = -lxml2
+XMLSEC1_CONFIG = /usr/bin/xmlsec1-config
+XMLSEC1_INCLUDES = -D__XMLSEC_FUNCTION__=__FUNCTION__ -DXMLSEC_NO_GOST=1 -DXMLSEC_NO_XKMS=1 -DXMLSEC_NO_CRYPTO_DYNAMIC_LOADING=1 -I/usr/include/xmlsec1 -I/usr/include/libxml2 -DXMLSEC_OPENSSL_098=1 -DXMLSEC_CRYPTO_OPENSSL=1 -DXMLSEC_CRYPTO=\"openssl\"
+XMLSEC1_LDFLAGS = -L/usr/lib -lxmlsec1-openssl -lxmlsec1 -lxslt -lxml2 -lssl -lcrypto
+XMLSEC1_LIBS = -L/usr/lib -lxmlsec1-openssl -lxmlsec1 -lxslt -lxml2 -lssl -lcrypto
+abs_builddir = /home/mei/Deter/abac0-master/tests/python_tests
+abs_srcdir = /home/mei/Deter/abac0-master/tests/python_tests
+abs_top_builddir = /home/mei/Deter/abac0-master
+abs_top_srcdir = /home/mei/Deter/abac0-master
+ac_ct_CC = gcc
+ac_ct_CXX = g++
+ac_ct_DUMPBIN = 
+am__include = include
+am__leading_dot = .
+am__quote = 
+am__tar = ${AMTAR} chof - "$$tardir"
+am__untar = ${AMTAR} xf -
+bindir = ${exec_prefix}/bin
+build = i686-pc-linux-gnu
+build_alias = 
+build_cpu = i686
+build_os = linux-gnu
+build_vendor = pc
+builddir = .
+datadir = ${datarootdir}
+datarootdir = ${prefix}/share
+docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
+dvidir = ${docdir}
+exec_prefix = ${prefix}
+host = i686-pc-linux-gnu
+host_alias = 
+host_cpu = i686
+host_os = linux-gnu
+host_vendor = pc
+htmldir = ${docdir}
+includedir = ${prefix}/include
+infodir = ${datarootdir}/info
+install_sh = ${SHELL} /home/mei/Deter/abac0-master/install-sh
+libdir = ${exec_prefix}/lib
+libexecdir = ${exec_prefix}/libexec
+localedir = ${datarootdir}/locale
+localstatedir = ${prefix}/var
+lt_ECHO = echo
+mandir = ${datarootdir}/man
+mkdir_p = /bin/mkdir -p
+oldincludedir = /usr/include
+pdfdir = ${docdir}
+pkgpyexecdir = ${pyexecdir}/abac
+pkgpythondir = ${pythondir}/abac
+prefix = /usr/local
+program_transform_name = s,x,x,
+psdir = ${docdir}
+pyexecdir = ${exec_prefix}/lib/python2.7/site-packages
+pythondir = ${prefix}/lib/python2.7/site-packages
+sbindir = ${exec_prefix}/sbin
+sharedstatedir = ${prefix}/com
+srcdir = .
+sysconfdir = ${prefix}/etc
+target_alias = 
+top_build_prefix = ../../
+top_builddir = ../..
+top_srcdir = ../..
+INCLUDES = -I$(abs_top_srcdir)/libabac
+LDADD = $(abs_top_builddir)/libabac/libabac.la
+CREDDY_ENV = CREDDY_LOCATION=$(abs_top_builddir)/creddy
+PROVER_ENV = PROVER_LOCATION=$(abs_top_builddir)/libabac
+TEST_ENV = TESTDIR=$(abs_top_builddir)/tests
+PYTHON_ENV = PYTHONPATH=$(abs_top_builddir)/swig/python:$(abs_top_builddir)/swig/python/.libs:$(abs_top_builddir)/tests
+MY_ENV = env $(CREDDY_ENV) $(PROVER_ENV) $(TEST_ENV) $(PYTHON_ENV)
+DIRECTORY = acme_rockets_intersection_rt0 acme_rockets_rt0 experiment_create_rt0
+OTHER = basic_attribute basic_id 
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/python_tests/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign tests/python_tests/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean-am: clean-generic clean-libtool clean-local mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	clean-local distclean distclean-generic distclean-libtool \
+	distdir dvi dvi-am html html-am info info-am install \
+	install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	uninstall uninstall-am
+
+
+.PHONY : clean-local runcheck clean
+all: runcheck
+
+clean :
 	@for i in $(DIRECTORY); do \
-	here=`pwd`; \
-	cd $$i; \
-	rm -rf *.xml *.pem *.out *.log; \
-	cd $$here; \
-	done 
-	@rm -rf result
-
-runcheck: 
-	@echo 'running libabac PYTHON testing...' 
-	@rm -rf result
+	  here=`pwd`; \
+	  cd $$i; \
+	  rm -rf *.pem *.xml; \
+	  cd $$here; \
+        done
+	@(cd basic_id; rm -rf *.pem *.xml)
+	@(cd basic_attribute; rm -rf *.pem *.xml)
+	@rm -rf result error
+
+runcheck :
+	@touch error
+	@echo 'running libabac PYTHON testing...' | tee result
+	@make clean
 	@for i in $(DIRECTORY); do \
-	here=`pwd`; \
-	cd $$i; \
-	printf "\n ==> RUN on %s\n" "$$i" >> ../result; \
-	./run_test >> ../result 2>/dev/null; \
-	cd $$here; \
-	done
-	@if test -f result && test `cat result|wc -c` -eq 444 ; \
-	then echo "   PASSED"; \
-	else echo "   ERROR:got changes!!!"; \
+	  here=`pwd`; \
+	  cd $$i; \
+	  printf "\n ==> RUN on %s\n" "$$i" >> $$here/result ; \
+	  $(MY_ENV) ./setup.py 1>/dev/null 2>&1; \
+	  $(MY_ENV) ./attr.py 1>/dev/null 2>&1; \
+	  $(MY_ENV) ./query.py |tee -a $$here/result |grep BAD >> $$here/error; \
+	  cd $$here; \
+        done
+	make ids
+	make attrs
+	@if test -f error ; \
+	  then \
+	    (if test `cat error | wc -l ` -eq 0 ; \
+	      then echo "   PASSED"; \
+	      else (echo "   ERROR!!!"; cat error;) \
+	    fi) \
+	  else echo "   PASSED"; \
 	fi
 
+ids:
+	@printf "\n ==> RUN on basic_id\n" >> result
+	@(cd basic_id; \
+	$(MY_ENV) ./setup.py 1>/dev/null 2>&1; \
+	$(MY_ENV) ./query.py |tee -a ../result |grep BAD >> ../error; \
+	cd ..)
+
+attrs:
+	@printf "\n ==> RUN on basic_attr\n" >> result
+	@(cd basic_attribute; \
+	$(MY_ENV) ./setup.py 1>/dev/null 2>&1; \
+	$(MY_ENV) ./query.py |tee -a ../result |grep BAD >> ../error; \
+	cd ..)
+
+clean-local: 
+	@rm -rf result error
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
Index: tests/python_tests/Makefile.am
===================================================================
--- tests/python_tests/Makefile.am	(revision 3c30b595cd3f27758e8966a9935589bdb92486d5)
+++ tests/python_tests/Makefile.am	(revision 3c30b595cd3f27758e8966a9935589bdb92486d5)
@@ -0,0 +1,69 @@
+#
+# python_tests
+#
+
+INCLUDES = -I$(abs_top_srcdir)/libabac
+LDADD = $(abs_top_builddir)/libabac/libabac.la
+CREDDY_ENV = CREDDY_LOCATION=$(abs_top_builddir)/creddy
+PROVER_ENV = PROVER_LOCATION=$(abs_top_builddir)/libabac
+TEST_ENV = TESTDIR=$(abs_top_builddir)/tests
+PYTHON_ENV = PYTHONPATH=$(abs_top_builddir)/swig/python:$(abs_top_builddir)/swig/python/.libs:$(abs_top_builddir)/tests
+MY_ENV = env $(CREDDY_ENV) $(PROVER_ENV) $(TEST_ENV) $(PYTHON_ENV)
+
+DIRECTORY= acme_rockets_intersection_rt0 acme_rockets_rt0 experiment_create_rt0
+OTHER=basic_attribute basic_id 
+
+.PHONY : clean-local runcheck clean
+all: runcheck
+
+clean :
+	@for i in $(DIRECTORY); do \
+	  here=`pwd`; \
+	  cd $$i; \
+	  rm -rf *.pem *.xml; \
+	  cd $$here; \
+        done
+	@(cd basic_id; rm -rf *.pem *.xml)
+	@(cd basic_attribute; rm -rf *.pem *.xml)
+	@rm -rf result error
+
+runcheck :
+	@touch error
+	@echo 'running libabac PYTHON testing...' | tee result
+	@make clean
+	@for i in $(DIRECTORY); do \
+	  here=`pwd`; \
+	  cd $$i; \
+	  printf "\n ==> RUN on %s\n" "$$i" >> $$here/result ; \
+	  $(MY_ENV) ./setup.py 1>/dev/null 2>&1; \
+	  $(MY_ENV) ./attr.py 1>/dev/null 2>&1; \
+	  $(MY_ENV) ./query.py |tee -a $$here/result |grep BAD >> $$here/error; \
+	  cd $$here; \
+        done
+	make ids
+	make attrs
+	@if test -f error ; \
+	  then \
+	    (if test `cat error | wc -l ` -eq 0 ; \
+	      then echo "   PASSED"; \
+	      else (echo "   ERROR!!!"; cat error;) \
+	    fi) \
+	  else echo "   PASSED"; \
+	fi
+
+ids:
+	@printf "\n ==> RUN on basic_id\n" >> result
+	@(cd basic_id; \
+	$(MY_ENV) ./setup.py 1>/dev/null 2>&1; \
+	$(MY_ENV) ./query.py |tee -a ../result |grep BAD >> ../error; \
+	cd ..)
+
+attrs:
+	@printf "\n ==> RUN on basic_attr\n" >> result
+	@(cd basic_attribute; \
+	$(MY_ENV) ./setup.py 1>/dev/null 2>&1; \
+	$(MY_ENV) ./query.py |tee -a ../result |grep BAD >> ../error; \
+	cd ..)
+
+clean-local: 
+	@rm -rf result error
Index: tests/python_tests/acme_rockets_intersection_rt0/query.py
===================================================================
--- tests/python_tests/acme_rockets_intersection_rt0/query.py	(revision ec550f769c681cfa831dc724f82ddacd21fc75cd)
+++ tests/python_tests/acme_rockets_intersection_rt0/query.py	(revision 3c30b595cd3f27758e8966a9935589bdb92486d5)
@@ -9,4 +9,5 @@
 import os
 import ABAC
+from test_util import runTest
 
 ctxt = ABAC.Context()
@@ -18,6 +19,6 @@
     ctxt.load_directory(keystore)
 else:
-    print("keystore is not set...")
-    exit(1)
+    print("keystore is not set, using current directory...")
+    ctxt.load_directory(".")
 
 # retrieve principals' keyid value from local credential files
@@ -50,13 +51,6 @@
 # role = "[keyid:Acme].role:buy_rockets"
 # p = "[keyid:coyote]" 
-
-print "\n===good============ Acme.buy_rockets <- Coyote"
-(success, credentials) = ctxt.query("%s.buy_rockets" % acme, coyote)
-if success:
-    print "success!"
-else:
-    print "failure!"
-for credential in credentials:
-    print "credential %s <- %s" % (credential.head().string(), credential.tail().string())
+print "===good============ Acme.buy_rockets <- Coyote"
+runTest("python_tests/acme_rockets_intersection_rt0","test1",ctxt,"%s.buy_rockets" % acme, coyote, 1, "query in python with intersect")
 
 ##########################################################################
@@ -64,11 +58,6 @@
 # role = "[keyid:Acme].role:buy_rockets"
 # p = "[keyid:batman]" 
+print "===bad============ Acme.buy_rockets <- Batman"
+runTest("python_tests/acme_rockets_intersection_rt0","test2",ctxt,"%s.buy_rockets" % acme, batman, 0, "expected failure, no such relation in db")
 
-print "\n===bad============ Acme.buy_rockets <- Batman"
-(success, credentials) = ctxt.query("%s.buy_rockets" % acme, batman)
-if success:
-    print "success!"
-else:
-    print "failure!"
-for credential in credentials:
-    print "credential %s <- %s" % (credential.head().string(), credential.tail().string())
+
Index: tests/python_tests/acme_rockets_intersection_rt0/run_test
===================================================================
--- tests/python_tests/acme_rockets_intersection_rt0/run_test	(revision ec550f769c681cfa831dc724f82ddacd21fc75cd)
+++ 	(revision )
@@ -1,20 +1,0 @@
-#!/bin/sh 
-
-rm -rf *.pem *.xml *.log *.out
-
-echo '---setup principals'
-./setup.py 1>/dev/null 2>& 1
-
-echo '---setup attributes'
-./attr.py 1>intersect.log 2>& 1
-
-echo '---run queries'
-env keystore=`pwd` ./query.py 1>intersect.out 2>& 1
-
-good=`grep success intersect.out |wc -l`
-bad=`grep failure intersect.out |wc -l`
-if [ $good -eq 1 -a $bad -eq 1 ]; then
-    echo "   PASSED"
-else
-    echo "   ERROR:acme_rockets_intersection_rt0 test result differs!!!"
-fi
Index: tests/python_tests/acme_rockets_rt0/query.py
===================================================================
--- tests/python_tests/acme_rockets_rt0/query.py	(revision ec550f769c681cfa831dc724f82ddacd21fc75cd)
+++ tests/python_tests/acme_rockets_rt0/query.py	(revision 3c30b595cd3f27758e8966a9935589bdb92486d5)
@@ -11,4 +11,6 @@
 import ABAC
 
+from test_util import runTest
+
 ctxt = ABAC.Context()
 
@@ -19,6 +21,6 @@
     ctxt.load_directory(keystore)
 else:
-    print("keystore is not set...")
-    exit(1)
+    print("keystore is not set, using current directory...")
+    ctxt.load_directory(".")
 
 # retrieve principals' keyid value from local credential files
@@ -47,13 +49,6 @@
 # role=[keyid:Acme].role:preferred_customer
 # p =[keyid:coyote]
-
-print "\n===good============ Acme.preferred_customer <- Coyote"
-(success, credentials) = ctxt.query("%s.preferred_customer" % acme, coyote)
-if success:
-    print "success!"
-else:
-    print "failure!"
-for credential in credentials:
-    print "credential %s <- %s" % (credential.head().string(), credential.tail().string())
+print "===good============ Acme.preferred_customer <- Coyote"
+runTest("python_tests/acme_rockets_rt0","test1",ctxt,"%s.preferred_customer" % acme, coyote, 1, "simple single rule matchup")
 
 ##########################################################################
@@ -61,13 +56,6 @@
 # role=[keyid:Acme].role:buy_rockets
 # p =[keyid:coyote]
-
-print "\n===good============ Acme.buy_rockets <- Coyote"
-(success, credentials) = ctxt.query("%s.buy_rockets" % acme, coyote)
-if success:
-    print "success!"
-else:
-    print "failure!"
-for credential in credentials:
-    print "credential %s <- %s" % (credential.head().string(), credential.tail().string())
+print "===good============ Acme.buy_rockets <- Coyote"
+runTest("python_tests/acme_rockets_rt0","test2",ctxt,"%s.buy_rockets" % acme, coyote, 1, "very simplequery")
 
 ##########################################################################
@@ -75,13 +63,6 @@
 # role=[keyid:Coyote].role:friend
 # p=[keyid:Acme] 
-
-print "\n===bad=============== Coyote.friend <- Acme"
-(success, credentials) = ctxt.query("%s.friend" % coyote, acme)
-if success:
-    print "success!"
-else:
-    print "failure!"
-for credential in credentials:
-    print "credential %s <- %s" % (credential.head().string(), credential.tail().string())
+print "===bad=============== Coyote.friend <- Acme"
+runTest("python_tests/acme_rockets_rt0","test3",ctxt,"%s.friend" % coyote, acme, 0, "none existing relation")
 
 ##########################################################################
@@ -89,11 +70,5 @@
 # role=[keyid:Acme].role:buy_rockets 
 # p=[keyid:Acme].role:preferred_customer
+print "===bad?=============== Acme.buy_rockets <- Acme.preferred_customer"
+runTest("python_tests/acme_rockets_rt0","test4",ctxt,"%s.buy_rockets" % acme, "%s.preferred_customer" % acme, 1, "complex role query should fail")
 
-print "\n===bad?=============== Acme.buy_rockets <- Acme.preferred_customer"
-(success, credentials) = ctxt.query("%s.buy_rockets" % acme, "%s.preferred_customer" % acme)
-if success:
-    print "success!"
-else:
-    print "failure!"
-for credential in credentials:
-    print "credential %s <- %s" % (credential.head().string(), credential.tail().string())
Index: tests/python_tests/acme_rockets_rt0/run_test
===================================================================
--- tests/python_tests/acme_rockets_rt0/run_test	(revision ec550f769c681cfa831dc724f82ddacd21fc75cd)
+++ 	(revision )
@@ -1,22 +1,0 @@
-#!/bin/sh 
-
-rm -rf *.pem *.xml *.log *.out
-
-echo '---setup principals'
-./setup.py 1>/dev/null 2>& 1
-
-echo '---setup attributes'
-./attr.py 1>rocket.log 2>& 1
-
-echo '---run queries'
-env keystore=`pwd` ./query.py 1>rocket.out 2>& 1
-
-good=`grep success rocket.out |wc -l`
-bad=`grep failure rocket.out |wc -l`
-if [ $good -eq 3 -a $bad -eq 1 ]; then
-    echo "   PASSED"
-else
-    echo "   ERROR:acme_rockets_rt0 test result differs!!!"
-fi
-
-
Index: tests/python_tests/basic_attribute/README
===================================================================
--- tests/python_tests/basic_attribute/README	(revision ec550f769c681cfa831dc724f82ddacd21fc75cd)
+++ tests/python_tests/basic_attribute/README	(revision 3c30b595cd3f27758e8966a9935589bdb92486d5)
@@ -2,5 +2,5 @@
 # This example demonstrates various ways to create and access
 # ID attribute using libabac api
-#  
+# and use query to show that it is indeed in the db  
 
 case 1: make attribute rule
Index: tests/python_tests/basic_attribute/attr.py
===================================================================
--- tests/python_tests/basic_attribute/attr.py	(revision ec550f769c681cfa831dc724f82ddacd21fc75cd)
+++ 	(revision )
@@ -1,89 +1,0 @@
-#!/usr/bin/env python
-
-"""
-  to test with python
-
-cmd1:env keystore=`pwd` ./attr.py 
-
-"""
-
-import os
-import ABAC
-
-ctxt = ABAC.Context()
-
-def print_a(ctxt, msg, dotdot):
-    print "%s rule set..." % msg
-    credentials = ctxt.credentials()
-    for credential in credentials:
-        print "%s:%s<-%s" % (dotdot,credential.head().string(), credential.tail().string())
-
-# Keystore is the directory containing the principal credentials.
-# Load existing principals and/or policy credentials
-if (os.environ.has_key("keystore")) :
-    keystore=os.environ["keystore"]
-else:
-    print("keystore is not set...")
-    exit(1) 
-
-superKID=ABAC.ID("SuperK_ID.pem");
-superKID.load_privkey("SuperK_private.pem");
-ctxt.load_id_chunk(superKID.cert_chunk())
-superK=superKID.keyid()
-
-jackID=ABAC.ID("Jack_ID.pem");
-jackID.load_privkey("Jack_private.pem");
-ctxt.load_id_chunk(jackID.cert_chunk())
-jack=jackID.keyid()
-
-bobID=ABAC.ID("Bob_ID.pem");
-bobID.load_privkey("Bob_private.pem");
-ctxt.load_id_chunk(bobID.cert_chunk())
-bob=bobID.keyid()
-
-maryID=ABAC.ID("Mary_ID.pem");
-maryID.load_privkey("Mary_private.pem");
-ctxt.load_id_chunk(maryID.cert_chunk())
-mary=maryID.keyid()
-
-#case 1:
-#Only employee of SuperK can park
-#[keyid:SuperK].role:park <- [keyid:SuperK].role:employee
-attr = ABAC.Attribute(superKID, "park", 0)
-attr.role(superK,"employee")
-attr.bake()
-attr.write_file("SuperK_park__SuperK_employee_attr.xml")
-ctxt.load_attribute_file("SuperK_park__SuperK_employee_attr.xml")
-print_a(ctxt,"case1","..")
-
-#case 2:
-#Jack is an employee of SuperK
-#[keyid:SuperK].role:employee <- [keyid:Jack]
-attr = ABAC.Attribute(superKID, "employee", 0)
-attr.principal(jack)
-attr.bake()
-# create a policy file at the file system
-attr.write_file("SuperK_employee__Jack_attr.xml")
-ctxt.load_attribute_chunk(attr.cert_chunk());
-print_a(ctxt,"case2","....")
-
-#case 3:
-#Bob is an employee of SuperK
-#[keyid:SuperK].role:employee <- [keyid:Jack]
-attr = ABAC.Attribute(superKID, "employee", 0)
-attr.principal(bob)
-attr.bake()
-#chunk=attr.cert_chunk()
-#nattr=ABAC.Attribute_chunk(chunk)
-#ctxt.load_attribute(nattr);
-#print_a(ctxt,"case3", "....")
-
-#case 4:
-#Mary is an employee of SuperK
-#[keyid:SuperK].role:employee <- [keyid:Mary]
-attr = ABAC.Attribute(superKID, "employee", 0)
-attr.principal(mary)
-attr.bake()
-chunk=attr.cert_chunk()
-ctxt.load_attribute_chunk(chunk);
-print_a(ctxt,"case4","......")
Index: tests/python_tests/basic_attribute/query.py
===================================================================
--- tests/python_tests/basic_attribute/query.py	(revision 3c30b595cd3f27758e8966a9935589bdb92486d5)
+++ tests/python_tests/basic_attribute/query.py	(revision 3c30b595cd3f27758e8966a9935589bdb92486d5)
@@ -0,0 +1,100 @@
+#!/usr/bin/env python
+
+"""
+  to test with python
+
+cmd1:env keystore=`pwd` ./query.py 
+
+"""
+
+import os
+import ABAC
+
+from test_util import runTest
+
+ctxt = ABAC.Context()
+
+def print_a(ctxt, msg, dotdot):
+    print "%s rule set..." % msg
+    credentials = ctxt.credentials()
+    for credential in credentials:
+        print "%s:%s<-%s" % (dotdot,credential.head().string(), credential.tail().string())
+
+# Keystore is the directory containing the principal credentials.
+# Load existing principals and/or policy credentials
+if (os.environ.has_key("keystore")) :
+    keystore=os.environ["keystore"]
+else:
+    print("keystore is not set, using current directory...")
+    ctxt.load_directory(".")
+
+superKID=ABAC.ID("SuperK_ID.pem");
+superKID.load_privkey("SuperK_private.pem");
+ctxt.load_id_chunk(superKID.cert_chunk())
+superK=superKID.keyid()
+
+jackID=ABAC.ID("Jack_ID.pem");
+jackID.load_privkey("Jack_private.pem");
+ctxt.load_id_chunk(jackID.cert_chunk())
+jack=jackID.keyid()
+
+bobID=ABAC.ID("Bob_ID.pem");
+bobID.load_privkey("Bob_private.pem");
+ctxt.load_id_chunk(bobID.cert_chunk())
+bob=bobID.keyid()
+
+maryID=ABAC.ID("Mary_ID.pem");
+maryID.load_privkey("Mary_private.pem");
+ctxt.load_id_chunk(maryID.cert_chunk())
+mary=maryID.keyid()
+
+#case 1:
+#Only employee of SuperK can park
+#[keyid:SuperK].role:park <- [keyid:SuperK].role:employee
+attr = ABAC.Attribute(superKID, "park", 0)
+attr.role(superK,"employee")
+attr.bake()
+attr.write_file("SuperK_park__SuperK_employee_attr.xml")
+ctxt.load_attribute_file("SuperK_park__SuperK_employee_attr.xml")
+print_a(ctxt,"case1","..")
+
+#case 2:
+#Jack is an employee of SuperK
+#[keyid:SuperK].role:employee <- [keyid:Jack]
+attr = ABAC.Attribute(superKID, "employee", 0)
+attr.principal(jack)
+attr.bake()
+# create a policy file at the file system
+attr.write_file("SuperK_employee__Jack_attr.xml")
+ctxt.load_attribute_chunk(attr.cert_chunk());
+print_a(ctxt,"case2","....")
+##########################################################################
+#Jack of SuperK can park?
+print "===good============ SuperK.park <-?- Jack"
+runTest("python_tests/basic_attribute","test1",ctxt,"%s.park" % superK, jack, 1, "check loading of attribute as cert chunk")
+
+#case 3:
+#Bob is an employee of SuperK
+#[keyid:SuperK].role:employee <- [keyid:Bob]
+attr = ABAC.Attribute(superKID, "employee", 0)
+attr.principal(bob)
+attr.bake()
+#chunk=attr.cert_chunk()
+#nattr=ABAC.Attribute_chunk(chunk)
+#ctxt.load_attribute(nattr);
+#print_a(ctxt,"case3", "....")
+
+#case 4:
+#Mary is an employee of SuperK
+#[keyid:SuperK].role:employee <- [keyid:Mary]
+attr = ABAC.Attribute(superKID, "employee", 0)
+attr.principal(mary)
+attr.bake()
+chunk=attr.cert_chunk()
+ctxt.load_attribute_chunk(chunk);
+print_a(ctxt,"case4","......")
+##########################################################################
+#is Mary an employee of superK?
+print "===good============ SuperK.employee <-?- Mary"
+runTest("python_tests/basic_attribute","test2",ctxt,"%s.employee" % superK, mary, 1, "check loading of attribute as chunk")
+
Index: tests/python_tests/basic_attribute/run_test
===================================================================
--- tests/python_tests/basic_attribute/run_test	(revision ec550f769c681cfa831dc724f82ddacd21fc75cd)
+++ 	(revision )
@@ -1,17 +1,0 @@
-#!/bin/sh 
-
-rm -rf *.pem *.xml *.log *.out
-
-echo '---setup principals'
-./setup.py 1>attr.log 2>&1
-
-echo '---run command '
-env keystore=`pwd` ./attr.py > attr.out 2>&1
-
-result=`cat attr.out |wc -l`
-if [ $result -eq 9 ]; then
-    echo "   PASSED"
-else
-    echo "   ERROR:basic_attribute test result differs!!!"
-fi
-
Index: tests/python_tests/basic_id/id.py
===================================================================
--- tests/python_tests/basic_id/id.py	(revision ec550f769c681cfa831dc724f82ddacd21fc75cd)
+++ 	(revision )
@@ -1,103 +1,0 @@
-#!/usr/bin/env python
-
-"""
-  to test with python
-
-cmd:env keystore=`pwd` ./id.py 
-
-"""
-
-import os
-import ABAC
-
-ctxt = ABAC.Context()
-
-# Keystore is the directory containing the principal credentials.
-# Load existing principals and/or policy credentials
-if (os.environ.has_key("keystore")) :
-    keystore=os.environ["keystore"]
-#    ctxt.load_directory(keystore)
-else:
-    print("keystore is not set...")
-    exit(1) 
-
-## case 1
-## creating and writing out using libabac ID
-id=ABAC.ID("Mary", 0)
-print "adding -> %s(Mary/good)" % id.keyid()
-id.write_cert_file("Mary_ID.pem")
-id.write_privkey_file("Mary_private.pem")
-## load principal with id/key file pair
-## note, with this, we do not have handle on the keyid
-## to Mary but it will be in the db
-#XXX# ctxt.load_id_files("Mary_ID.pem","Mary_private.pem")
-
-## case 2
-## creating principal using ID
-id2=ABAC.ID("Jack2", 0)
-print "adding -> %s(Jack2/good)" % id2.keyid()
-## load principal directly with the ID, no external
-## credential files were created
-#XXX# ctxt.load_id(id2)
-
-## case 3
-## creating principal using ID
-id3=ABAC.ID("Mark", 0)
-print "adding -> %s(Mark/good)" % id3.keyid()
-## write cert and key content to a combo file. One is appended
-## after another
-id3.write_privkey_file("Mark_IDKEY.pem")
-id3.write_cert_file("Mark_IDKEY.pem")
-## load principal in with the combo file with the tandem format
-ctxt.load_id_file("Mark_IDKEY.pem")
-
-## case 4
-## creating principal using ID
-id4=ABAC.ID("John", 0)
-print "adding -> %s(John/good,invisible)" % id4.keyid()
-id4.write_cert_file("John_other.pem")
-## load id without the key file
-ctxt.load_id_file("John_other.pem")
-
-## case 5
-## creating principal using ID
-id5=ABAC.ID("Lori", 0)
-print "adding -> %s(Lori/good,nokey)" % id5.keyid()
-## write just cert into the combo file
-id5.write_cert_file("Lori_IDKEY.pem")
-##load principal from a combo file that only contains cert part
-ctxt.load_id_file("Lori2_IDKEY.pem")
-
-## case 6
-## creating principal using ID
-id6=ABAC.ID("Tom", 0)
-print "adding -> %s(Tom/bad,nocert)" % id6.keyid()
-## write just key into the combo file
-id6.write_privkey_file("Tom_IDKEY.pem")
-## load principal from combo file that only contains key part
-ctxt.load_id_file("Tom_IDKEY.pem")
-
-## case 7
-## creating ID using chunk
-## this already created a Tim with private key and
-## stored in the master list
-id7=ABAC.ID("Tim", 0)
-chunk=id7.cert_chunk() 
-id77=ABAC.ID_chunk(chunk)
-## load principal from new id
-ctxt.load_id_chunk(id77.cert_chunk())
-
-## case 8
-## load directly using chunk
-## this already created a Stanley with private key
-## and stored in the master list
-id8=ABAC.ID("Stanley", 0)
-chunk=id8.cert_chunk() 
-## load principal as chunk
-ctxt.load_id_chunk(chunk)
-
-## case 9
-## failure case, loading a non-existing combo file
-print "adding -> Casper(bad,unknown file)"
-ctxt.load_id_file("Casper_IDKEY.pem")
-
Index: tests/python_tests/basic_id/id_ctxt.py
===================================================================
--- tests/python_tests/basic_id/id_ctxt.py	(revision ec550f769c681cfa831dc724f82ddacd21fc75cd)
+++ tests/python_tests/basic_id/id_ctxt.py	(revision 3c30b595cd3f27758e8966a9935589bdb92486d5)
@@ -7,4 +7,5 @@
 cmd:env keystore=`pwd` ./id_ctxt.py 
 
+-- can not run in rt0 yet
 """
 
Index: tests/python_tests/basic_id/query.py
===================================================================
--- tests/python_tests/basic_id/query.py	(revision 3c30b595cd3f27758e8966a9935589bdb92486d5)
+++ tests/python_tests/basic_id/query.py	(revision 3c30b595cd3f27758e8966a9935589bdb92486d5)
@@ -0,0 +1,104 @@
+#!/usr/bin/env python
+
+"""
+  to test with python
+
+cmd:env keystore=`pwd` ./query.py 
+
+No real query (originally id.py)
+"""
+
+import os
+import ABAC
+
+ctxt = ABAC.Context()
+
+# Keystore is the directory containing the principal credentials.
+# Load existing principals and/or policy credentials
+if (os.environ.has_key("keystore")) :
+    keystore=os.environ["keystore"]
+#    ctxt.load_directory(keystore)
+else:
+    print("keystore is not set, using current directory...")
+    ctxt.load_directory(".")
+
+## case 1
+## creating and writing out using libabac ID
+id=ABAC.ID("Mary", 0)
+print "adding -> %s(Mary/good)" % id.keyid()
+id.write_cert_file("Mary_ID.pem")
+id.write_privkey_file("Mary_private.pem")
+## load principal with id/key file pair
+## note, with this, we do not have handle on the keyid
+## to Mary but it will be in the db
+#XXX# ctxt.load_id_files("Mary_ID.pem","Mary_private.pem")
+
+## case 2
+## creating principal using ID
+id2=ABAC.ID("Jack2", 0)
+print "adding -> %s(Jack2/good)" % id2.keyid()
+## load principal directly with the ID, no external
+## credential files were created
+#XXX# ctxt.load_id(id2)
+
+## case 3
+## creating principal using ID
+id3=ABAC.ID("Mark", 0)
+print "adding -> %s(Mark/good)" % id3.keyid()
+## write cert and key content to a combo file. One is appended
+## after another
+id3.write_privkey_file("Mark_IDKEY.pem")
+id3.write_cert_file("Mark_IDKEY.pem")
+## load principal in with the combo file with the tandem format
+ctxt.load_id_file("Mark_IDKEY.pem")
+
+## case 4
+## creating principal using ID
+id4=ABAC.ID("John", 0)
+print "adding -> %s(John/good,invisible)" % id4.keyid()
+id4.write_cert_file("John_other.pem")
+## load id without the key file
+ctxt.load_id_file("John_other.pem")
+
+## case 5
+## creating principal using ID
+id5=ABAC.ID("Lori", 0)
+print "adding -> %s(Lori/good,nokey)" % id5.keyid()
+## write just cert into the combo file
+id5.write_cert_file("Lori_IDKEY.pem")
+##load principal from a combo file that only contains cert part
+ctxt.load_id_file("Lori2_IDKEY.pem")
+
+## case 6
+## creating principal using ID
+id6=ABAC.ID("Tom", 0)
+print "adding -> %s(Tom/bad,nocert)" % id6.keyid()
+## write just key into the combo file
+id6.write_privkey_file("Tom_IDKEY.pem")
+## load principal from combo file that only contains key part
+ctxt.load_id_file("Tom_IDKEY.pem")
+
+## case 7
+## creating ID using chunk
+## this already created a Tim with private key and
+## stored in the master list
+id7=ABAC.ID("Tim", 0)
+chunk=id7.cert_chunk() 
+id77=ABAC.ID_chunk(chunk)
+## load principal from new id
+ctxt.load_id_chunk(id77.cert_chunk())
+
+## case 8
+## load directly using chunk
+## this already created a Stanley with private key
+## and stored in the master list
+id8=ABAC.ID("Stanley", 0)
+chunk=id8.cert_chunk() 
+## load principal as chunk
+ctxt.load_id_chunk(chunk)
+
+## case 9
+## failure case, loading a non-existing combo file
+print "adding -> Casper(bad,unknown file)"
+ctxt.load_id_file("Casper_IDKEY.pem")
+
Index: tests/python_tests/basic_id/run_test
===================================================================
--- tests/python_tests/basic_id/run_test	(revision ec550f769c681cfa831dc724f82ddacd21fc75cd)
+++ 	(revision )
@@ -1,21 +1,0 @@
-#!/bin/sh 
-
-rm -rf *.pem *.xml *.log *.out
-
-echo '---setup principals'
-./setup.py 1>id.log 2>&1
-
-echo '---run id.py '
-env keystore=`pwd` ./id.py > id.out 2>&1
-
-#echo '---run id_ctxt ' -- not in RT0
-#env keystore=`pwd` ./id_ctxt.py >> id.out 2>&1
-
-good=`grep adding id.out |wc -l`
-bad=`grep "bad," id.out |wc -l`
-if [ $good -eq 7 -a $bad -eq 2 ]; then
-    echo "   PASSED"
-else
-    echo "   ERROR:basic_id test result differs!!!"
-fi
-
Index: tests/python_tests/experiment_create_rt0/query.py
===================================================================
--- tests/python_tests/experiment_create_rt0/query.py	(revision ec550f769c681cfa831dc724f82ddacd21fc75cd)
+++ tests/python_tests/experiment_create_rt0/query.py	(revision 3c30b595cd3f27758e8966a9935589bdb92486d5)
@@ -10,4 +10,6 @@
 import ABAC
 
+from test_util import runTest
+
 ctxt = ABAC.Context()
 
@@ -18,6 +20,6 @@
     ctxt.load_directory(keystore)
 else:
-    print("keystore is not set...")
-    exit(1)
+    print("keystore is not set, using current directory...")
+    ctxt.load_directory(".")
 
 # retrieve principals' keyid value from local credential files
@@ -54,14 +56,6 @@
 # role=[keyid:Globotron].role:admin 
 # p=[keyid:Alice]
-
-print "\n===good=============== Globotron.admin <- Alice"
-(success, credentials) = ctxt.query("%s.admin" % globotron, alice)
-
-if success:
-    print "success!"
-else:
-    print "failure!"
-for credential in credentials:
-    print "credential %s <- %s" % (credential.head().string(), credential.tail().string())
+print "===good=============== Globotron.admin <- Alice"
+runTest("python_tests/experiment_create_rt0","test1",ctxt,"%s.admin" % globotron, alice, 1, "query in python")
 
 ##########################################################################
@@ -69,13 +63,6 @@
 # role=[keyid:Globotron].role:admin 
 # p=[keyid:Bob]
-
-print "\n===bad=============== Globotron.admin <- Bob"
-(success, credentials) = ctxt.query("%s.admin" % globotron, bob)
-if success:
-    print "success!"
-else:
-    print "failure!"
-for credential in credentials:
-    print "credential %s <- %s" % (credential.head().string(), credential.tail().string())
+print "===bad=============== Globotron.admin <- Bob"
+runTest("python_tests/experiment_create_rt0","test2",ctxt,"%s.admin" % globotron, bob, 0, "no linking relation")
 
 ##########################################################################
@@ -83,11 +70,5 @@
 # role=[keyid:Acme].role:experiment_create 
 # p=[keyid:Bob]
+print "===good=============== Acme.experiment_create <- Bob"
+runTest("python_tests/experiment_create_rt0","test3",ctxt,"%s.experiment_create" % acme, bob, 1, "query python with inference")
 
-print "\n===good=============== Acme.experiment_create <- Bob"
-(success, credentials) = ctxt.query("%s.experiment_create" % acme, bob)
-if success:
-    print "success!"
-else:
-    print "failure!"
-for credential in credentials:
-    print "credential %s <- %s" % (credential.head().string(), credential.tail().string())
Index: tests/python_tests/experiment_create_rt0/run_test
===================================================================
--- tests/python_tests/experiment_create_rt0/run_test	(revision ec550f769c681cfa831dc724f82ddacd21fc75cd)
+++ 	(revision )
@@ -1,21 +1,0 @@
-#!/bin/sh 
-
-rm -rf *.pem *.xml *.log *.out
-
-echo '---setup principals'
-./setup.py 1>/dev/null 2>& 1
-
-echo '---setup attributes'
-./attr.py 1>experiment.log 2>& 1
-
-echo '---run queries'
-env keystore=`pwd` ./query.py 1>experiment.out 2>& 1
-
-good=`grep success experiment.out |wc -l`
-bad=`grep failure experiment.out |wc -l`
-if [ $good -eq 2 -a $bad -eq 1 ]; then
-    echo "   PASSED"
-else
-    echo "   ERROR:experiment_create_rt0 test result differs!!!"
-fi
-
