Changeset e2200db in mod_gnutls


Ignore:
Timestamp:
Jan 26, 2020, 1:23:49 PM (9 months ago)
Author:
Fiona Klute <fiona.klute@…>
Branches:
master, proxy-ticket
Children:
264ab17
Parents:
72ebe64
Message:

Test suite: Always run Apache with "-DFOREGROUND"

This simplifies process management a lot.

Location:
test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • test/mgstest/services.py

    r72ebe64 re2200db  
    121121
    122122    def wait_ready(self, timeout=None):
    123         """Wait for the started service to be ready. The function passed to
    124         the constructor as "check" is called to determine whether it is."""
     123        """Wait for the started service to be ready.
     124
     125        The function passed to the constructor as "check" is called to
     126        determine whether it is. Waiting also ends if self.process
     127        terminates.
     128
     129        Returns: None if the service is ready, or the return code if
     130        the process has terminated.
     131
     132        Raises a TimeoutError if the given timeout has been exceeded.
     133
     134        """
    125135        if not self.check:
    126             return
     136            return None
    127137
    128138        slept = 0
    129139        while not timeout or slept < timeout:
     140            if self.process and self.process.poll():
     141                return self.process.returncode
    130142            if self.check():
    131                 return
     143                return None
    132144            else:
    133145                sleep(self._step)
     
    165177                 valgrind_log=None):
    166178        self.config = Path(config).resolve()
    167         self.forking = True
    168179        base_cmd = [self.apache2, '-f', str(self.config), '-k']
    169         start_cmd = base_cmd + ['start']
    170         stop_cmd = base_cmd + ['stop']
     180        start_cmd = base_cmd + ['start', '-DFOREGROUND']
    171181        if valgrind_log:
    172182            start_cmd = ['valgrind', '-s', '--leak-check=full',
    173183                         '--track-origins=yes', '--vgdb=no',
    174184                         f'--log-file={valgrind_log}'] \
    175                          + start_cmd + ['-DFOREGROUND']
    176             self.forking = False
     185                         + start_cmd
    177186        if not check:
    178187            check = self.pidfile_check
    179188        super(ApacheService, self).__init__(start=start_cmd,
    180                                             stop=stop_cmd,
    181                                             forking=self.forking,
     189                                            stop=base_cmd + ['stop'],
     190                                            forking=False,
    182191                                            env=env,
    183192                                            pidfile=pidfile,
  • test/runtest.py

    r72ebe64 re2200db  
    169169
    170170        # special case: expected to fail in a few cases
    171         try:
    172             service_stack.enter_context(apache.run())
    173             if os.path.exists(os.path.join(testdir, 'fail.server')):
    174                 raise TestExpectationFailed(
    175                     'Server start did not fail as expected!')
    176             apache.wait_ready()
    177         except subprocess.CalledProcessError as e:
    178             if os.path.exists(os.path.join(testdir, 'fail.server')):
     171        service_stack.enter_context(apache.run())
     172        failed = apache.wait_ready()
     173        if os.path.exists(os.path.join(testdir, 'fail.server')):
     174            if failed:
    179175                print('Apache server failed to start as expected',
    180176                      file=sys.stderr)
    181177            else:
    182                 raise e
     178                raise TestExpectationFailed(
     179                    'Server start did not fail as expected!')
    183180
    184181        # Set TEST_TARGET for the request. Might be replaced with a
Note: See TracChangeset for help on using the changeset viewer.