Subversion Repositories Aucun

Rev

Rev 218 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
71 ixe013 1
@echo off
2
 
3
setlocal
4
 
219 ixe013 5
set TEST_EXE=%~dp0debug\test.exe
6
::set TEST_EXE=%~dp0test\Release\test.exe
71 ixe013 7
set UNLOCK_GROUP=aucun-unlock
8
set FORCE_LOGOFF_GROUP=aucun-logoff
9
set EXCLUDED_GROUP=aucun-excluded
10
 
72 ixe013 11
set eLetMSGINAHandleIt=1
12
set eUnlock=2
13
set eForceLogoff=3
14
 
71 ixe013 15
if "%1" == "" goto TESTS_HELP
16
 
17
echo Setting up tests....
18
echo.
19
 
20
rem *------------------------------------------------------------*
21
rem * Clean the old groups                                       *
22
rem *------------------------------------------------------------*
75 ixe013 23
net localgroup %UNLOCK_GROUP% /delete 1> nul
24
net localgroup %FORCE_LOGOFF_GROUP% /delete 1> nul
25
net localgroup %EXCLUDED_GROUP% /delete 1> nul
74 ixe013 26
 
75 ixe013 27
net localgroup %UNLOCK_GROUP% /add  1> nul
28
net localgroup %FORCE_LOGOFF_GROUP% /add  1> nul
29
net localgroup %EXCLUDED_GROUP% /add 1> nul
71 ixe013 30
 
31
rem *------------------------------------------------------------*
32
rem * Removing the registry settings                             *
33
rem *------------------------------------------------------------*
75 ixe013 34
reg delete HKLM\Software\Paralint.com\Aucun\Groups /va /f 1> nul
35
reg add HKLM\Software\Paralint.com\Aucun\Groups /v "Unlock" 1> nul
36
reg add HKLM\Software\Paralint.com\Aucun\Groups /v "Force logoff" 1> nul
71 ixe013 37
 
73 ixe013 38
set /p TEST_USER_PASSWORD="Enter the password of %1 : "
71 ixe013 39
echo.
40
 
73 ixe013 41
rem The tests are ordered so that the hamming distance between 
42
rem any two tests is one. In other words, if we add the user to
43
rem a group, we don't touch the registry, and we never add or 
44
rem remove more than one user or group at a time. 
45
rem
46
rem More on this on
47
rem http://www.paralint.com/blog/2008/08/21/easy-test-coverage-with-constant-hamming-distance-of-1/
48
 
49
echo                %d   User  Registry
50
echo                     U  F   U  F
51
 
71 ixe013 52
rem *------------------------------------------------------------*
75 ixe013 53
echo Running test :  0   0  0   0  0    Expected result : eLetMSGINAHandleIt
71 ixe013 54
rem *------------------------------------------------------------*
76 ixe013 55
echo  %TEST_EXE% %1
218 ixe013 56
call:show_params
72 ixe013 57
echo %TEST_USER_PASSWORD%| %TEST_EXE% %1
75 ixe013 58
if NOT ERRORLEVEL %eLetMSGINAHandleIt% goto TEST_FAILED
71 ixe013 59
echo.
60
 
72 ixe013 61
 
71 ixe013 62
rem *------------------------------------------------------------*
75 ixe013 63
echo Running test :  1   0  0   0  1   Expected result : eLetMSGINAHandleIt
71 ixe013 64
rem *------------------------------------------------------------*
75 ixe013 65
reg add HKLM\Software\Paralint.com\Aucun\Groups /v "Force logoff" /f /d %FORCE_LOGOFF_GROUP%  1> nul
218 ixe013 66
call:show_params
72 ixe013 67
echo %TEST_USER_PASSWORD%| %TEST_EXE% %1
75 ixe013 68
if NOT ERRORLEVEL %eLetMSGINAHandleIt% goto TEST_FAILED
71 ixe013 69
echo.
70
 
71
 
72 ixe013 72
rem *------------------------------------------------------------*
75 ixe013 73
echo Running test :  3   0  0   1  1   Expected result : eLetMSGINAHandleIt
72 ixe013 74
rem *------------------------------------------------------------*
75 ixe013 75
reg add HKLM\Software\Paralint.com\Aucun\Groups /v "Unlock" /f /d %UNLOCK_GROUP%  1> nul
218 ixe013 76
call:show_params
72 ixe013 77
echo %TEST_USER_PASSWORD%| %TEST_EXE% %1
75 ixe013 78
if NOT ERRORLEVEL %eLetMSGINAHandleIt% goto TEST_FAILED
73 ixe013 79
echo.
72 ixe013 80
 
81
 
