File: mariadb-upgrade-service.test

package info (click to toggle)
mariadb 1%3A11.8.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 772,520 kB
  • sloc: ansic: 2,414,714; cpp: 1,791,394; asm: 381,336; perl: 62,905; sh: 49,647; pascal: 40,897; java: 39,363; python: 20,791; yacc: 20,432; sql: 17,907; xml: 12,344; ruby: 8,544; cs: 6,542; makefile: 6,145; ada: 1,879; lex: 1,193; javascript: 996; objc: 80; tcl: 73; awk: 46; php: 22
file content (113 lines) | stat: -rw-r--r-- 2,932 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
source include/windows.inc;
let $datadir_name=data;
let $service_name_prefix=mariadb;
let $password=password;

source include/check_windows_admin.inc;

# The test uses return code from sc.exe utility, which are as follows
let $ERROR_SERVICE_DOES_NOT_EXIST= 1060;
let $ERROR_SERVICE_CANNOT_ACCEPT_CTRL=1061;# intermediate, during start or stop
let $ERROR_SERVICE_NOT_ACTIVE=1062;# service stopped
let $ERROR_INVALID_SERVICE_CONTROL=1052; # The requested control is not valid for this service

let $sc_exe= C:\Windows\System32\sc.exe;
let $ddir= $MYSQLTEST_VARDIR/tmp/$datadir_name;
let $service_name=$service_name_prefix$MASTER_MYPORT;
let TMP= $MYSQLTEST_VARDIR/tmp;
let $upgrade_log=$TMP/mysql_upgrade_service.$service_name.log;

use mysql;
error 0,1;
rmdir $ddir;

--disable_result_log
error 0,$ERROR_SERVICE_DOES_NOT_EXIST;
exec $sc_exe delete $service_name;
--enable_result_log

source include/shutdown_mysqld.inc;
echo # run mysql_install_db with --service parameter;
--disable_result_log
exec $MYSQL_INSTALL_DB_EXE --datadir=$ddir --port=$MASTER_MYPORT --password=$password --service=$service_name --verbose-bootstrap -R;
--enable_result_log

echo # Start service;
--disable_result_log
exec $sc_exe start $service_name;
--enable_result_log

enable_reconnect;
source include/wait_until_connected_again.inc;
disable_reconnect;

echo # -- Upgrade service (online) --;
--replace_result $upgrade_log UPGRADE_LOG  $service_name SERVICE_NAME
let $sys_errno=0;
let $upgrade_success = 1;
error 0,1;
exec $MARIADB_UPGRADE_SERVICE_EXE --service=$service_name;

if($sys_errno != 0)
{
  let $upgrade_success = 0;
}

echo # upgrade_success(online)=$upgrade_success;
file_exists $upgrade_log;
if ($upgrade_success == 0)
{
  echo --detailed error(online upgrade)--;
  cat_file $upgrade_log;
}
# stop service
--disable_result_log
# Wait until stopped
let $sys_errno=0;
while($sys_errno != $ERROR_SERVICE_NOT_ACTIVE)
{
  --error 0,$ERROR_SERVICE_CANNOT_ACCEPT_CTRL,$ERROR_SERVICE_NOT_ACTIVE, $ERROR_INVALID_SERVICE_CONTROL
  exec $sc_exe stop $service_name;
  if($sys_errno != $ERROR_SERVICE_NOT_ACTIVE)
  {
    --real_sleep 0.1
  }
}
--enable_result_log
echo # Service stopped;

echo # -- Upgrade service (offline) --;
--replace_result $upgrade_log UPGRADE_LOG  $service_name SERVICE_NAME
let $sys_errno=0;
let $upgrade_success = 1;
error 0,1;
exec $MARIADB_UPGRADE_SERVICE_EXE --service=$service_name;

if($sys_errno != 0)
{
  let $upgrade_success = 0;
}

echo # upgrade_success(offline)=$upgrade_success;
file_exists $upgrade_log;
if ($upgrade_success == 0)
{
  echo --detailed error(online upgrade)--;
  cat_file $upgrade_log;
}

echo # Delete service;
let $sys_errno=0;
--disable_result_log
exec $sc_exe delete $service_name;
--enable_result_log

# Cleanup
source include/wait_until_disconnected.inc;
rmdir $ddir;
remove_file $upgrade_log;
let TEMP=$old_temp;

#restart original server
connection default;
source include/start_mysqld.inc;