1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-36127 Add MTR test for mariadb-upgrade-service on Windows

Added a test to verify mariadb-upgrade-service functionality on Windows.

The test runs mariadb-install-db.exe to create a Windows service, then
executes mariadb-upgrade-service.exe while the service is online
or offline.

There is no real cross-version upgrade in this test(not possible with
MTR), the actual goal is just to run smoke-test.

Last  times mariadb-upgrade-service was broken (CONC-760, MDEV-30639)
there were problems with named pipe connections, which could be detected
and prevented by smoke-test alone.
This commit is contained in:
Vladislav Vaintroub
2025-03-28 13:28:28 +01:00
parent fc60b89d0c
commit a632a69386
5 changed files with 164 additions and 9 deletions

View File

@@ -45,7 +45,6 @@ extern int upgrade_config_file(const char *myini_path);
"OPTIONS:"
static char mysqld_path[MAX_PATH];
static char mysqladmin_path[MAX_PATH];
static char mysqlupgrade_path[MAX_PATH];
static char defaults_file_param[MAX_PATH + 16]; /*--defaults-file=<path> */
@@ -455,8 +454,9 @@ int main(int argc, char **argv)
/*
Get full path to mysqld, we need it when changing service configuration.
Assume installation layout, i.e mysqld.exe, mysqladmin.exe, mysqlupgrade.exe
and mysql_upgrade_service.exe are in the same directory.
Assume mysqld.exe in the same directory as this program.
mysql_upgrade.exe is either in the same directory, or pointed to by
MARIADB_UPGRADE_EXE environment variable (in case of MTR running it)
*/
GetModuleFileName(NULL, bindir, FN_REFLEN);
p= strrchr(bindir, FN_LIBCHAR);
@@ -465,15 +465,19 @@ int main(int argc, char **argv)
*p= 0;
}
sprintf_s(mysqld_path, "%s\\mysqld.exe", bindir);
sprintf_s(mysqladmin_path, "%s\\mysqladmin.exe", bindir);
sprintf_s(mysqlupgrade_path, "%s\\mysql_upgrade.exe", bindir);
char *paths[]= {mysqld_path, mysqladmin_path, mysqlupgrade_path};
for(int i= 0; i< 3;i++)
if (access(mysqld_path, 0))
die("File %s does not exist", mysqld_path);
if (access(mysqlupgrade_path, 0))
{
if(GetFileAttributes(paths[i]) == INVALID_FILE_ATTRIBUTES)
die("File %s does not exist", paths[i]);
/* Try to get path from environment variable, set by MTR */
char *alt_mysqlupgrade_path= getenv("MARIADB_UPGRADE_EXE");
if (alt_mysqlupgrade_path)
sprintf_s(mysqlupgrade_path, "%s", alt_mysqlupgrade_path);
}
if (access(mysqlupgrade_path, 0))
die("File %s does not exist", mysqld_path);
/*
Messages written on stdout should not be buffered, GUI upgrade program