73 ixe013 82
rem *------------------------------------------------------------*
75 ixe013 83
echo Running test :  2   0  0   1  0   Expected result : eLetMSGINAHandleIt
73 ixe013 84
rem *------------------------------------------------------------*
75 ixe013 85
reg add HKLM\Software\Paralint.com\Aucun\Groups /v "Force logoff" /f 1> nul
218 ixe013 86
call:show_params
73 ixe013 87
echo %TEST_USER_PASSWORD%| %TEST_EXE% %1
75 ixe013 88
if NOT ERRORLEVEL %eLetMSGINAHandleIt% goto TEST_FAILED
73 ixe013 89
echo.
90
 
91
 
92
rem *------------------------------------------------------------*
75 ixe013 93
echo Running test :  6   0  1   1  0   Expected result : eLetMSGINAHandleIt
73 ixe013 94
rem *------------------------------------------------------------*
75 ixe013 95
net localgroup %FORCE_LOGOFF_GROUP% %1 /add  1> nul
218 ixe013 96
call:show_params
73 ixe013 97
echo %TEST_USER_PASSWORD%| %TEST_EXE% %1
75 ixe013 98
if NOT ERRORLEVEL %eLetMSGINAHandleIt% goto TEST_FAILED
73 ixe013 99
echo.
100
 
101
rem *------------------------------------------------------------*
75 ixe013 102
echo Running test :  7   0  1   1  1   Expected result : eForceLogoff
73 ixe013 103
rem *------------------------------------------------------------*
75 ixe013 104
reg add HKLM\Software\Paralint.com\Aucun\Groups /v "Force logoff" /f /d %FORCE_LOGOFF_GROUP%  1> nul
218 ixe013 105
call:show_params
73 ixe013 106
echo %TEST_USER_PASSWORD%| %TEST_EXE% %1
75 ixe013 107
if NOT ERRORLEVEL %eForceLogoff% goto TEST_FAILED
73 ixe013 108
echo.
109
 
110
 
111
rem *------------------------------------------------------------*
75 ixe013 112
echo Running test :  5   0  1   0  1   Expected result : eForceLogoff
73 ixe013 113
rem *------------------------------------------------------------*
75 ixe013 114
reg add HKLM\Software\Paralint.com\Aucun\Groups /v "Unlock" /f 1> nul
218 ixe013 115
call:show_params
73 ixe013 116
echo %TEST_USER_PASSWORD%| %TEST_EXE% %1
75 ixe013 117
if NOT ERRORLEVEL %eForceLogoff% goto TEST_FAILED
73 ixe013 118
echo.
119
 
120
 
121
rem *------------------------------------------------------------*
75 ixe013 122
echo Running test :  4   0  1   0  0   Expected result : eLetMSGINAHandleIt
73 ixe013 123
rem *------------------------------------------------------------*
75 ixe013 124
reg add HKLM\Software\Paralint.com\Aucun\Groups /v "Force logoff" /f 1> nul
218 ixe013 125
call:show_params
73 ixe013 126
echo %TEST_USER_PASSWORD%| %TEST_EXE% %1
75 ixe013 127
if NOT ERRORLEVEL %eLetMSGINAHandleIt% goto TEST_FAILED
73 ixe013 128
echo.
129
 
130
 
131
rem *------------------------------------------------------------*
75 ixe013 132
echo Running test : 12   1  1   0  0   Expected result : eLetMSGINAHandleIt
73 ixe013 133
rem *------------------------------------------------------------*
75 ixe013 134
net localgroup %UNLOCK_GROUP% %1 /add  1> nul
218 ixe013 135
call:show_params
73 ixe013 136
echo %TEST_USER_PASSWORD%| %TEST_EXE% %1
75 ixe013 137
if NOT ERRORLEVEL %eLetMSGINAHandleIt% goto TEST_FAILED
73 ixe013 138
echo.
139
 
140
 
141
rem *------------------------------------------------------------*
75 ixe013 142
echo Running test : 13   1  1   0  1   Expected result : eForceLogoff
73 ixe013 143
rem *------------------------------------------------------------*
75 ixe013 144
reg add HKLM\Software\Paralint.com\Aucun\Groups /v "Force logoff" /f /d %FORCE_LOGOFF_GROUP%  1> nul
218 ixe013 145
call:show_params
73 ixe013 146
echo %TEST_USER_PASSWORD%| %TEST_EXE% %1
75 ixe013 147
if NOT ERRORLEVEL %eForceLogoff% goto TEST_FAILED
73 ixe013 148
echo.
149
 
150
 
