Commit 8aba2b1f authored by Rafael Monnerat's avatar Rafael Monnerat

Implement runUnitTest and runTestSuite provisioning for cloudooo

Include runTestSuite and runUnitTest on the instance for permit
developers and testnode run cloudooo tests at the partition.

This commit also includes minimal modifications for make convert,
pdftotext and others utilities to cloudooo.
parent e6ba8abb
...@@ -62,6 +62,7 @@ setup(name=name, ...@@ -62,6 +62,7 @@ setup(name=name,
'generic.onetimeupload = slapos.recipe.generic_onetimeupload:Recipe', 'generic.onetimeupload = slapos.recipe.generic_onetimeupload:Recipe',
'helloworld = slapos.recipe.helloworld:Recipe', 'helloworld = slapos.recipe.helloworld:Recipe',
'generic.cloudooo = slapos.recipe.generic_cloudooo:Recipe', 'generic.cloudooo = slapos.recipe.generic_cloudooo:Recipe',
'cloudooo.test = slapos.recipe.cloudooo_test:Recipe',
'fontconfig = slapos.recipe.fontconfig:Recipe', 'fontconfig = slapos.recipe.fontconfig:Recipe',
'java = slapos.recipe.java:Recipe', 'java = slapos.recipe.java:Recipe',
'kumofs = slapos.recipe.kumofs:Recipe', 'kumofs = slapos.recipe.kumofs:Recipe',
......
##############################################################################
#
# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# 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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from slapos.recipe.librecipe import GenericBaseRecipe
import urlparse
class Recipe(GenericBaseRecipe):
def install(self):
path_list = []
common_dict = dict(
prepend_path=self.options['prepend-path'],
)
common_list = [
"--paster_path", self.options['ooo-paster'],
self.options['configuration-file']
]
run_unit_test_path = self.createPythonScript(self.options['run-unit-test'],
__name__ + '.test.runUnitTest', [dict(
call_list=[self.options['run-unit-test-binary'],
] + common_list, **common_dict)])
path_list.append(run_unit_test_path)
path_list.append(self.createPythonScript(self.options['run-test-suite'],
__name__ + '.test.runTestSuite', [dict(
call_list=[self.options['run-test-suite-binary'],
], **common_dict)]))
return path_list
##############################################################################
#
# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# 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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import os
import sys
def runTestSuite(args):
env = os.environ.copy()
d = args[0]
env['PATH'] = ':'.join([d['prepend_path']] + os.environ['PATH'].split(':'))
# Deal with Shebang size limitation
executable_filepath = d['call_list'][0]
file_object = open(executable_filepath, 'r')
line = file_object.readline()
file_object.close()
argument_list = []
if line[:2] == '#!':
executable_filepath = line[2:].strip()
argument_list.append(executable_filepath)
argument_list.extend(d['call_list'])
argument_list.extend(sys.argv[1:])
argument_list.append(env)
os.execle(executable_filepath, *argument_list)
def runUnitTest(args):
env = os.environ.copy()
d = args[0]
env['PATH'] = ':'.join([d['prepend_path']] + os.environ.get('PATH', '').split(':'))
# Deal with Shebang size limitation
executable_filepath = d['call_list'][0]
file_object = open(executable_filepath, 'r')
line = file_object.readline()
file_object.close()
argument_list = []
if line[:2] == '#!':
executable_filepath = line[2:].strip()
argument_list.append(executable_filepath)
argument_list.extend(d['call_list'])
argument_list.extend(sys.argv[1:])
argument_list.append(env)
os.execle(executable_filepath, *argument_list)
...@@ -32,6 +32,9 @@ limit_memory_used = 3000 ...@@ -32,6 +32,9 @@ limit_memory_used = 3000
application_hostname = %(ip)s application_hostname = %(ip)s
# OpenOffice Port # OpenOffice Port
openoffice_port = %(openoffice_port)s openoffice_port = %(openoffice_port)s
# PATH is required for imagemagick and others conversors
env-PATH = %(PATH)s
# LD_LIBRARY_PATH passed to OpenOffice # LD_LIBRARY_PATH passed to OpenOffice
env-LD_LIBRARY_PATH = %(LD_LIBRARY_PATH)s env-LD_LIBRARY_PATH = %(LD_LIBRARY_PATH)s
env-FONTCONFIG_FILE = %(FONTCONFIG_FILE)s env-FONTCONFIG_FILE = %(FONTCONFIG_FILE)s
...@@ -41,12 +44,30 @@ env-FONTCONFIG_FILE = %(FONTCONFIG_FILE)s ...@@ -41,12 +44,30 @@ env-FONTCONFIG_FILE = %(FONTCONFIG_FILE)s
# It is used to select the handler that will be used in conversion. # It is used to select the handler that will be used in conversion.
# Priority matters, first match take precedence on next lines. # Priority matters, first match take precedence on next lines.
mimetype_registry = mimetype_registry =
application/pdf * pdf
application/vnd.oasis.opendocument* * ooo application/vnd.oasis.opendocument* * ooo
application/vnd.sun.xml* * ooo application/vnd.sun.xml* * ooo
text/* * ooo application/pdf text/* pdf
image/* image/* imagemagick application/pdf * ooo
video/* * ffmpeg video/* * ffmpeg
audio/* * ffmpeg
application/x-shockwave-flash * ffmpeg
application/ogg * ffmpeg
application/ogv * ffmpeg
image/png image/jpeg imagemagick
image/png * ooo
image/* image/* imagemagick
text/* * ooo
application/zip * ooo
application/msword * ooo
application/vnd* * ooo
application/x-vnd* * ooo
application/postscript * ooo
application/wmf * ooo
application/csv * ooo
application/x-openoffice-gdimetafile * ooo
application/x-emf * ooo
application/emf * ooo
application/octet* * ooo
* application/vnd.oasis.opendocument* ooo * application/vnd.oasis.opendocument* ooo
[server:main] [server:main]
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
parts = parts =
publish-cloudooo-connection-information publish-cloudooo-connection-information
cloudooo-instance cloudooo-instance
cloudooo-test-runner
eggs-directory = {{ eggs_directory }} eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }} develop-eggs-directory = {{ develop_eggs_directory }}
offline = true offline = true
...@@ -30,6 +32,7 @@ data-directory = ${directory:cloudooo-data} ...@@ -30,6 +32,7 @@ data-directory = ${directory:cloudooo-data}
environment = environment =
LD_LIBRARY_PATH = {{ parameter_dict['file'] }}/lib:{{ parameter_dict['fontconfig'] }}/lib:{{ parameter_dict['freetype'] }}/lib:{{ parameter_dict['libICE'] }}/lib:{{ parameter_dict['libpng12'] }}/lib:{{ parameter_dict['libSM'] }}/lib:{{ parameter_dict['libX11'] }}/lib:{{ parameter_dict['libXau'] }}/lib:{{ parameter_dict['libXdmcp'] }}/lib:{{ parameter_dict['libXext'] }}/lib:{{ parameter_dict['libxcb'] }}/lib:{{ parameter_dict['libXrender'] }}/lib:{{ parameter_dict['zlib'] }}/lib LD_LIBRARY_PATH = {{ parameter_dict['file'] }}/lib:{{ parameter_dict['fontconfig'] }}/lib:{{ parameter_dict['freetype'] }}/lib:{{ parameter_dict['libICE'] }}/lib:{{ parameter_dict['libpng12'] }}/lib:{{ parameter_dict['libSM'] }}/lib:{{ parameter_dict['libX11'] }}/lib:{{ parameter_dict['libXau'] }}/lib:{{ parameter_dict['libXdmcp'] }}/lib:{{ parameter_dict['libXext'] }}/lib:{{ parameter_dict['libxcb'] }}/lib:{{ parameter_dict['libXrender'] }}/lib:{{ parameter_dict['zlib'] }}/lib
FONTCONFIG_FILE = ${fontconfig-instance:conf-path} FONTCONFIG_FILE = ${fontconfig-instance:conf-path}
PATH = ${binary-link:target-directory}
# Binary information # Binary information
# cloudooo specific configuration # cloudooo specific configuration
...@@ -37,6 +40,19 @@ ooo-binary-path = {{ parameter_dict['libreoffice-bin'] }}/program ...@@ -37,6 +40,19 @@ ooo-binary-path = {{ parameter_dict['libreoffice-bin'] }}/program
ooo-paster = {{ bin_directory }}/cloudooo_paster ooo-paster = {{ bin_directory }}/cloudooo_paster
ooo-uno-path = {{ parameter_dict['libreoffice-bin'] }}/basis-link/program ooo-uno-path = {{ parameter_dict['libreoffice-bin'] }}/basis-link/program
[cloudooo-test-runner]
recipe = slapos.cookbook:cloudooo.test
prepend-path = ${buildout:bin-directory}
run-unit-test = ${buildout:bin-directory}/runUnitTest
run-test-suite = ${buildout:bin-directory}/runTestSuite
ooo-paster = ${cloudooo-instance:ooo-paster}
configuration-file = ${cloudooo-instance:configuration-file}
run-unit-test-binary = {{ bin_directory }}/runCloudoooUnitTest
run-test-suite-binary = {{ bin_directory }}/runCloudoooTestSuite
[fontconfig-instance] [fontconfig-instance]
recipe = slapos.cookbook:fontconfig recipe = slapos.cookbook:fontconfig
conf-path = ${rootdirectory:etc}/font.conf conf-path = ${rootdirectory:etc}/font.conf
...@@ -46,6 +62,22 @@ url-list = {{ json.get('font_url_list', []) | join(' ') }} ...@@ -46,6 +62,22 @@ url-list = {{ json.get('font_url_list', []) | join(' ') }}
service-folder = ${basedirectory:services} service-folder = ${basedirectory:services}
onetimedownload_path = {{ bin_directory }}/onetimedownload onetimedownload_path = {{ bin_directory }}/onetimedownload
[binary-link]
recipe = slapos.cookbook:symbolic.link
target-directory = ${rootdirectory:bin}
link-binary =
{{ parameter_dict['coreutils'] }}/bin/basename
{{ parameter_dict['coreutils'] }}/bin/cat
{{ parameter_dict['coreutils'] }}/bin/cp
{{ parameter_dict['coreutils'] }}/bin/ls
{{ parameter_dict['coreutils'] }}/bin/tr
{{ parameter_dict['coreutils'] }}/bin/uname
{{ parameter_dict['imagemagick'] }}/bin/convert
{{ parameter_dict['imagemagick'] }}/bin/identify
{{ parameter_dict['poppler'] }}/bin/pdfinfo
{{ parameter_dict['poppler'] }}/bin/pdftotext
{{ parameter_dict['poppler'] }}/bin/pdftohtml
# rest of parts are candidates for some generic stuff # rest of parts are candidates for some generic stuff
[basedirectory] [basedirectory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
...@@ -60,3 +92,4 @@ font = ${rootdirectory:srv}/font ...@@ -60,3 +92,4 @@ font = ${rootdirectory:srv}/font
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
etc = ${buildout:directory}/etc etc = ${buildout:directory}/etc
srv = ${buildout:directory}/srv srv = ${buildout:directory}/srv
bin = ${buildout:directory}/bin
...@@ -40,6 +40,9 @@ libXrender = {{ libXrender_location }} ...@@ -40,6 +40,9 @@ libXrender = {{ libXrender_location }}
zlib = {{ zlib_location }} zlib = {{ zlib_location }}
libreoffice-bin = {{ libreoffice_bin_location }} libreoffice-bin = {{ libreoffice_bin_location }}
fonts = {{ fonts_location }} fonts = {{ fonts_location }}
coreutils = {{ coreutils_location }}
imagemagick = {{ imagemagick_location }}
poppler = {{ poppler_location }}
buildout-bin-directory = {{ buildout_bin_directory }} buildout-bin-directory = {{ buildout_bin_directory }}
[dynamic-template-cloudooo] [dynamic-template-cloudooo]
......
...@@ -68,7 +68,7 @@ context = ...@@ -68,7 +68,7 @@ context =
# XXX: "template.cfg" is hardcoded in instanciation recipe # XXX: "template.cfg" is hardcoded in instanciation recipe
filename = template.cfg filename = template.cfg
template = ${:_profile_base_location_}/instance.cfg.in template = ${:_profile_base_location_}/instance.cfg.in
md5sum = 5f3efb79caca9f50951bce44e0a0f54a md5sum = 46a1f4dc69ccf0b42b9d579e34b40df9
extra-context = extra-context =
key buildout_bin_directory buildout:bin-directory key buildout_bin_directory buildout:bin-directory
key dcron_location dcron:location key dcron_location dcron:location
...@@ -93,9 +93,10 @@ extra-context = ...@@ -93,9 +93,10 @@ extra-context =
key poppler_location poppler:location key poppler_location poppler:location
key template_cloudooo template-cloudooo:target key template_cloudooo template-cloudooo:target
key zlib_location zlib:location key zlib_location zlib:location
key coreutils_location coreutils:location
[template-cloudooo] [template-cloudooo]
recipe = slapos.recipe.build:download recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/instance-cloudoo.cfg.in url = ${:_profile_base_location_}/instance-cloudoo.cfg.in
md5sum = ed1c1c1d00a2e12751a4f9da9c165b16 md5sum = b4692fb5916e997c9766b9d0e1030e6c
mode = 640 mode = 640
...@@ -28,6 +28,7 @@ extends = ...@@ -28,6 +28,7 @@ extends =
../component/stunnel/buildout.cfg ../component/stunnel/buildout.cfg
../component/rdiff-backup/buildout.cfg ../component/rdiff-backup/buildout.cfg
../component/dcron/buildout.cfg ../component/dcron/buildout.cfg
../component/coreutils/buildout.cfg
versions = versions versions = versions
...@@ -97,9 +98,11 @@ entry-points = ...@@ -97,9 +98,11 @@ entry-points =
main=cloudooo.paster_application:application main=cloudooo.paster_application:application
cloudooo_tester=cloudooo.bin.cloudooo_tester:main cloudooo_tester=cloudooo.bin.cloudooo_tester:main
runCloudoooUnitTest=cloudooo.tests.runHandlerUnitTest:run runCloudoooUnitTest=cloudooo.tests.runHandlerUnitTest:run
runCloudoooTestSuite=cloudooo.tests.runTestSuite:run
scripts = scripts =
paster=cloudooo_paster paster=cloudooo_paster
runCloudoooUnitTest runCloudoooUnitTest
runCloudoooTestSuite
ugly-depend-on = ${cloudooo:command} ${cloudooo:update-command} ugly-depend-on = ${cloudooo:command} ${cloudooo:update-command}
[bootstrap2.6] [bootstrap2.6]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment