test/cql-pytest: allow "run-cassandra" without building Scylla

Before this patch, all scripts which use test/cql-pytest/run.py
looked for the Scylla executable as their first step. This is usually
the right thing to do, except in two cases where Scylla is *not* needed:

1. The script test/cql-pytest/run-cassandra.
2. The script test/alternator/run with the "--aws" option.

So in this patch we change run.py to only look for Scylla when actually
needed (the find_scylla() function is called). In both cases mentioned
above, find_scylla() will never get called and the script can work even
if Scylla was never built.

Signed-off-by: Nadav Har'El <nyh@scylladb.com>

Closes #13010
This commit is contained in:
Nadav Har'El
2023-02-27 15:27:11 +02:00
committed by Botond Dénes
parent eb10623dd2
commit 7dc54771e1
6 changed files with 21 additions and 14 deletions

View File

@@ -21,7 +21,7 @@ if '--aws' in sys.argv:
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
print('Scylla is: ' + run.scylla + '.')
print('Scylla is: ' + run.find_scylla() + '.')
# If the "--raft" option is given, switch to the experimental Raft-based
# implementation of schema operations. When the experimental feature becomes

View File

@@ -4,7 +4,7 @@ import sys
import run # run.py in this directory
print('Scylla is: ' + run.scylla + '.')
print('Scylla is: ' + run.find_scylla() + '.')
ssl = '--ssl' in sys.argv
if ssl:

View File

@@ -162,17 +162,24 @@ import ssl
# next to the location of this script, but this can be overridden by setting
# a SCYLLA environment variable:
source_path = os.path.realpath(os.path.join(__file__, '../../..'))
scylla = None
def find_scylla():
scyllas = glob.glob(os.path.join(source_path, 'build/*/scylla'))
if not scyllas:
print("Can't find a Scylla executable in {}.\nPlease build Scylla or set SCYLLA to the path of a Scylla executable.".format(source_path))
global scylla
global source_path
if scylla:
return scylla
if os.getenv('SCYLLA'):
scylla = os.path.abspath(os.getenv('SCYLLA'))
else:
scyllas = glob.glob(os.path.join(source_path, 'build/*/scylla'))
if not scyllas:
print("Can't find a Scylla executable in {}.\nPlease build Scylla or set SCYLLA to the path of a Scylla executable.".format(source_path))
exit(1)
scylla = max(scyllas, key=os.path.getmtime)
if not os.access(scylla, os.X_OK):
print("Cannot execute '{}'.\nPlease set SCYLLA to the path of a Scylla executable.".format(scylla))
exit(1)
return max(scyllas, key=os.path.getmtime)
scylla = os.path.abspath(os.getenv('SCYLLA') or find_scylla())
if not os.access(scylla, os.X_OK):
print("Cannot execute '{}'.\nPlease set SCYLLA to the path of a Scylla executable.".format(scylla))
exit(1)
return scylla
def run_scylla_cmd(pid, dir):
ip = pid_to_ip(pid)

View File

@@ -6,7 +6,7 @@ import run
import redis
print('Scylla is: ' + run.scylla + '.')
print('Scylla is: ' + run.find_scylla() + '.')
REDIS_PORT = 6379

View File

@@ -6,7 +6,7 @@ import sys
sys.path.insert(1, sys.path[0] + '/../cql-pytest')
import run
print('Scylla is: ' + run.scylla + '.')
print('Scylla is: ' + run.find_scylla() + '.')
ssl = '--ssl' in sys.argv
if ssl:

View File

@@ -8,7 +8,7 @@ import subprocess
sys.path.insert(1, sys.path[0] + '/../cql-pytest')
import run
print('Scylla is: ' + run.scylla + '.')
print('Scylla is: ' + run.find_scylla() + '.')
# Gdb will only work if the executable was built with debug symbols
# (e.g., Scylla's release or debug build modes mode, but not dev mode).