~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/dbqp.py

  • Committer: Andrew Hutchings
  • Date: 2011-02-01 10:23:22 UTC
  • mto: (2136.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 2137.
  • Revision ID: andrew@linuxjedi.co.uk-20110201102322-oxztcyrjzg3c7yta
Fix counters cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /usr/bin/env python
2
 
# -*- mode: python; indent-tabs-mode: nil; -*-
 
1
#! /usr/bin/python
 
2
# -*- mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
3
3
# vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
4
#
5
5
# Copyright (C) 2010 Patrick Crews
51
51
execution_manager = None
52
52
 
53
53
try:
54
 
    # We do this nested try to accomodate red hat
55
 
    # running python 2.4...seriously?  2.4?
56
 
    try:
57
 
        # Some system-level work is constant regardless
58
 
        # of the test to be run
59
 
        system_manager = systemManager(variables)
60
 
 
61
 
        # Create our server_manager
62
 
        server_manager = serverManager(system_manager, variables)
63
 
 
64
 
        # Get our mode-specific test_manager and test_executor
65
 
        (test_manager,test_executor) = handle_mode(variables, system_manager)
66
 
 
67
 
        # Gather our tests for execution
68
 
        test_manager.gather_tests()
69
 
 
70
 
        # Initialize test execution manager
71
 
        execution_manager = executionManager(server_manager, system_manager
72
 
                                        , test_manager, test_executor
73
 
                                        , variables)
74
 
 
75
 
        # Execute our tests!
76
 
        execution_manager.execute_tests()
77
 
    
78
 
    except Exception, e:
79
 
       print Exception, e
80
 
 
81
 
    except KeyboardInterrupt:
82
 
      print "\n\nDetected <Ctrl>+c, shutting down and cleaning up..."
 
54
    # Some system-level work is constant regardless
 
55
    # of the test to be run
 
56
    system_manager = systemManager(variables)
 
57
 
 
58
    # Create our server_manager
 
59
    server_manager = serverManager(system_manager, variables)
 
60
 
 
61
    # Get our mode-specific test_manager and test_executor
 
62
    (test_manager,test_executor) = handle_mode(variables, system_manager)
 
63
 
 
64
    # Gather our tests for execution
 
65
    test_manager.gather_tests()
 
66
 
 
67
    # Initialize test execution manager
 
68
    execution_manager = executionManager(server_manager, system_manager
 
69
                                    , test_manager, test_executor
 
70
                                    , variables)
 
71
 
 
72
    # Execute our tests!
 
73
    execution_manager.execute_tests()
 
74
 
 
75
except Exception, e:
 
76
   print Exception, e
 
77
 
 
78
except KeyboardInterrupt:
 
79
  print "\n\nDetected <Ctrl>+c, shutting down and cleaning up..."
83
80
 
84
81
finally:
85
82
# TODO - make a more robust cleanup
86
83
# At the moment, runaway servers are our biggest concern
87
84
    if server_manager and not variables['startandexit']:
88
 
        if variables['gdb']:
89
 
            server_manager.cleanup_all_servers()
90
 
        else:
91
 
            server_manager.cleanup()
92
 
    if not variables['startandexit']:
93
 
        if test_manager:
94
 
            fail_count = test_manager.has_failing_tests()
95
 
            sys.exit(test_manager.has_failing_tests())
96
 
        else:
97
 
            # return 1 as we likely have a problem if we don't have a
98
 
            # test_manager
99
 
            sys.exit(1)
 
85
        server_manager.cleanup()
100
86