Loading Common/Misc/getTemplateForTest/src/Makefile 0 → 100644 +61 −0 Original line number Diff line number Diff line #******************************************************************************* # PPPPPPPP # # "@(#) $Id: Makefile,v 1.4 2010-08-13 06:32:24 bartolini Exp $" # # Makefile of ........ # # who when what # -------- -------- ---------------------------------------------- # bartolini 23/01/14 created # # # Python stuff (public and local) # ---------------------------- PY_SCRIPTS = getTemplateForTest PY_MODULES = gettemplatefortest SCRIPTS_L = install_gmock # #>>>>> END OF standard rules # # INCLUDE STANDARDS # ----------------- MAKEDIRTMP := $(shell searchFile include/acsMakefile) ifneq ($(MAKEDIRTMP),\#error\#) MAKEDIR := $(MAKEDIRTMP)/include include $(MAKEDIR)/acsMakefile endif # # TARGETS # ------- all: do_all @echo " . . . 'all' done" clean_templates: rm -rf $(INTROOT)/templates/test @echo " . . . templates removed from introot" clean : clean_all clean_templates @echo " . . . clean done" clean_dist : clean_all clean_dist_all clean_templates @echo " . . . clean_dist done" man : do_man @echo " . . . man page(s) done" install_templates: cp -r ../templates/test $(INTROOT)/templates find $(INTROOT)/templates/test -type d -name ".svn" | xargs rm -rf @echo " . . . templates installed" install : install_all install_templates @echo " . . . installation done" #___oOo___ Common/Misc/getTemplateForTest/src/getTemplateForTest 0 → 100644 +29 −0 Original line number Diff line number Diff line #!/usr/bin/env python # # # Copyright (C) 2012 Marco Bartolini, bartolini@ira.inaf.it # # 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 3 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. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # import sys import gettemplatefortest args = sys.argv[1:] try: gettemplatefortest.command_line_util(args) except Exception, e: print e.message sys.exit(1) Common/Misc/getTemplateForTest/src/gettemplatefortest.py 0 → 100644 +50 −0 Original line number Diff line number Diff line import sys import os import shutil usage = """ getTmplateForTest - create a test directory containing the necessary code templates used for component automated testing. This command should be run from within a Component directory at the first level of depth, creating a 'test' directory at the same level of 'src, objects' ecc... """ def get_introot(): introot = os.getenv("INTROOT") if not introot: msg = "ERROR: INTROOT environment variable is not defined" raise Exception(msg) return introot def get_template_dir_name(): introot = get_introot() return os.path.join(introot, "templates/test") def get_template_dir(): template_dir = get_template_dir_name() if not os.path.exists(template_dir): msg = "ERROR: template directory does not exist" raise Exception(msg) return template_dir def command_line_util(args): if len(args) == 1: arg = args.pop() if arg in ('--help', '-h'): print usage sys.exit(0) else: target_dir = arg elif len(args) > 1: print usage sys.exit(0) else: target_dir = 'test' # Default target directory if os.path.exists(target_dir): msg = "ERROR: %s directory already exists." %target_dir raise Exception(msg) template_dir = get_template_dir() shutil.copytree(template_dir, target_dir) Common/Misc/getTemplateForTest/src/install_gmock 0 → 100644 +32 −0 Original line number Diff line number Diff line #!/bin/bash if [[ $(id -u) -ne 0 ]] ; then echo "Script must be run as root" ; exit 1 ; fi GMOCK=gmock-1.7.0 GMOCK_BASE_URL=https://googlemock.googlecode.com/files BUILDDIR=build PWD=`pwd` TMPDIR=`mktemp -d` cd $TMPDIR wget $GMOCK_BASE_URL/$GMOCK.zip unzip $GMOCK.zip cd $GMOCK export GMOCK_HOME=`pwd` mkdir $BUILDDIR cd $BUILDDIR cmake .. make chmod a+x *.a cp *.a /usr/local/lib cd $GMOCK_HOME/include cp -r gmock /usr/local/include cd $GMOCK_HOME/gtest mkdir $BUILDDIR cd $BUILDDIR cmake .. make chmod a+x *.a cp *.a /usr/local/lib cd $GMOCK_HOME/gtest/include cp -r gtest /usr/local/include cd $PWD rm -rf $TMPDIR Common/Misc/getTemplateForTest/templates/test/Makefile 0 → 100644 +90 −0 Original line number Diff line number Diff line # CPP UNIT TESTING SETUP #-------------- GTEST_HOME=/usr/local/include/gtest GMOCK_HOME=/usr/local/include/gmock GTEST_LIBS=gtest gtest_main USER_INC=-I$(GTEST_HOME) -I$(GMOCK_HOME) USER_LIBS=C++ pthread # END OF CPP UNIT TESTING SETUP #--------------------- # DEFINE YOUR CPP UNIT TEST EXECUTABLES HERE as: # # EXECTUABLES_L = unittest # unittest_OBJECTS = unittest # unittest_LIBS = $(GTEST_LIBS) <ComponentNameImpl> EXECUTABLES_L = unittest unittest_OBJECTS = unittest unittest_LIBS = $(GTEST_LIBS) # END OF CUSTOMIZATION # do not edit below this line #---------------------------- CSOURCENAMES = \ $(foreach exe, $(EXECUTABLES) $(EXECUTABLES_L), $($(exe)_OBJECTS)) \ $(foreach rtos, $(RTAI_MODULES) , $($(rtos)_OBJECTS)) \ $(foreach lib, $(LIBRARIES) $(LIBRARIES_L), $($(lib)_OBJECTS)) MAKEDIRTMP := $(shell searchFile include/acsMakefile) ifneq ($(MAKEDIRTMP),\#error\#) MAKEDIR := $(MAKEDIRTMP)/include include $(MAKEDIR)/acsMakefile endif # TEST TARGETS #TODO: unittest(2) discover pyunit do_unit: all @echo "running cpp unit tests" ../bin/unittest --gtest_output=xml:results/cppunittest.xml do_pyunit: @echo "running python unit tests" python -m unittest pyunit do_functional: @echo "running python functional tests" python -m unittest functional do_external: @echo "running python external tests" python -m unittest external clean_test: rm -f results/*.xml rm -f functional/*.pyc rm -f pyunit/*.pyc rm -f external/*.pyc unit: do_unit @echo " . . . 'unit' done" pyunit: do_pyunit @echo " . . . 'pyunit' done" functional: do_functional @echo " . . . 'functional' done" external: do_external @echo " . . . 'external' done" # TARGETS # ------- all: do_all @echo " . . . 'all' done" clean : clean_all clean_test @echo " . . . clean done" clean_dist : clean_all clean_dist_all clean_test @echo " . . . clean_dist done" man : do_man @echo " . . . man page(s) done" install : install_all @echo " . . . installation done" Loading
Common/Misc/getTemplateForTest/src/Makefile 0 → 100644 +61 −0 Original line number Diff line number Diff line #******************************************************************************* # PPPPPPPP # # "@(#) $Id: Makefile,v 1.4 2010-08-13 06:32:24 bartolini Exp $" # # Makefile of ........ # # who when what # -------- -------- ---------------------------------------------- # bartolini 23/01/14 created # # # Python stuff (public and local) # ---------------------------- PY_SCRIPTS = getTemplateForTest PY_MODULES = gettemplatefortest SCRIPTS_L = install_gmock # #>>>>> END OF standard rules # # INCLUDE STANDARDS # ----------------- MAKEDIRTMP := $(shell searchFile include/acsMakefile) ifneq ($(MAKEDIRTMP),\#error\#) MAKEDIR := $(MAKEDIRTMP)/include include $(MAKEDIR)/acsMakefile endif # # TARGETS # ------- all: do_all @echo " . . . 'all' done" clean_templates: rm -rf $(INTROOT)/templates/test @echo " . . . templates removed from introot" clean : clean_all clean_templates @echo " . . . clean done" clean_dist : clean_all clean_dist_all clean_templates @echo " . . . clean_dist done" man : do_man @echo " . . . man page(s) done" install_templates: cp -r ../templates/test $(INTROOT)/templates find $(INTROOT)/templates/test -type d -name ".svn" | xargs rm -rf @echo " . . . templates installed" install : install_all install_templates @echo " . . . installation done" #___oOo___
Common/Misc/getTemplateForTest/src/getTemplateForTest 0 → 100644 +29 −0 Original line number Diff line number Diff line #!/usr/bin/env python # # # Copyright (C) 2012 Marco Bartolini, bartolini@ira.inaf.it # # 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 3 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. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # import sys import gettemplatefortest args = sys.argv[1:] try: gettemplatefortest.command_line_util(args) except Exception, e: print e.message sys.exit(1)
Common/Misc/getTemplateForTest/src/gettemplatefortest.py 0 → 100644 +50 −0 Original line number Diff line number Diff line import sys import os import shutil usage = """ getTmplateForTest - create a test directory containing the necessary code templates used for component automated testing. This command should be run from within a Component directory at the first level of depth, creating a 'test' directory at the same level of 'src, objects' ecc... """ def get_introot(): introot = os.getenv("INTROOT") if not introot: msg = "ERROR: INTROOT environment variable is not defined" raise Exception(msg) return introot def get_template_dir_name(): introot = get_introot() return os.path.join(introot, "templates/test") def get_template_dir(): template_dir = get_template_dir_name() if not os.path.exists(template_dir): msg = "ERROR: template directory does not exist" raise Exception(msg) return template_dir def command_line_util(args): if len(args) == 1: arg = args.pop() if arg in ('--help', '-h'): print usage sys.exit(0) else: target_dir = arg elif len(args) > 1: print usage sys.exit(0) else: target_dir = 'test' # Default target directory if os.path.exists(target_dir): msg = "ERROR: %s directory already exists." %target_dir raise Exception(msg) template_dir = get_template_dir() shutil.copytree(template_dir, target_dir)
Common/Misc/getTemplateForTest/src/install_gmock 0 → 100644 +32 −0 Original line number Diff line number Diff line #!/bin/bash if [[ $(id -u) -ne 0 ]] ; then echo "Script must be run as root" ; exit 1 ; fi GMOCK=gmock-1.7.0 GMOCK_BASE_URL=https://googlemock.googlecode.com/files BUILDDIR=build PWD=`pwd` TMPDIR=`mktemp -d` cd $TMPDIR wget $GMOCK_BASE_URL/$GMOCK.zip unzip $GMOCK.zip cd $GMOCK export GMOCK_HOME=`pwd` mkdir $BUILDDIR cd $BUILDDIR cmake .. make chmod a+x *.a cp *.a /usr/local/lib cd $GMOCK_HOME/include cp -r gmock /usr/local/include cd $GMOCK_HOME/gtest mkdir $BUILDDIR cd $BUILDDIR cmake .. make chmod a+x *.a cp *.a /usr/local/lib cd $GMOCK_HOME/gtest/include cp -r gtest /usr/local/include cd $PWD rm -rf $TMPDIR
Common/Misc/getTemplateForTest/templates/test/Makefile 0 → 100644 +90 −0 Original line number Diff line number Diff line # CPP UNIT TESTING SETUP #-------------- GTEST_HOME=/usr/local/include/gtest GMOCK_HOME=/usr/local/include/gmock GTEST_LIBS=gtest gtest_main USER_INC=-I$(GTEST_HOME) -I$(GMOCK_HOME) USER_LIBS=C++ pthread # END OF CPP UNIT TESTING SETUP #--------------------- # DEFINE YOUR CPP UNIT TEST EXECUTABLES HERE as: # # EXECTUABLES_L = unittest # unittest_OBJECTS = unittest # unittest_LIBS = $(GTEST_LIBS) <ComponentNameImpl> EXECUTABLES_L = unittest unittest_OBJECTS = unittest unittest_LIBS = $(GTEST_LIBS) # END OF CUSTOMIZATION # do not edit below this line #---------------------------- CSOURCENAMES = \ $(foreach exe, $(EXECUTABLES) $(EXECUTABLES_L), $($(exe)_OBJECTS)) \ $(foreach rtos, $(RTAI_MODULES) , $($(rtos)_OBJECTS)) \ $(foreach lib, $(LIBRARIES) $(LIBRARIES_L), $($(lib)_OBJECTS)) MAKEDIRTMP := $(shell searchFile include/acsMakefile) ifneq ($(MAKEDIRTMP),\#error\#) MAKEDIR := $(MAKEDIRTMP)/include include $(MAKEDIR)/acsMakefile endif # TEST TARGETS #TODO: unittest(2) discover pyunit do_unit: all @echo "running cpp unit tests" ../bin/unittest --gtest_output=xml:results/cppunittest.xml do_pyunit: @echo "running python unit tests" python -m unittest pyunit do_functional: @echo "running python functional tests" python -m unittest functional do_external: @echo "running python external tests" python -m unittest external clean_test: rm -f results/*.xml rm -f functional/*.pyc rm -f pyunit/*.pyc rm -f external/*.pyc unit: do_unit @echo " . . . 'unit' done" pyunit: do_pyunit @echo " . . . 'pyunit' done" functional: do_functional @echo " . . . 'functional' done" external: do_external @echo " . . . 'external' done" # TARGETS # ------- all: do_all @echo " . . . 'all' done" clean : clean_all clean_test @echo " . . . clean done" clean_dist : clean_all clean_dist_all clean_test @echo " . . . clean_dist done" man : do_man @echo " . . . man page(s) done" install : install_all @echo " . . . installation done"