Changeset: 5df4dfc76be7 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/5df4dfc76be7 Modified Files: sql/test/sysmon/Tests/sys_queue_expand.SQL.py Branch: default Log Message:
Merge with Sep2022 branch. diffs (truncated from 524 to 300 lines): diff --git a/common/stream/Tests/urlstream.py b/common/stream/Tests/urlstream.py --- a/common/stream/Tests/urlstream.py +++ b/common/stream/Tests/urlstream.py @@ -10,18 +10,12 @@ import time OUTPUT = io.StringIO() -def pickport(): - # pick a free port number - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - s.bind(('', 0)) - port = s.getsockname()[1] - s.close() - return port - - -def wait_for_server(port, timeout): +def wait_for_server(timeout): deadline = time.time() + timeout while time.time() < deadline: + if port == 0: + time.sleep(0.25) + continue s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.settimeout(0.1) try: @@ -31,7 +25,8 @@ def wait_for_server(port, timeout): time.sleep(0.1) finally: s.close() - print(f'Warning: waited {timeout} seconds for the server to start but could still not connect', file=OUTPUT) + else: + print(f'Warning: waited {timeout} seconds for the server to start but could still not connect', file=OUTPUT) class Handler(http.server.BaseHTTPRequestHandler): @@ -72,17 +67,19 @@ class Handler(http.server.BaseHTTPReques self.end_headers() self.wfile.write(b'NOT FOUND\n') -def runserver(port): - addr = ('', port) +def runserver(): + global port + addr = ('', 0) + srv = http.server.HTTPServer(addr, Handler) + port = srv.server_port print(f"Listening on {port}", file=OUTPUT) - srv = http.server.HTTPServer(addr, Handler) srv.serve_forever() # Start the http server -port = pickport() -t = threading.Thread(target=lambda: runserver(port), daemon=True) +port = 0 +t = threading.Thread(target=lambda: runserver(), daemon=True) t.start() -wait_for_server(port, 5.0) +wait_for_server(5.0) url = f'http://localhost:{port}' diff --git a/monetdb5/mal/mal_authorize.c b/monetdb5/mal/mal_authorize.c --- a/monetdb5/mal/mal_authorize.c +++ b/monetdb5/mal/mal_authorize.c @@ -50,8 +50,7 @@ static AUTHCallbackCntx authCallbackCntx void AUTHreset(void) { - if (vaultKey != NULL) - GDKfree(vaultKey); + GDKfree(vaultKey); vaultKey = NULL; } @@ -414,8 +413,7 @@ AUTHunlockVault(const char *password) /* even though I think this function should be called only once, it * is not of real extra efforts to avoid a mem-leak if it is used * multiple times */ - if (vaultKey != NULL) - GDKfree(vaultKey); + GDKfree(vaultKey); if ((vaultKey = GDKstrdup(password)) == NULL) throw(MAL, "unlockVault", SQLSTATE(HY013) MAL_MALLOC_FAIL " vault key"); @@ -502,7 +500,7 @@ AUTHcypherValue(str *ret, const char *va keylen = strlen(vaultKey); /* XOR all characters. If we encounter a 'zero' char after the XOR - * operation, escape it with an 'one' char. */ + * operation, escape it with a 'one' char. */ for (; *s != '\0'; s++) { *w = *s ^ vaultKey[(s - value) % keylen]; if (*w == '\0') { diff --git a/monetdb5/mal/mal_embedded.c b/monetdb5/mal/mal_embedded.c --- a/monetdb5/mal/mal_embedded.c +++ b/monetdb5/mal/mal_embedded.c @@ -53,7 +53,6 @@ malEmbeddedBoot(int workerlimit, int mem /* unlock the vault, first see if we can find the file which * holds the secret */ char secret[1024]; - char *secretp = secret; FILE *secretf; size_t len; @@ -78,7 +77,7 @@ malEmbeddedBoot(int workerlimit, int mem "(%zu), enlarge your vault key!\n", len); } } - if ((msg = AUTHunlockVault(secretp)) != MAL_SUCCEED) { + if ((msg = AUTHunlockVault(secret)) != MAL_SUCCEED) { /* don't show this as a crash */ return msg; } diff --git a/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.py b/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.py --- a/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.py +++ b/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.py @@ -22,6 +22,10 @@ if not os.path.exists(archive): sys.exit(1) # unpackage database +try: + os.remove(os.path.join(db, '.vaultkey')) +except FileNotFoundError: + pass with zipfile.ZipFile(archive) as z: z.extractall(path=db) diff --git a/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.py b/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.py --- a/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.py +++ b/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.py @@ -22,6 +22,10 @@ if not os.path.exists(archive): sys.exit(1) # unpackage database +try: + os.remove(os.path.join(db, '.vaultkey')) +except FileNotFoundError: + pass with zipfile.ZipFile(archive) as z: z.extractall(path=db) diff --git a/sql/test/emptydb-previous-upgrade-hge/Tests/upgrade.py b/sql/test/emptydb-previous-upgrade-hge/Tests/upgrade.py --- a/sql/test/emptydb-previous-upgrade-hge/Tests/upgrade.py +++ b/sql/test/emptydb-previous-upgrade-hge/Tests/upgrade.py @@ -22,6 +22,10 @@ if not os.path.exists(archive): sys.exit(1) # unpackage database +try: + os.remove(os.path.join(db, '.vaultkey')) +except FileNotFoundError: + pass with zipfile.ZipFile(archive) as z: z.extractall(path=db) diff --git a/sql/test/emptydb-previous-upgrade/Tests/upgrade.py b/sql/test/emptydb-previous-upgrade/Tests/upgrade.py --- a/sql/test/emptydb-previous-upgrade/Tests/upgrade.py +++ b/sql/test/emptydb-previous-upgrade/Tests/upgrade.py @@ -22,6 +22,10 @@ if not os.path.exists(archive): sys.exit(1) # unpackage database +try: + os.remove(os.path.join(db, '.vaultkey')) +except FileNotFoundError: + pass with zipfile.ZipFile(archive) as z: z.extractall(path=db) diff --git a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.py b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.py --- a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.py +++ b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.py @@ -22,6 +22,10 @@ if not os.path.exists(archive): sys.exit(1) # unpackage database +try: + os.remove(os.path.join(db, '.vaultkey')) +except FileNotFoundError: + pass with zipfile.ZipFile(archive) as z: z.extractall(path=db) diff --git a/sql/test/emptydb-upgrade-chain/Tests/upgrade.py b/sql/test/emptydb-upgrade-chain/Tests/upgrade.py --- a/sql/test/emptydb-upgrade-chain/Tests/upgrade.py +++ b/sql/test/emptydb-upgrade-chain/Tests/upgrade.py @@ -22,6 +22,10 @@ if not os.path.exists(archive): sys.exit(1) # unpackage database +try: + os.remove(os.path.join(db, '.vaultkey')) +except FileNotFoundError: + pass with zipfile.ZipFile(archive) as z: z.extractall(path=db) diff --git a/sql/test/emptydb-upgrade-hge/Tests/upgrade.py b/sql/test/emptydb-upgrade-hge/Tests/upgrade.py --- a/sql/test/emptydb-upgrade-hge/Tests/upgrade.py +++ b/sql/test/emptydb-upgrade-hge/Tests/upgrade.py @@ -22,6 +22,10 @@ if not os.path.exists(archive): sys.exit(1) # unpackage database +try: + os.remove(os.path.join(db, '.vaultkey')) +except FileNotFoundError: + pass with zipfile.ZipFile(archive) as z: z.extractall(path=db) diff --git a/sql/test/emptydb-upgrade/Tests/upgrade.py b/sql/test/emptydb-upgrade/Tests/upgrade.py --- a/sql/test/emptydb-upgrade/Tests/upgrade.py +++ b/sql/test/emptydb-upgrade/Tests/upgrade.py @@ -22,6 +22,10 @@ if not os.path.exists(archive): sys.exit(1) # unpackage database +try: + os.remove(os.path.join(db, '.vaultkey')) +except FileNotFoundError: + pass with zipfile.ZipFile(archive) as z: z.extractall(path=db) diff --git a/sql/test/sysmon/Tests/sys_queue_expand.SQL.py b/sql/test/sysmon/Tests/sys_queue_expand.SQL.py --- a/sql/test/sysmon/Tests/sys_queue_expand.SQL.py +++ b/sql/test/sysmon/Tests/sys_queue_expand.SQL.py @@ -55,7 +55,7 @@ def main(): # Check the long running query, but lets first wait for a moment for the # workers to start with their queries mstcur.execute('call sys.sleep(1000)') - query = 'select username, status, query from sys.queue() where query like \'call sys.sleep(5000)%\' order by query' + query = 'select username, status, query from sys.queue() where query like \'call sys.sleep('+SLEEP_TIME+')%\' order by query' expected_res = [ ('monetdb', 'running', 'call sys.sleep('+SLEEP_TIME+')\n;'), ('monetdb', 'running', 'call sys.sleep('+SLEEP_TIME+')\n;'), @@ -68,10 +68,11 @@ def main(): # Exit the completed processes [p.join() for p in jobs] - # sys.queue() should have been expanded from 4 to 8, so we should be able - # to have 8 queries in the queue + # sys.queue() should have been expanded from 4 to 8, so we + # should be able to have 8 queries in the queue mstcur.execute('select 6') mstcur.execute('select 7') + mstcur.execute('select 8') query = 'select count(*) from sys.queue()' expected_res = 8 rowcnt = mstcur.execute(query) diff --git a/sql/test/testdb-previous-upgrade-chain-hge/Tests/upgrade.py b/sql/test/testdb-previous-upgrade-chain-hge/Tests/upgrade.py --- a/sql/test/testdb-previous-upgrade-chain-hge/Tests/upgrade.py +++ b/sql/test/testdb-previous-upgrade-chain-hge/Tests/upgrade.py @@ -22,6 +22,10 @@ if not os.path.exists(archive): sys.exit(1) # unpackage database +try: + os.remove(os.path.join(db, '.vaultkey')) +except FileNotFoundError: + pass with zipfile.ZipFile(archive) as z: z.extractall(path=db) diff --git a/sql/test/testdb-previous-upgrade-chain/Tests/upgrade.py b/sql/test/testdb-previous-upgrade-chain/Tests/upgrade.py --- a/sql/test/testdb-previous-upgrade-chain/Tests/upgrade.py +++ b/sql/test/testdb-previous-upgrade-chain/Tests/upgrade.py @@ -22,6 +22,10 @@ if not os.path.exists(archive): sys.exit(1) # unpackage database +try: + os.remove(os.path.join(db, '.vaultkey')) +except FileNotFoundError: + pass with zipfile.ZipFile(archive) as z: z.extractall(path=db) diff --git a/sql/test/testdb-previous-upgrade-hge/Tests/upgrade.py b/sql/test/testdb-previous-upgrade-hge/Tests/upgrade.py --- a/sql/test/testdb-previous-upgrade-hge/Tests/upgrade.py +++ b/sql/test/testdb-previous-upgrade-hge/Tests/upgrade.py @@ -22,6 +22,10 @@ if not os.path.exists(archive): sys.exit(1) # unpackage database +try: + os.remove(os.path.join(db, '.vaultkey')) +except FileNotFoundError: + pass with zipfile.ZipFile(archive) as z: z.extractall(path=db) diff --git a/sql/test/testdb-previous-upgrade/Tests/upgrade.py b/sql/test/testdb-previous-upgrade/Tests/upgrade.py --- a/sql/test/testdb-previous-upgrade/Tests/upgrade.py +++ b/sql/test/testdb-previous-upgrade/Tests/upgrade.py @@ -22,6 +22,10 @@ if not os.path.exists(archive): sys.exit(1) _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org