74 ixe013 151
rem *------------------------------------------------------------*
75 ixe013 152
echo Running test : 15   1  1   1  1   Expected result : eUnlock
74 ixe013 153
rem *------------------------------------------------------------*
75 ixe013 154
reg add HKLM\Software\Paralint.com\Aucun\Groups /v "Unlock" /f /d %UNLOCK_GROUP%  1> nul
218 ixe013 155
call:show_params
74 ixe013 156
echo %TEST_USER_PASSWORD%| %TEST_EXE% %1
75 ixe013 157
if NOT ERRORLEVEL %eUnlock% goto TEST_FAILED
74 ixe013 158
echo.
73 ixe013 159
 
160
 
74 ixe013 161
rem *------------------------------------------------------------*
75 ixe013 162
echo Running test : 14   1  1   1  0   Expected result : eUnlock
74 ixe013 163
rem *------------------------------------------------------------*
75 ixe013 164
reg add HKLM\Software\Paralint.com\Aucun\Groups /v "Force logoff" /f 1> nul
218 ixe013 165
call:show_params
74 ixe013 166
echo %TEST_USER_PASSWORD%| %TEST_EXE% %1
75 ixe013 167
if NOT ERRORLEVEL %eUnlock% goto TEST_FAILED
74 ixe013 168
echo.
73 ixe013 169
 
170
 
74 ixe013 171
rem *------------------------------------------------------------*
75 ixe013 172
echo Running test : 10   1  0   1  0   Expected result : eUnlock
74 ixe013 173
rem *------------------------------------------------------------*
75 ixe013 174
net localgroup %FORCE_LOGOFF_GROUP% %1 /delete  1> nul
218 ixe013 175
call:show_params
74 ixe013 176
echo %TEST_USER_PASSWORD%| %TEST_EXE% %1
75 ixe013 177
if NOT ERRORLEVEL %eUnlock% goto TEST_FAILED
74 ixe013 178
echo.
73 ixe013 179
 
180
 
74 ixe013 181
rem *------------------------------------------------------------*
75 ixe013 182
echo Running test : 11   1  0   1  1   Expected result : eUnlock
74 ixe013 183
rem *------------------------------------------------------------*
75 ixe013 184
reg add HKLM\Software\Paralint.com\Aucun\Groups /v "Force logoff" /f /d %FORCE_LOGOFF_GROUP%  1> nul
218 ixe013 185
call:show_params
74 ixe013 186
echo %TEST_USER_PASSWORD%| %TEST_EXE% %1
75 ixe013 187
if NOT ERRORLEVEL %eUnlock% goto TEST_FAILED
74 ixe013 188
echo.
73 ixe013 189
 
190
 
75 ixe013 191
rem *------------------------------------------------------------*                                                                                             
192
echo Running test :  9   1  0   0  1   Expected result : eLetMSGINAHandleIt
74 ixe013 193
rem *------------------------------------------------------------*
75 ixe013 194
reg add HKLM\Software\Paralint.com\Aucun\Groups /v "Unlock" /f 1> nul
218 ixe013 195
call:show_params
74 ixe013 196
echo %TEST_USER_PASSWORD%| %TEST_EXE% %1
75 ixe013 197
if NOT ERRORLEVEL %eLetMSGINAHandleIt% goto TEST_FAILED
74 ixe013 198
echo.
73 ixe013 199
 
200
 
74 ixe013 201
rem *------------------------------------------------------------*
75 ixe013 202
echo Running test :  8   1  0   0  0   Expected result : eLetMSGINAHandleIt
74 ixe013 203
rem *------------------------------------------------------------*
75 ixe013 204
reg add HKLM\Software\Paralint.com\Aucun\Groups /v "Force logoff" /f 1> nul
218 ixe013 205
call:show_params
74 ixe013 206
echo %TEST_USER_PASSWORD%| %TEST_EXE% %1
75 ixe013 207
if NOT ERRORLEVEL %eLetMSGINAHandleIt% goto TEST_FAILED
74 ixe013 208
echo.
73 ixe013 209
 
75 ixe013 210
goto TEST_FINISHED
73 ixe013 211
 
75 ixe013 212
:TEST_FAILED
213
echo ***FAILED*** (return code %ERRORLEVEL%)
214
net localgroup %UNLOCK_GROUP%
215
net localgroup %FORCE_LOGOFF_GROUP%
216
reg query HKLM\Software\Paralint.com\Aucun\Groups
217
 
218
:TEST_FINISHED
71 ixe013 219
echo TEST FINISHED !!!
220
goto END
221
 
222
:TESTS_HELP
223
echo Pass the username to use for tests
224
 
225
:END
226
 
227
endlocal
218 ixe013 228
 
229
goto:eof
230
 
231
:show_params
232
net localgroup %UNLOCK_GROUP%
233
net localgroup %FORCE_LOGOFF_GROUP%
234
reg query HKLM\Software\Paralint.com\Aucun\Groups
235
goto:eof