Subversion Repositories Aucun

Rev

Rev 76 | Details | Compare with Previous | Last modification | View Log | RSS feed

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