~ubuntu-branches/debian/jessie/arb/jessie

« back to all changes in this revision

Viewing changes to UNIT_TESTER/UnitTester.hxx

  • Committer: Package Import Robot
  • Author(s): Elmar Pruesse, Andreas Tille, Elmar Pruesse
  • Date: 2014-09-02 15:15:06 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20140902151506-jihq58b3iz342wif
Tags: 6.0.2-1
[ Andreas Tille ]
* New upstream version
  Closes: #741890
* debian/upstream -> debian/upstream/metadata
* debian/control:
   - Build-Depends: added libglib2.0-dev
   - Depends: added mafft, mrbayes
* debian/rules
   - Add explicite --remove-section=.comment option to manual strip call
* cme fix dpkg-control
* arb-common.dirs: Do not create unneeded lintian dir
* Add turkish debconf translation (thanks for the patch to Mert Dirik
  <mertdirik@gmail.com>)
  Closes: #757497

[ Elmar Pruesse ]
* patches removed:
   - 10_config.makefiles.patch,
     80_no_GL.patch
       removed in favor of creating file from config.makefile.template via 
       sed in debian/control
   - 20_Makefile_main.patch
       merged upstream
   - 21_Makefiles.patch
       no longer needed
   - 30_tmpfile_CVE-2008-5378.patch: 
       merged upstream
   - 50_fix_gcc-4.8.patch:
       merged upstream
   - 40_add_libGLU.patch:
       libGLU not needed for arb_ntree)
   - 60_use_debian_packaged_raxml.patch:
       merged upstream
   - 70_hardening.patch
       merged upstream
   - 72_add_math_lib_to_linker.patch
       does not appear to be needed
* patches added:
   - 10_upstream_r12793__show_db_load_progress:
       backported patch showing progress while ARB is loading a database
       (needed as indicator/splash screen while ARB is launching)
   - 20_upstream_r12794__socket_permissions:
       backported security fix
   - 30_upstream_r12814__desktop_keywords:
       backported add keywords to desktop (fixes lintian warning)
   - 40_upstream_r12815__lintian_spelling:
       backported fix for lintian reported spelling errors
   - 50_private_nameservers
       change configuration to put nameservers into users home dirs
       (avoids need for shared writeable directory)
   - 60_use_debian_phyml
       use phyml from debian package for both interfaces in ARB
* debian/rules:
   - create config.makefile from override_dh_configure target
   - use "make tarfile" in override_dh_install
   - remove extra cleaning not needed for ARB 6
   - use "dh_install --list-missing" to avoid missing files
   - added override_dh_fixperms target
* debian/control:
   - added libarb-dev package
   - Depends: added phyml, xdg-utils
   - Suggests: removed phyml
   - fix lintian duplicate-short-description (new descriptions)
* debian/*.install:
   - "unrolled" confusing globbing to select files
   - pick files from debian/tmp
   - moved all config files to /etc/arb
* debian/arb-common.templates: updated
* scripts:
   - removed arb-add-pt-server
   - launch-wrapper: 
     - only add demo.arb to newly created $ARBUSERDATA
     - pass commandline arguments through bin/arb wrapper
   - preinst: removing old PT server index files on upgrade from 5.5*
   - postinst: set setgid on shared PT dir
* rewrote arb.1 manfile
* added file icon for ARB databases
* using upstream arb_tcp.dat

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// ================================================================ //
 
2
//                                                                  //
 
3
//   File      : UnitTester.hxx                                     //
 
4
//   Purpose   : unit testing - test one unit                       //
 
5
//                                                                  //
 
6
//   Coded by Ralf Westram (coder@reallysoft.de) in February 2010   //
 
7
//   Institute of Microbiology (Technical University Munich)        //
 
8
//   http://www.arb-home.de/                                        //
 
9
//                                                                  //
 
10
// ================================================================ //
 
11
 
 
12
#ifndef UNITTESTER_HXX
 
13
#define UNITTESTER_HXX
 
14
 
 
15
#ifndef _GLIBCXX_CSTDLIB
 
16
#include <cstdlib>
 
17
#endif
 
18
#ifndef _GLIBCXX_CSTDIO
 
19
#include <cstdio>
 
20
#endif
 
21
 
 
22
typedef void (*UnitTest_function)();
 
23
 
 
24
enum UnitTestResult {
 
25
    TEST_OK,
 
26
    TEST_TRAPPED,
 
27
    TEST_FAILED_POSTCONDITION,
 
28
    TEST_INTERRUPTED, 
 
29
    TEST_THREW,
 
30
    TEST_INVALID,
 
31
    TEST_UNKNOWN_RESULT,
 
32
};
 
33
 
 
34
struct UnitTest_simple {
 
35
    UnitTest_function  fun;
 
36
    const char        *name;
 
37
    const char        *location;
 
38
 
 
39
    void print_error(FILE *out, UnitTestResult result) const;
 
40
};
 
41
 
 
42
struct UnitTester {
 
43
    UnitTester(const char *libname, const UnitTest_simple *simple_tests, int warn_level, size_t skippedTests, const UnitTest_simple *postcond) __attribute__((noreturn));
 
44
};
 
45
 
 
46
UnitTestResult execute_guarded(UnitTest_function fun, long *duration_usec, long max_allowed_duration_ms, bool detect_environment_calls);
 
47
void sleepms(long ms);
 
48
 
 
49
// ------------------------------
 
50
//      execution time limits
 
51
 
 
52
const long SECONDS = 1000;
 
53
const long MINUTES = 60*SECONDS;
 
54
 
 
55
#if defined(DEVEL_RALF)
 
56
 
 
57
const long MAX_EXEC_MS_NORMAL = 12 * SECONDS;       // kill with segfault after time passed
 
58
const long MAX_EXEC_MS_SLOW   = 60 * SECONDS;       // same for slow tests
 
59
const long MAX_EXEC_MS_ENV    = 80 * SECONDS;       // same for environment setup/cleanup
 
60
const long MAX_EXEC_MS_VGSYS  = 140 * SECONDS;      // same for valgrinded system calls (especially pt_server)
 
61
 
 
62
const long WARN_SLOW_ABOVE_MS = 1 * SECONDS;        // when too warn about slow test
 
63
 
 
64
#else // !defined(DEVEL_RALF)
 
65
 
 
66
// these are temporary test-timings to avoid test timeouts on jenkins build server
 
67
 
 
68
const long MAX_EXEC_MS_NORMAL = 30 * MINUTES;       // kill with segfault after time passed
 
69
const long MAX_EXEC_MS_SLOW   = 45 * MINUTES;       // same for slow tests
 
70
const long MAX_EXEC_MS_ENV    = 45 * MINUTES;       // same for environment setup/cleanup
 
71
const long MAX_EXEC_MS_VGSYS  = 45 * MINUTES;       // same for valgrinded system calls (especially pt_server)
 
72
const long WARN_SLOW_ABOVE_MS = 30 * MINUTES;       // when too warn about slow test
 
73
 
 
74
#endif
 
75
 
 
76
#define FLAGS_DIR "flags"
 
77
#define FLAGS_EXT "flag"
 
78
 
 
79
#else
 
80
#error UnitTester.hxx included twice
 
81
#endif // UNITTESTER_HXX