mandriva

Sotfware Quality

Code Guideline

The guideline are described in these documents:

SVN Repository Commit Rules

A developer who writes a commit message must follow these rules:

  • the message is written in English with UTF-8 encoding, and must be checked with a spell checker
  • the commit message format is:
    * First message
    * Second message
      * First note
      * Second note
    
  • the message must be factual only
  • if the commit closes a trac ticket, it must be written like this: (closes #bugnumber)
  • if merging changeset from a branch, use this format:
    * Merging changeset #changeset from branch name_of_the_branch
      * First note about this changeset
      * Second note ...
    
  • if the commit is an external contribution
    * Patch from John Doe
      * First note
      * Second note ...
    

SVN Repository Pre-commit Hook

Each developer commit is checked by a pre-commit hook. If the check fails, the commit is refused.

The following checks are done:

  • PHP file
    • PHP language syntax check
    • svn:keywords property contains "Id"
    • SVN add only: basic check of copyright and GPL license
  • Python file:
    • Python language syntax check
    • the Python module has a docstring
    • svn:keywords property contains "Id"
    • SVN add only: check encoding declaration at the beginning: # -*- coding: utf-8; -*-
    • SVN add only: basic check of copyright and GPL license
  • .spec file (RPM):
    • .spec language syntax check
    • RPM version matches latest RPM changelog version
  • .po file: the file is encoded in UTF-8
  • XML file:
    • XML is valid
    • svn:keywords property contains "Id"

Continuous integration

A buildbot is used to automate Pulse 2 build and testing. Click here to go to the Pulse 2 Buildbot web interface.

Here is the buildbot slaves description:

NamePlatformTestsPeriod
Selenium Mandriva MES5Mandriva MES5Web interface tests with SeleniumEvery night at 2am
Imaging Client Full Build MES5Mandriva MES5Complete build of the Pulse 2 imaging clientEvery night at 1am
XML-RPC service Unit Tests Mandriva MES5 Mandriva MES5Unit tests of Pulse 2 XML-RPC servicesEvery commit
Python pyflakesDebian EtchPyflakes run on Pulse 2 Python codeEvery commit
Imaging Client Tools Build EtchDebian EtchPartial build of the Pulse 2 imaging client toolsEvery commit
Imaging Client Full Build EtchDebian EtchComplete build of the Pulse 2 imaging clientMidnight

Writing tests for Pulse 2

How tests are launched

The Pulse 2 main Makefile contains three targets to launch unit tests:

  • unit-tests : run simple unit tests
  • xmlrpc-tests : run XML-RPC service unit tests
  • selenium : run Selenium tests

For now, these targets work only with the Pulse 2 quick install script, which installs a full Pulse 2 server. When calling the quick install script, just pass one of these targets as an argument, and the target will be executed. If a test failed, a non-null exit code will be set. The install script works on Mandriva CS4, Mandriva MES5 and Mandriva 2010.0.

Simple unit tests

The unit-tests target will run all unit test Python files contained in the directory http://pulse2.mandriva.org/browser/pulse2/server/trunk/services/pulse2/tests

XML-RPC services unit tests

The xmlrpc-tests target starts this script. This script is still WIP: it runs Python files that tests the XML-RPC services, and prints the percentage of tests coverage.

Selenium tests

The selenium target starts a Selenium tests run using this test suite: http://pulse2.mandriva.org/browser/pulse2/server/trunk/tests/selenium/suite

The script that starts Selenium is run-selenium.sh. It only works for now on Mandriva CS4.