Beispiel #1
0
    def test_coro_main(self):
        coro.set_print_exit_string(None)

        for x in range(4):
            try:
                coro.spawn(exit_coro)
                coro.event_loop()
            except SystemExit:
                pass
    def test_coro_main(self):
        coro.set_print_exit_string(None)

        for x in range(4):
            try:
                coro.spawn(exit_coro)
                coro.event_loop()
            except SystemExit:
                pass
Beispiel #3
0
def run_tests():
    global main_thread
    coro.install_signal_handlers = 0
    coro.signal_handler.register (signal.SIGTERM, sigterm_handler)
    coro.signal_handler.register (signal.SIGINT, sigterm_handler)
    coro.set_exception_notifier(exception_notifier)
    main_thread = coro.spawn(main)
    coro.set_print_exit_string(False)
    coro.event_loop()
    sys.exit(exit_code)
Beispiel #4
0
def run_tests():
    global main_thread
    coro.install_signal_handlers = 0
    coro.signal_handler.register(signal.SIGTERM, sigterm_handler)
    coro.signal_handler.register(signal.SIGINT, sigterm_handler)
    coro.set_exception_notifier(exception_notifier)
    main_thread = coro.spawn(main)
    coro.set_print_exit_string(False)
    coro.event_loop()
    sys.exit(exit_code)
Beispiel #5
0
# -*- Mode: Python -*-
# Copyright (c) 2002-2011 IronPort Systems and Cisco Systems
# 
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# 
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# 
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.


import coro
import signal

if __name__ == '__main__':
    signal.signal(signal.SIGUSR1, signal.SIG_IGN)
    signal.signal(signal.SIGUSR2, signal.SIG_IGN)
    coro.set_print_exit_string(False)
    coro.event_loop (30.0)
Beispiel #6
0
        if self.writer_status:
            print 'Writer status:'
            items = self.writer_status.items()
            items.sort()
            for i, status in items:
                print '%i: %s' % (i, status)
        if self.reader_status:
            print 'Reader status:'
            items = self.reader_status.items()
            items.sort()
            for i, status in items:
                print '%i: %s' % (i, status)
        if self.lio_status:
            print 'LIO status:'
            items = self.lio_status.items()
            items.sort()
            for i, status in items:
                print '%i: %s' % (i, status)

if __name__ == '__main__':
    t = TestAIO()
    coro.set_print_exit_string(False)
    coro.install_signal_handlers = 0
    bd_path = comm_path.mk_backdoor_path('test_aio_lio')
    coro.spawn(backdoor.serve, unix_path = bd_path).set_name('backdoor')
    coro.signal_handler.register_signal_handler (signal.SIGINT, shutdown)
    coro.signal_handler.register_signal_handler (signal.SIGTERM, shutdown)
    coro.signal_handler.register_signal_handler (signal.SIGHUP, t.print_status)
    coro.spawn(t.main)
    coro.event_loop()