Commit 9ec42c15 authored by Cédric de Saint Martin's avatar Cédric de Saint Martin

Merge branch 'selenium'

parents ba65e350 288cc952
[buildout]
parts =
alsa
[alsa]
# Contains libasound
recipe = hexagonit.recipe.cmmi
url = ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.0.24.1.tar.bz2
#md5sum = d55a9d7d2a79d738a1b7a511cffda4b6
configure-options =
--disable-static
--disable-aload
--disable-mixer
--disable-pcm
--disable-rawmidi
--disable-hwdep
--disable-seq
--disable-ucm
--disable-alisp
--disable-old-symbols
--disable-python
\ No newline at end of file
[buildout]
extends =
../dbus/buildout.cfg
../fontconfig/buildout.cfg
../glib/buildout.cfg
../gtk-2/buildout.cfg
../libpng/buildout.cfg
../xorg/buildout.cfg
parts =
chromium
[chromium]
recipe = slapos.recipe.build
slapos_promise =
file:chrome
file:chrome-wrapper
file:chrome-slapos
#chromium zip files for linux seem to be corrupted : rights are not correctly
#set (+x) when unzipping using python, but it works when doing "unzip chromium.zip"
#AND it works when unzipping any other archive with python.
#Conclusion : Google, please, learn how to make zip files.
linux_x86 = http://commondatastorage.googleapis.com/chromium-browser-continuous/Linux/109696/chrome-linux.zip 8ba6c022849b2a882b6e65163c147eb9
linux_x86-64 = http://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/109696/chrome-linux.zip a3ed3feb285ecfe7c722576db80d5099
mac_x86-64 = http://commondatastorage.googleapis.com/chromium-browser-continuous/Mac/100142/chrome-mac.zip cb3a76b8a1a93be94df2f500fb621131
script =
#If part directory already exist, will just throw an error.
import sys
platform = '%%s_%%s' %% (guessOperatingSystem(), guessPlatform())
if not self.options.get('url'): self.options['url'], self.options['md5sum'] = self.options[platform].split(' ')
extract_dir = self.extract(self.download(self.options['url'], self.options.get('md5sum')))
workdir = guessworkdir(extract_dir)
self.copyTree(workdir, "%(location)s")
wrapper_location = os.path.join("%(location)s", "chrome-slapos")
wrapper = open(wrapper_location, 'w')
wrapper.write("""#!/bin/sh
export LD_LIBRARY_PATH=${libXrender:location}/lib/:${fontconfig:location}/lib/:${dbus:location}/lib/:${dbus-glib:location}/lib/:${pango:location}/lib:${cairo:location}/lib:${glib:location}/lib:${gtk-2:location}/lib:${atk:location}/lib:${gdk-pixbuf:location}/lib:${libXt:location}/lib:${gtk-2:location}/lib:${libpng:location}/lib:%(location)s
%(location)s/chrome""")
wrapper.flush()
wrapper.close()
os.chmod(wrapper_location, 0766)
os.chmod(os.path.join("%(location)s", 'chrome'), 0766)
os.chmod(os.path.join("%(location)s", 'chrome-wrapper'), 0766)
# requirements : libXrender1 libxss1 x11-common
\ No newline at end of file
[buildout]
extends =
../libxml2/buildout.cfg
../pkgconfig/buildout.cfg
../libexpat/buildout.cfg
parts =
dbus
[dbus]
recipe = hexagonit.recipe.cmmi
url = http://dbus.freedesktop.org/releases/dbus/dbus-1.4.10.tar.gz
md5sum = 402a2f8102bedbe236e2891b2b0f31c2
configure-options =
--disable-static
environment =
PATH=${pkgconfig:location}/bin:%(PATH)s
PKG_CONFIG_PATH=${libxml2:location}/lib/pkgconfig
CPPFLAGS=-I${libexpat:location}/include
LDFLAGS=-L${libexpat:location}/lib
[dbus-glib]
recipe = hexagonit.recipe.cmmi
url = http://dbus.freedesktop.org/releases/dbus-glib/dbus-glib-0.94.tar.gz
md5sum = e1f1506a6f4941e67bffd614b1ad5af6
environment =
PATH=${pkgconfig:location}/bin:${glib:location}/bin:%(PATH)s
PKG_CONFIG_PATH=${dbus:location}/lib/pkgconfig:${glib:location}/lib/pkgconfig
CPPFLAGS=-I${libexpat:location}/include
LDFLAGS=-L${libexpat:location}/lib -L${gettext:location}/lib
[buildout]
extends =
../alsa/buildout.cfg
../xorg/buildout.cfg
../fontconfig/buildout.cfg
../dbus/buildout.cfg
../gtk-2/buildout.cfg
../libpng/buildout.cfg
parts =
firefox
[firefox]
recipe = slapos.recipe.build
slapos_promise =
file:firefox
file:firefox-bin
depends =
${liberation-fonts:location}
${ipaex-fonts:location}
x86 = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/7.0.1/linux-i686/fr/firefox-7.0.1.tar.bz2 42c2559892f26ed2a0563faaf693a00f
x86-64 = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/7.0.1/linux-x86_64/en-US/firefox-7.0.1.tar.bz2 20d6c8e3dfc97d08d1dec7d0479f924f
script =
if not self.options.get('url'): self.options['url'], self.options['md5sum'] = self.options[guessPlatform()].split(' ')
extract_dir = self.extract(self.download(self.options['url'], self.options.get('md5sum')))
workdir = guessworkdir(extract_dir)
self.copyTree(workdir, "%(location)s")
wrapper_location = os.path.join("%(location)s", "firefox-slapos")
wrapper = open(wrapper_location, 'w')
wrapper.write("""#!/bin/sh
cd %(location)s
export LD_LIBRARY_PATH=${libXrender:location}/lib/:${fontconfig:location}/lib/:${dbus:location}/lib/:${dbus-glib:location}/lib/:${pango:location}/lib:${cairo:location}/lib:${glib:location}/lib:${gtk-2:location}/lib:${atk:location}/lib:${gdk-pixbuf:location}/lib:${libXt:location}/lib:${libpng:location}/lib:${libSM:location}/lib:${libICE:location}/lib:${alsa:location}/lib:%(location)s
export PATH=${fontconfig:location}/bin:$PATH
%(location)s/firefox $*""")
wrapper.close()
os.chmod(wrapper_location, 0777)
...@@ -13,6 +13,7 @@ parts = ...@@ -13,6 +13,7 @@ parts =
recipe = hexagonit.recipe.cmmi recipe = hexagonit.recipe.cmmi
url = http://fontconfig.org/release/fontconfig-2.8.0.tar.gz url = http://fontconfig.org/release/fontconfig-2.8.0.tar.gz
md5sum = 77e15a92006ddc2adbb06f840d591c0e md5sum = 77e15a92006ddc2adbb06f840d591c0e
# XXX-Cedric : should we use --with-add-fonts={somefont:location}/share,{someotherfont:location}/share?
configure-options = configure-options =
--disable-static --disable-static
--disable-docs --disable-docs
......
[buildout]
extends =
../glib/buildout.cfg
../pkgconfig/buildout.cfg
../libpng/buildout.cfg
../xorg/buildout.cfg
../zlib/buildout.cfg
../freetype/buildout.cfg
../fontconfig/buildout.cfg
../gettext/buildout.cfg
../libtiff/buildout.cfg
../libjpeg/buildout.cfg
parts =
gtk-2
[cairo]
recipe = hexagonit.recipe.cmmi
url = http://cairographics.org/releases/cairo-1.10.2.tar.gz
md5sum = f101a9e88b783337b20b2e26dfd26d5f
configure-options =
--enable-tee=yes
environment =
PATH=${freetype:location}/bin:${pkgconfig:location}/bin:%(PATH)s
PKG_CONFIG_PATH=${fontconfig:location}/lib/pkgconfig:${freetype:location}/lib/pkgconfig:${zlib:location}/lib/pkgconfig:${libpng:location}/lib/pkgconfig:${pixman:location}/lib/pkgconfig:${libX11:location}/lib/pkgconfig:${libXrender:location}/lib/pkgconfig
CPPFLAGS=-I${libpng:location}/include/ -I${zlib:location}/include -I${libX11:location}/include/ -I${xproto:location}/include -I${kbproto:location}/include -I${libXrender:location}/include -I${render:location}/include
LDFLAGS=-L${zlib:location}/lib -Wl,-rpath=${zlib:location}/lib -L${libXrender:location}/lib -Wl,-rpath=${libXrender:location}/lib
LD_LIBRARY_PATH=${render:location}/lib:${libX11:location}/lib:${libXrender:location}/lib
[pango]
recipe = hexagonit.recipe.cmmi
url = http://ftp.gnome.org/pub/gnome/sources/pango/1.29/pango-1.29.3.tar.bz2
md5sum = be4e3891353fae6b62a6f8d7689c4266
configure-options =
--disable-static
# XXX-Cedric : Why, god, why do I have to supply the -lXrender option to linker?
environment =
PATH=${glib:location}/bin:${freetype:location}/bin:${pkgconfig:location}/bin:%(PATH)s
PKG_CONFIG_PATH=${glib:location}/lib/pkgconfig:${fontconfig:location}/lib/pkgconfig:${freetype:location}/lib/pkgconfig:${cairo:location}/lib/pkgconfig::${libXrender:location}/lib/pkgconfig
CPPFLAGS=-I${cairo:location}/include/cairo
LDFLAGS=-L${zlib:location}/lib -Wl,-rpath=${zlib:location}/lib -L${libXrender:location}/lib -Wl,-rpath=${libXrender:location}/lib -lXrender
LD_LIBRARY_PATH=${render:location}/lib:${libX11:location}/lib:${libXrender:location}/lib
[gdk-pixbuf]
recipe = hexagonit.recipe.cmmi
url = http://ftp.gnome.org/pub/gnome/sources/gdk-pixbuf/2.24/gdk-pixbuf-2.24.0.tar.bz2
md5sum = d8ece3a4ade4a91c768328620e473ab8
configure-options =
--disable-static
--without-libintl-prefix
environment =
PATH=${glib:location}/bin:${pkgconfig:location}/bin:%(PATH)s
PKG_CONFIG_PATH=${glib:location}/lib/pkgconfig:${gettext:location}/lib/pkgconfig:${fontconfig:location}/lib/pkgconfig:${freetype:location}/lib/pkgconfig:${cairo:location}/lib/pkgconfig
CPPFLAGS=-I${libtiff:location}/include -I${libjpeg:location}/include -I${libpng:location}/include
LDFLAGS=-L${gettext:location}/lib -Wl,-rpath=${gettext:location}/lib -L${glib:location}/lib -Wl,-rpath=${glib:location}/lib -L${libtiff:location}/lib -Wl,-rpath=${libtiff:location}/lib -L${libjpeg:location}/lib -Wl,-rpath=${libjpeg:location}/lib -L${libpng:location}/lib -Wl,-rpath=${libpng:location}/lib -L${zlib:location}/lib -Wl,-rpath=${zlib:location}/lib
LD_LIBRARY_PATH=${glib:location}/lib:${gettext:location}/lib
[atk]
recipe = hexagonit.recipe.cmmi
url = http://ftp.gnome.org/pub/gnome/sources/atk/2.0/atk-2.0.1.tar.bz2
md5sum = 87f20b78deaedef858ac54358c0786b1
environment =
PATH=${glib:location}/bin:${pkgconfig:location}/bin:%(PATH)s
PKG_CONFIG_PATH=${glib:location}/lib/pkgconfig
LDFLAGS=-L${gettext:location}/lib -Wl,-rpath=${gettext:location}/lib -L${glib:location}/lib -Wl,-rpath=${gettext:location}/lib
LD_LIBRARY_PATH=${glib:location}/lib:${gettext:location}/lib
[gtk-2]
recipe = hexagonit.recipe.cmmi
url = http://ftp.gnome.org/pub/gnome/sources/gtk+/2.24/gtk+-2.24.6.tar.bz2
md5sum = 421100f6597e613234f8dead6091a9fe
configure-options =
--disable-static
--disable-cups
--disable-papi
--enable-explicit-deps
environment =
PATH=${gdk-pixbuf:location}/bin:${glib:location}/bin:${pkgconfig:location}/bin:%(PATH)s
PKG_CONFIG_PATH=${glib:location}/lib/pkgconfig:${gettext:location}/lib/pkgconfig:${fontconfig:location}/lib/pkgconfig:${freetype:location}/lib/pkgconfig:${libXau:location}/lib/pkgconfig:${xproto:location}/lib/pkgconfig:${cairo:location}/lib/pkgconfig:${atk:location}/lib/pkgconfig:${gdk-pixbuf:location}/lib/pkgconfig:${pango:location}/lib/pkgconfig:${libX11:location}/lib/pkgconfig:${libXext:location}/lib/pkgconfig:${pixman:location}/lib/pkgconfig:${libpng:location}/lib/pkgconfig:${kbproto:location}/lib/pkgconfig:${libXrender:location}/lib/pkgconfig:${xextproto:location}/lib/pkgconfig:${libxcb:location}/lib/pkgconfig:${xcbproto:location}/lib/pkgconfig:${xorg-libpthread-stubs:location}/lib/pkgconfig
CPPFLAGS=-I${libtiff:location}/include -I${libjpeg:location}/include -I${libpng:location}/include -I${libX11:location}/include/ -I${xproto:location}/include -I${kbproto:location}/include -I${libXrender:location}/include -I${render:location}/include -I${libXext:location}/include -I${cairo:location}/include/cairo
LDFLAGS=-L${gettext:location}/lib -L${glib:location}/lib -L${libtiff:location}/lib -L${libjpeg:location}/lib -L${libpng:location}/lib -L${zlib:location}/lib -L${libXrender:location}/lib -L${libX11:location}/lib -L${libXext:location}/lib -L${pango:location}/lib
LD_LIBRARY_PATH=${glib:location}/lib:${gettext:location}/lib:${libX11:location}/lib
[buildout]
extends =
../gettext/buildout.cfg
../perl/buildout.cfg
../perl-XML-Parser/buildout.cfg
parts =
intltool
[intltool]
recipe = hexagonit.recipe.cmmi
url = http://edge.launchpad.net/intltool/trunk/0.41.1/+download/intltool-0.41.1.tar.gz
md5sum = d6c91bf06681919ccfdf3624035b75dc
depends =
${perl:version}
${perl-XML-Parser:location}
environment =
PATH=${perl:location}/bin:${gettext:location}/bin:${pkgconfig:location}/bin:%(PATH)s
PKG_CONFIG_PATH=${perl:location}/lib/pkgconfig
[buildout]
extends =
../xorg/buildout.cfg
parts =
mesa
[libdrm]
#does not seem to compile with -jX
recipe = hexagonit.recipe.cmmi
url = http://dri.freedesktop.org/libdrm/libdrm-2.4.26.tar.bz2
md5sum = 062569426773f69b11a47a7712bba770
configure-options =
--enable-nouveau-experimental-api
environment =
PATH=${pkgconfig:location}/bin:%(PATH)s
PKG_CONFIG_PATH=${xorg-libpthread-stubs:location}/lib/pkgconfig:${pciaccess:location}/lib/pkgconfig
[mesa]
recipe = hexagonit.recipe.cmmi
url = ftp://ftp.freedesktop.org//pub/mesa/7.11/MesaLib-7.11.tar.bz2
md5sum = ff03aca82d0560009a076a87c888cf13
configure-options =
--disable-static
--disable-driglx-direct
--disable-glu
--disable-glw
--disable-glut
--disable-egl
--disable-gallium-llvm
--with-gallium-drivers=
--with-dri-drivers=
--with-expat=${libexpat:location}
--with-driver=xlib
environment =
PATH=${pkgconfig:location}/bin:${makedepend:location}/bin:${flex:location}/bin:${bison:location}/bin:%(PATH)s
PKG_CONFIG_PATH=${libdrm:location}/lib/pkgconfig:${dri2proto:location}/lib/pkgconfig:${xorg-libpthread-stubs:location}/lib/pkgconfig:${pciaccess:location}/lib/pkgconfig:${libX11:location}/lib/pkgconfig:${glproto:location}/lib/pkgconfig:${libX11:location}/lib/pkgconfig:${libXext:location}/lib/pkgconfig:${xfixes:location}/lib/pkgconfig:${xdamage:location}/lib/pkgconfig:${xproto:location}/lib/pkgconfig:${xextproto:location}/lib/pkgconfig
CPPFLAGS=-I${libexpat:location}/include -I${libdrm:location}/include/libdrm -I${libdrm:location}/include -I${xproto:location}/include -I${libX11:location}/include -I${libXext:location}/include/ -I${xextproto:location}/include
LDFLAGS=-L${libexpat:location}/lib
PYTHON=${buildout:executable}
[buildout]
# Work in progress
extends =
../xorg/buildout.cfg
../fontconfig/buildout.cfg
../dbus/buildout.cfg
../gtk-2/buildout.cfg
../libpng/buildout.cfg
parts =
opera
[opera]
recipe = slapos.recipe.build
slapos_promise =
file:opera
depends =
${liberation-fonts:location}
${ipaex-fonts:location}
x86 = http://arc.opera.com/pub/opera/linux/1151/opera-11.51-1087.i386.linux.tar.bz2 91db21fc001e736a6432627fbf93062f
x86-64 = todohttp://arc.opera.com/pub/opera/linux/1151/opera-11.51-1087.i386.linux.tar.bz2 91db21fc001e736a6432627fbf93062f
script =
if not self.options.get('url'): self.options['url'], self.options['md5sum'] = self.options[guessPlatform()].split(' ')
extract_dir = self.extract(self.download(self.options['url'], self.options.get('md5sum')))
workdir = guessworkdir(extract_dir)
self.copyTree(workdir, "%(location)s")
wrapper_location = os.path.join("%(location)s", "opera-slapos")
wrapper = open(wrapper_location, 'w')
wrapper.write("""#!/bin/sh
cd %(location)s
export LD_LIBRARY_PATH=${libXrender:location}/lib/:${fontconfig:location}/lib/:${dbus:location}/lib/:${dbus-glib:location}/lib/:${pango:location}/lib:${cairo:location}/lib:${glib:location}/lib:${gtk-2:location}/lib:${atk:location}/lib:${gdk-pixbuf:location}/lib:${libXt:location}/lib:${libpng:location}/lib:${libSM:location}/lib:${libICE:location}/lib:%(location)s
export PATH=${fontconfig:location}/bin:$PATH
%(location)s/opera $*""")
wrapper.close()
profile_directory = os.path.join("%(location)s", "profile")
os.mkdir(profile_directory)
opera_config = open(os.path.join(profile_directory, "opera6.ini"), "w")
opera_config.write("""[State]
Reading Plugins=0
Accept License=1
Run=0""")
opera_config.close()
os.chmod(wrapper_location, 0766)
[buildout]
extends =
../libexpat/buildout.cfg
../libxml2/buildout.cfg
../perl/buildout.cfg
../perl-libwww-perl/buildout.cfg
../zlib/buildout.cfg
parts =
perl-XML-Parser
[perl-XML-Parser]
recipe = hexagonit.recipe.cmmi
depends =
${perl:version}
${perl-libwww-perl:location}
url = http://search.cpan.org/CPAN/authors/id/M/MS/MSERGEANT/XML-Parser-2.36.tar.gz
md5sum = 1b868962b658bd87e1563ecd56498ded
configure-command =
${perl:location}/bin/perl Makefile.PL \
EXPATINCPATH=${libexpat:location}/include \
EXPATLIBPATH=${libexpat:location}/lib \
INC="-I${libxml2:location}/include/libxml2" \
LIBS="-L${libxml2:location}/lib -L${zlib:location}/lib"
# Parallel make does not work for this package on fast machines
# with many cores
make-options =
OTHERLDFLAGS=" -Wl,-rpath=${libxml2:location}/lib -Wl,-rpath=${zlib:location}/lib" -j1
environment =
LD_LIBRARY_PATH=${libxml2:location}/lib:${zlib:location}/lib
PERLLIB=blib/lib
[buildout]
parts =
qt
[qt]
recipe = slapos.recipe.build
slapos_promisee =
file:plop
# Online installer
x86 = http://get.qt.nokia.com/qtsdk/Qt_SDK_Lin32_online_v1_1_3_en.run eae2e2a1396fec1369b66c71d7df6eab
x86-64 = http://get.qt.nokia.com/qtsdk/Qt_SDK_Lin64_online_v1_1_3_en.run a4d929bc4d6511290c07c3745477b77b
# Offline installer
#x86 = http://get.qt.nokia.com/qtsdk/Qt_SDK_Lin32_offline_v1_1_3_en.run 106fdae4ec8947c491ab0a827a02da12
#x86-64 = http://get.qt.nokia.com/qtsdk/Qt_SDK_Lin64_offline_v1_1_3_en.run 8c280beb11ee763840464572ed80e8b8
# Needs many dependencies.
script =
if not self.options.get('url'): self.options['url'], self.options['md5sum'] = self.options[guessPlatform()].split(' ')
download_file = self.download(self.options['url'], self.options.get('md5sum'))
extract_dir = tempfile.mkdtemp(self.name)
os.chdir(extract_dir)
(download_dir, filename) = os.path.split(download_file)
auto_extract_bin = os.path.join(extract_dir, filename)
shutil.move(download_file, auto_extract_bin)
os.chmod(auto_extract_bin, 0777)
subprocess.call([auto_extract_bin])
self.cleanup_dir_list.append(extract_dir)
workdir = guessworkdir(extract_dir)
import pdb; pdb.set_trace()
self.copyTree(os.path.join(workdir, "jre1.6.0_27"), "%(location)s")
#ldd qt.run
# linux-gate.so.1 => (0xb7827000)
# libutil.so.1 => /lib/i686/cmov/libutil.so.1 (0xb781c000)
# libgobject-2.0.so.0 => not found
# libSM.so.6 => not found
# libICE.so.6 => not found
# libXrender.so.1 => not found
# libfontconfig.so.1 => not found
# libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0xb77a4000)
# libz.so.1 => /usr/lib/libz.so.1 (0xb778f000)
# libXext.so.6 => /usr/lib/libXext.so.6 (0xb7780000)
# libX11.so.6 => /usr/lib/libX11.so.6 (0xb7663000)
# libdl.so.2 => /lib/i686/cmov/libdl.so.2 (0xb765f000)
# libgthread-2.0.so.0 => not found
# librt.so.1 => /lib/i686/cmov/librt.so.1 (0xb7655000)
# libglib-2.0.so.0 => not found
# libpthread.so.0 => /lib/i686/cmov/libpthread.so.0 (0xb763c000)
# libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb754d000)
# libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb7527000)
# libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7508000)
# libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb73c2000)
# libxcb.so.1 => /usr/lib/libxcb.so.1 (0xb73a9000)
# /lib/ld-linux.so.2 (0xb7828000)
# libXau.so.6 => /usr/lib/libXau.so.6 (0xb73a6000)
# libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb73a1000)
\ No newline at end of file
This diff is collapsed.
...@@ -89,6 +89,7 @@ setup(name=name, ...@@ -89,6 +89,7 @@ setup(name=name,
'pwgen = slapos.recipe.pwgen:Recipe', 'pwgen = slapos.recipe.pwgen:Recipe',
'proactive = slapos.recipe.proactive:Recipe', 'proactive = slapos.recipe.proactive:Recipe',
'request = slapos.recipe.request:Recipe', 'request = slapos.recipe.request:Recipe',
'seleniumrunner = slapos.recipe.seleniumrunner:Recipe',
'sheepdogtestbed = slapos.recipe.sheepdogtestbed:SheepDogTestBed', 'sheepdogtestbed = slapos.recipe.sheepdogtestbed:SheepDogTestBed',
'shell = slapos.recipe.shell:Recipe', 'shell = slapos.recipe.shell:Recipe',
'shellinabox = slapos.recipe.shellinabox:Recipe', 'shellinabox = slapos.recipe.shellinabox:Recipe',
......
seleniumrunner
==========
Allows to run selenium tests through browser and xvfb. Posts the results on
Nexedi ERP5.
Parameters
=====
* project : name of the project inside of ERP5 test result instance
* user : username to use in ERP5 instance to test
* password : password to use in ERP5 instance to test
* suite_name : name of test suite to launch
* url : url to portal_test of ERP5 isntance to test
* test_report_instance_url : url of test_result_module to put results
* Example :
<?xml version="1.0" encoding="utf-8"?>
<instance>
<parameter id="project">Vifib</parameter>
<parameter id="user">myuser</parameter>
<parameter id="password">mypassword</parameter>
<parameter id="suite_name">my_zuite</parameter>
<parameter id="url">https://myerp5totest/erp5/portal_tests</parameter>
<parameter id="test_report_instance_url">https://user:passwordwww.myerp5withtestresults.com/test_result_module/</parameter>
</instance>
This diff is collapsed.
##############################################################################
#
# 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
import zc.buildout
from slapos.recipe.librecipe import BaseSlapRecipe
class Recipe(BaseSlapRecipe):
def _install(self):
"""Set the connection dictionnary for the computer partition and create a list
of paths to the different wrappers."""
self.path_list = []
self.requirements, self.ws = self.egg.working_set()
self.installTestrunner(self.getDisplay())
self.linkBinary()
return self.path_list
def getDisplay(self):
"""Generate display id for the instance."""
display_list = [":%s" % i for i in range(123,144)]
for display_try in display_list:
lock_filepath = '/tmp/.X%s-lock' % display_try.replace(":", "")
if not os.path.exists(lock_filepath):
display = display_try
break
return display
def installTestrunner(self, display):
"""Instanciate a wrapper for the browser and the test reports."""
arguments = dict(
xvfb_binary = self.options['xvfb_binary'],
display = display,
suite_name = self.parameter_dict['suite_name'],
base_url = self.parameter_dict['url'],
browser_argument_list = [],
user = self.parameter_dict['user'],
password = self.parameter_dict['password'],
project = self.parameter_dict['project'],
test_report_instance_url = \
self.parameter_dict['test_report_instance_url'],
etc_directory = self.etc_directory)
# Check wanted browser XXX-Cedric not yet used but can be useful
#if self.parameter_dict.get('browser', None) is None:
arguments['browser_binary'] = self.options['firefox_binary']
#elif self.parameter_dict['browser'].strip().lowercase() == 'chrome' or
# self.parameter_dict['browser'].strip().lowercase() == 'chromium':
# arguments['browser_binary'] = self.options['chromium_binary']
# arguments['browser_argument_list'].extend['--ignore-certificate-errors',
# option_translate = '--disable-translate',
# option_security = '--disable-web-security']
#elif self.parameter_dict['browser'].strip().lowercase() == 'firefox':
# arguments['browser_binary'] = self.options['firefox_binary']
self.path_list.extend(zc.buildout.easy_install.scripts([(
'testrunner',__name__+'.testrunner', 'run')], self.ws,
sys.executable, self.wrapper_directory,
arguments=[arguments]))
def linkBinary(self):
"""Links binaries to instance's bin directory for easier exposal"""
for linkline in self.options.get('link_binary_list', '').splitlines():
if not linkline:
continue
target = linkline.split()
if len(target) == 1:
target = target[0]
path, linkname = os.path.split(target)
else:
linkname = target[1]
target = target[0]
link = os.path.join(self.bin_directory, linkname)
if os.path.lexists(link):
if not os.path.islink(link):
raise zc.buildout.UserError(
'Target link already %r exists but it is not link' % link)
os.unlink(link)
os.symlink(target, link)
self.logger.debug('Created link %r -> %r' % (link, target))
self.path_list.append(link)
##############################################################################
#
# 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 re
import urlparse
import urllib
import httplib
import mimetools
from random import randint
import tempfile
import os
import stat
import zipfile
import mimetypes
import datetime
TB_SEP = "============================================================="\
"========="
# REGEX FOR ZELENIUM TESTS
TEST_PASS_RE = re.compile('<th[^>]*>Tests passed</th>\n\s*<td[^>]*>([^<]*)')
TEST_FAILURE_RE = re.compile('<th[^>]*>Tests failed</th>\n\s*<td[^>]*>([^<]*)')
IMAGE_RE = re.compile('<img[^>]*?>')
TEST_ERROR_TITLE_RE = re.compile('(?:error.gif.*?>|title status_failed"><td[^>]*>)([^>]*?)</td></tr>', re.S)
TEST_RESULT_RE = re.compile('<div style="padding-top: 10px;">\s*<p>\s*'
'<img.*?</div>\s.*?</div>\s*', re.S)
DURATION_RE = re.compile('<th[^>]*>Elapsed time \(sec\)</th>\n\s*<td[^>]*>([^<]*)')
TEST_ERROR_RESULT_RE = re.compile('.*(?:error.gif|title status_failed).*', re.S)
def get_content_type(f):
return mimetypes.guess_type(f.name)[0] or 'application/octet-stream'
class ConnectionHelper:
def __init__(self, url):
self.conn = urlparse.urlparse(url)
if self.conn.scheme == 'http':
connection_type = httplib.HTTPConnection
if self.conn.port is None:
self.port = 80
else:
connection_type = httplib.HTTPSConnection
if self.conn.port is None:
self.port = 443
self.connection_type = connection_type
def _connect(self):
self.connection = self.connection_type(self.conn.hostname + ':' +
str(self.conn.port or self.port))
def POST(self, path, parameter_dict, file_list=None):
self._connect()
parameter_dict.update(__ac_name=self.conn.username,
__ac_password=self.conn.password)
header_dict = {'Content-type': "application/x-www-form-urlencoded"}
if file_list is None:
body = urllib.urlencode(parameter_dict)
else:
boundary = mimetools.choose_boundary()
header_dict['Content-type'] = 'multipart/form-data; boundary=%s' % (
boundary,)
body = ''
for k, v in parameter_dict.iteritems():
body += '--%s\r\n' % boundary
body += 'Content-Disposition: form-data; name="%s"\r\n' % k
body += '\r\n'
body += '%s\r\n' % v
for name, filename in file_list:
f = open(filename, 'r')
body += '--%s\r\n' % boundary
body += 'Content-Disposition: form-data; name="%s"; filename="%s"\r\n'\
% (name, name)
body += 'Content-Type: %s\r\n' % get_content_type(f)
body += 'Content-Length: %d\r\n' % os.fstat(f.fileno())[stat.ST_SIZE]
body += '\r\n'
body += f.read()
f.close()
body += '\r\n'
self.connection.request("POST", self.conn.path + '/' + path,
body, header_dict)
self.response = self.connection.getresponse()
class ERP5TestReportHandler:
def __init__(self, url, suite_name):
# random test id
self.test_id = "%s-%X" % (
("%s" % datetime.date.today()).replace("-", ""),
randint(1, 10000000000000000),
)
self.connection_helper = ConnectionHelper(url)
self.suite_name = suite_name
def reportStart(self):
# report that test is running
print 'Starting test with id %s' % self.test_id
self.connection_helper.POST('TestResultModule_reportRunning', dict(
test_suite=self.suite_name,
test_report_id=self.test_id,
))
def reportFinished(self, out_file):
# make file parsable by erp5_test_results
out_file, success, failure, duration = self.processResult(out_file)
# XXX-Cedric : make correct display in test_result_module
tempcmd = tempfile.mkstemp()[1]
tempcmd2 = tempfile.mkstemp()[1]
tempout = tempfile.mkstemp()[1]
templog = tempfile.mkstemp()[1]
tl = open(templog, 'w')
tl.write(TB_SEP + '\n')
tl.write(out_file)
tl.write("----------------------------------------------------------------------\n")
tl.write('Ran 1 test in %.2fs\n' % duration)
if success:
tl.write('OK\n')
else:
tl.write('FAILED (failures=1)\n')
tl.write(TB_SEP + '\n')
tl.close()
open(tempcmd, 'w').write(""" %s""" % self.suite_name)
# create nice zip archive
tempzip = tempfile.mkstemp()[1]
# XXX-Cedric : support multiple tests
zip = zipfile.ZipFile(tempzip, 'w')
zip.write(tempout, '%s/001/stdout' % self.suite_name)
zip.write(templog, '%s/001/stderr' % self.suite_name)
zip.write(tempcmd, '%s/001/cmdline' % self.suite_name)
zip.close()
os.unlink(templog)
os.unlink(tempcmd)
os.unlink(tempout)
os.unlink(tempcmd2)
# post it to ERP5
self.connection_helper.POST('TestResultModule_reportCompleted',
dict(test_report_id=self.test_id), file_list=[('filepath', tempzip)])
os.unlink(tempzip)
def processResult(self, out_file):
file_content = out_file
sucess_amount = TEST_PASS_RE.search(file_content).group(1)
failure_amount = TEST_FAILURE_RE.search(file_content).group(1)
error_title_list = [re.compile('\s+').sub(' ', x).strip()
for x in TEST_ERROR_TITLE_RE.findall(file_content)]
duration = DURATION_RE.search(file_content).group(1)
detail = ''
for test_result in TEST_RESULT_RE.findall(file_content):
if TEST_ERROR_RESULT_RE.match(test_result):
detail += test_result
detail = IMAGE_RE.sub('', detail)
if detail:
detail = IMAGE_RE.sub('', detail)
detail = '''<html>
<head>
<style type="text/css">tr.status_failed { background-color:red };</style>
</head>
<body>%s</body>
</html>''' % detail
return detail, int(sucess_amount), int(failure_amount), float(duration)
#!/bin/sh
# BEWARE: This file is operated by slapgrid
# BEWARE: It will be overwritten automatically
%(xvfb_binary) :%(display) -screen %(display) 1024x768x24
\ No newline at end of file
##############################################################################
#
# 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 datetime import datetime
from erp5functionaltestreporthandler import ERP5TestReportHandler
from ERP5TypeFunctionalTestCase import Xvfb, Firefox, TimeoutError
from time import sleep
import time
import os
import urllib2
def run(args):
config = args[0]
test_url = assembleTestUrl(config['base_url'], config['suite_name'],
config['user'], config['password'])
# There is no test that can take more them 24 hours
timeout = 2.0 * 60 * 60
while True:
erp5_report = ERP5TestReportHandler(config['test_report_instance_url'],
config['project'] + '@' + config['suite_name'])
try:
os.environ['DISPLAY'] = config['display']
xvfb = Xvfb(config['etc_directory'], config['xvfb_binary'])
profile_dir = os.path.join(config['etc_directory'], 'profile')
# XXX-Cedric : change Firefox prefs.js generation so that it can take a
# list of websites supposed to be reached instead of config['base_url']
browser = Firefox(profile_dir, config['base_url'], config['browser_binary'])
try:
start = time.time()
xvfb.run()
profile_dir = os.path.join(config['etc_directory'], 'profile')
browser.run(test_url , xvfb.display)
erp5_report.reportStart()
while not isTestFinished(config['base_url']):
time.sleep(10)
print("Test not finished yet.")
if (time.time() - start) > float(timeout):
raise TimeoutError("Test took more than %s seconds" % timeout)
except TimeoutError:
continue
finally:
browser.quit()
xvfb.quit()
print("Test has finished and Firefox has been killed.")
erp5_report.reportFinished(getStatus(config['base_url']).encode("utf-8",
"replace"))
print("Test finished and report sent, sleeping.")
except urllib2.URLError, urlError:
print "Error: %s" % urlError.msg
sleep(3600)
def openUrl(url):
# Send Accept-Charset headers to activate the UnicodeConflictResolver
# (imitating firefox 3.5.9 here)
headers = { 'Accept-Charset' : 'ISO-8859-1,utf-8;q=0.7,*;q=0.7' }
request = urllib2.Request(url, headers=headers)
# Try to use long timeout, this is needed when there is many
# activities runing
try:
f = urllib2.urlopen(request, timeout=3600*4)
except TypeError:
f = urllib2.urlopen(request)
file_content = f.read()
f.close()
return file_content
def isTestFinished(url):
"""Fetch latest report. If report has been created less than 60 seconds ago,
it must be the current one.
Return true if test is finished, else return false.
"""
latest_report = openUrl('%s/portal_tests/TestTool_getLatestReportId/' % url)
if latest_report is '':
return False
latest_report_date = latest_report[7:]
time_delta = datetime.now() - \
datetime.strptime(latest_report_date, '%Y%m%d_%H%M%S' )
if time_delta.days is not 0:
return False
if time_delta.seconds < 120:
return True
return False
def getStatus(url):
try:
# Try 5 times.
for i in range(5):
try:
status = openUrl('%s/portal_tests/TestTool_getResults/' % (url))
break
except urllib2.URLError, urlError:
if i is 4: raise
print("Warning : %s while getting status" % urlError.msg)
except urllib2.HTTPError, e:
if e.msg == "No Content":
status = ""
else:
raise
return status
def assembleTestUrl(base_url, suite_name, user, password):
"""
Create the full url to the testrunner
"""
test_url = "%s/%s/core/TestRunner.html?test=../test_suite_html&"\
"resultsUrl=%s/postResults&auto=on&__ac_name=%s&__ac_password=%s" % (
base_url, suite_name, base_url, user, password)
return test_url
\ No newline at end of file
[buildout]
parts =
seleniuminstance
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
[seleniuminstance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
xvfb_binary = ${xserver:location}/bin/Xvfb
firefox_binary = ${firefox:location}/firefox-slapos
\ No newline at end of file
[buildout]
extensions = buildout-versions
extends =
../../component/xorg/buildout.cfg
../../component/lxml-python/buildout.cfg
../../component/python-2.7/buildout.cfg
../../component/firefox/buildout.cfg
../../stack/shacache-client.cfg
versions = versions
find-links +=
http://www.nexedi.org/static/packages/source/slapos.buildout/
parts =
template
eggs
instance-recipe-egg
xserver
firefox
versions = versions
unzip = true
[instance-recipe]
egg = slapos.cookbook
module = seleniumrunner
[instance-recipe-egg]
recipe = zc.recipe.egg
python = python2.7
eggs = ${instance-recipe:egg}
[eggs]
recipe = zc.recipe.egg
python = python2.7
eggs =
${lxml-python:egg}
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
md5sum = 5fc198144831525a196d7394e4b15f80
output = ${buildout:directory}/template.cfg
mode = 0644
[versions]
# Use SlapOS patched zc.buildout
zc.buildout = 1.5.3-dev-SlapOS-010
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