mirror of
https://github.com/curl/curl.git
synced 2026-08-25 23:23:31 +03:00
pytest: use httpd/apache2 directly, no apachectl
Since the script 'apachectl' from the httpd project is severly mutilated on several distros, use the executable httpd/apache2 directly in pytest runs. Remove detection of apachectl form autoconf and cmake. Closes #16000
This commit is contained in:
parent
862244636e
commit
fa5d5ac1c9
6 changed files with 10 additions and 35 deletions
|
|
@ -40,12 +40,6 @@ if(NOT HTTPD)
|
|||
endif()
|
||||
mark_as_advanced(HTTPD)
|
||||
|
||||
find_program(APACHECTL "apache2ctl") # /usr/sbin/apache2ctl
|
||||
if(NOT APACHECTL)
|
||||
set(APACHECTL "")
|
||||
endif()
|
||||
mark_as_advanced(APACHECTL)
|
||||
|
||||
find_program(APXS "apxs")
|
||||
if(NOT APXS)
|
||||
set(APXS "")
|
||||
|
|
@ -58,5 +52,5 @@ if(NOT HTTPD_NGHTTPX)
|
|||
endif()
|
||||
mark_as_advanced(HTTPD_NGHTTPX)
|
||||
|
||||
# Consumed variables: APACHECTL, APXS, CADDY, HTTPD, HTTPD_NGHTTPX, VSFTPD
|
||||
# Consumed variables: APXS, CADDY, HTTPD, HTTPD_NGHTTPX, VSFTPD
|
||||
configure_file("config.ini.in" "${CMAKE_CURRENT_BINARY_DIR}/config.ini" @ONLY)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@
|
|||
[httpd]
|
||||
apxs = @APXS@
|
||||
httpd = @HTTPD@
|
||||
apachectl = @APACHECTL@
|
||||
|
||||
[nghttpx]
|
||||
nghttpx = @HTTPD_NGHTTPX@
|
||||
|
|
|
|||
|
|
@ -127,7 +127,6 @@ class EnvConfig:
|
|||
'ws': socket.SOCK_STREAM,
|
||||
})
|
||||
self.httpd = self.config['httpd']['httpd']
|
||||
self.apachectl = self.config['httpd']['apachectl']
|
||||
self.apxs = self.config['httpd']['apxs']
|
||||
if len(self.apxs) == 0:
|
||||
self.apxs = None
|
||||
|
|
@ -257,7 +256,6 @@ class EnvConfig:
|
|||
|
||||
def is_complete(self) -> bool:
|
||||
return os.path.isfile(self.httpd) and \
|
||||
os.path.isfile(self.apachectl) and \
|
||||
self.apxs is not None and \
|
||||
os.path.isfile(self.apxs)
|
||||
|
||||
|
|
@ -266,8 +264,6 @@ class EnvConfig:
|
|||
return 'httpd not configured, see `--with-test-httpd=<path>`'
|
||||
if not os.path.isfile(self.httpd):
|
||||
return f'httpd ({self.httpd}) not found'
|
||||
if not os.path.isfile(self.apachectl):
|
||||
return f'apachectl ({self.apachectl}) not found'
|
||||
if self.apxs is None:
|
||||
return "command apxs not found (commonly provided in apache2-dev)"
|
||||
if not os.path.isfile(self.apxs):
|
||||
|
|
@ -578,10 +574,6 @@ class Env:
|
|||
def httpd(self) -> str:
|
||||
return self.CONFIG.httpd
|
||||
|
||||
@property
|
||||
def apachectl(self) -> str:
|
||||
return self.CONFIG.apachectl
|
||||
|
||||
@property
|
||||
def apxs(self) -> str:
|
||||
return self.CONFIG.apxs
|
||||
|
|
|
|||
|
|
@ -63,7 +63,6 @@ class Httpd:
|
|||
|
||||
def __init__(self, env: Env, proxy_auth: bool = False):
|
||||
self.env = env
|
||||
self._cmd = env.apachectl
|
||||
self._apache_dir = os.path.join(env.gen_dir, 'apache')
|
||||
self._run_dir = os.path.join(self._apache_dir, 'run')
|
||||
self._lock_dir = os.path.join(self._apache_dir, 'locks')
|
||||
|
|
@ -102,7 +101,7 @@ class Httpd:
|
|||
self._rmf(self._error_log)
|
||||
|
||||
def exists(self):
|
||||
return os.path.exists(self._cmd)
|
||||
return os.path.exists(self.env.httpd)
|
||||
|
||||
def set_extra_config(self, domain: str, lines: Optional[Union[str, List[str]]]):
|
||||
if lines is None:
|
||||
|
|
@ -132,8 +131,8 @@ class Httpd:
|
|||
stderr=p.stderr.decode().splitlines(),
|
||||
duration=datetime.now() - start)
|
||||
|
||||
def _apachectl(self, cmd: str):
|
||||
args = [self.env.apachectl,
|
||||
def _cmd_httpd(self, cmd: str):
|
||||
args = [self.env.httpd,
|
||||
"-d", self._apache_dir,
|
||||
"-f", self._conf_file,
|
||||
"-k", cmd]
|
||||
|
|
@ -147,7 +146,7 @@ class Httpd:
|
|||
fd.write('start of server\n')
|
||||
with open(os.path.join(self._apache_dir, 'xxx'), 'a') as fd:
|
||||
fd.write('start of server\n')
|
||||
r = self._apachectl('start')
|
||||
r = self._cmd_httpd('start')
|
||||
if r.exit_code != 0:
|
||||
log.error(f'failed to start httpd: {r}')
|
||||
return False
|
||||
|
|
@ -155,7 +154,7 @@ class Httpd:
|
|||
return self.wait_live(timeout=timedelta(seconds=5))
|
||||
|
||||
def stop(self):
|
||||
r = self._apachectl('stop')
|
||||
r = self._cmd_httpd('stop')
|
||||
self._loaded_extra_configs = None
|
||||
if r.exit_code == 0:
|
||||
return self.wait_dead(timeout=timedelta(seconds=5))
|
||||
|
|
@ -168,7 +167,7 @@ class Httpd:
|
|||
|
||||
def reload(self):
|
||||
self._write_config()
|
||||
r = self._apachectl("graceful")
|
||||
r = self._cmd_httpd("graceful")
|
||||
self._loaded_extra_configs = None
|
||||
if r.exit_code != 0:
|
||||
log.error(f'failed to reload httpd: {r}')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue