Changeset 740 for vendor/current/source3/script/tests/test_net_registry.sh
- Timestamp:
- Nov 14, 2012, 12:59:34 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/script/tests/test_net_registry.sh
r414 r740 1 1 #!/bin/sh 2 3 # Tests for the "net registry" and "net rpc registry" commands. 2 # 3 # Blackbox tests for the "net registry" and "net rpc registry" commands. 4 # 5 # Copyright (C) 2010-2011 Michael Adam <[email protected]> 6 # Copyright (C) 2010 Gregor Beck <[email protected]> 7 # 4 8 # rpc tests are chose by specifying "rpc" as commandline parameter. 5 9 6 RPC="$1" 10 if [ $# -lt 3 ]; then 11 cat <<EOF 12 Usage: test_net_registry.sh SCRIPTDIR SERVERCONFFILE CONFIGURATION RPC 13 EOF 14 exit 1; 15 fi 16 17 SCRIPTDIR="$1" 18 SERVERCONFFILE="$2" 19 CONFIGURATION="$3" 20 RPC="$4" 7 21 8 22 NET="$VALGRIND ${NET:-$BINDIR/net} $CONFIGURATION" … … 15 29 16 30 test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && { 17 incdir=`dirname $0` 18 . $incdir/ test_functions.sh31 incdir=`dirname $0` 32 . $incdir/.sh 19 33 } 20 34 … … 145 159 146 160 UNEXPECTED="Keyname = ${SUBKEY}" 147 printf "%s\n" "$OUTPUT" | 'grep^Keyname' | grep ${SUBKEY}161 printf "%s\n" "$OUTPUT" | ^Keyname' | grep ${SUBKEY} 148 162 if test "x$?" = "x0" ; then 149 163 echo "ERROR: found '$UNEXPECTED' after delete in output" … … 238 252 { 239 253 KEY="$1" 240 VALNAME="$ 2"254 VALNAME="$" 241 255 VALTYPE="$3" 242 256 VALVALUE="$4" … … 249 263 fi 250 264 251 OUTPUT=`${NETREG} setvalue ${KEY} ${VALNAME}${VALTYPE} ${VALVALUE}`265 OUTPUT=`${NETREG} setvalue ${KEY} ${VALTYPE} ${VALVALUE}` 252 266 if test "x$?" != "x0" ; then 253 267 echo "ERROR: failed to set value testval in key ${KEY}" … … 257 271 fi 258 272 259 OUTPUT=`${NETREG} enumerate ${KEY}`260 if test "x$?" != "x0" ; then 261 echo "ERROR: failure calling enumeratefor key ${KEY}"273 OUTPUT=`${NETREG} ` 274 if test "x$?" != "x0" ; then 275 echo "ERROR: failure calling for key ${KEY}" 262 276 echo output: 263 277 printf "%s\n" "${OUTPUT}" … … 266 280 fi 267 281 268 printf "%s\n" "$OUTPUT" | { 269 FOUND=0 270 while read LINE ; do 271 SEARCH1=`echo $LINE | grep '^Valuename' | grep ${VALNAME}` 272 if test "x$?" = "x0" ; then 273 read LINE 274 read LINE 275 SEARCH2=`echo $LINE | grep '^Value ' | grep ${VALVALUE}` 276 if test "x$?" = "x0" ; then 277 FOUND=1 278 break 279 fi 280 fi 281 done 282 283 if test "x$FOUND" != "x1" ; then 284 echo "ERROR: did not find value '${VALNAME}' with enumerate" 285 echo "enumerate output:" 286 printf "%s\n" "$OUTPUT" 287 false 288 return 289 fi 290 } 282 if test "x${OUTPUT}" != "x${VALVALUE}" ; then 283 echo "ERROR: failure retrieving value ${VALNAME} for key ${KEY}" 284 printf "expected: %s\ngot: %s\n" "${VALVALUE}" "${OUTPUT}" 285 false 286 return 287 fi 288 291 289 } 292 290 … … 294 292 { 295 293 KEY="$1" 296 VALNAME="$ 2"297 298 ${NETREG} deletevalue ${KEY} ${VALNAME}294 VALNAME="$" 295 296 ${NETREG} deletevalue ${KEY} 299 297 } 300 298 … … 302 300 { 303 301 KEY="$1" 304 VALNAME="$ 2"305 306 ${NETREG} deletevalue ${KEY} ${VALNAME}302 VALNAME="$" 303 304 ${NETREG} deletevalue ${KEY} 307 305 if test "x$?" = "x0" ; then 308 306 echo "ERROR: succeeded deleting value ${VALNAME}" … … 316 314 { 317 315 KEY="$1" 318 VALNAME="$ 2"316 VALNAME="$" 319 317 VALTYPE1="$3" 320 318 VALVALUE1="$4" … … 322 320 VALVALUE2="$6" 323 321 324 OUTPUT=`test_setvalue ${KEY} ${VALNAME}${VALTYPE1} ${VALVALUE1}`322 OUTPUT=`test_setvalue ${KEY} ${VALTYPE1} ${VALVALUE1}` 325 323 if test "x$?" != "x0" ; then 326 324 echo "ERROR: first setvalue call failed" … … 330 328 fi 331 329 332 ${NETREG} setvalue ${KEY} ${VALNAME} ${VALTYPE2} ${VALVALUE2} 333 } 334 335 give_administrative_rights() 336 { 337 bin/net -s $SERVERCONFFILE sam createbuiltingroup Administrators 338 if test "x$?" != "x0" ; then 339 echo "ERROR: creating builtin group Administrators" 340 false 341 return 342 fi 343 344 bin/net -s $SERVERCONFFILE sam addmem BUILTIN\\Administrators $USERNAME 345 if test "x$?" != "x0" ; then 346 echo "ERROR: adding user $USERNAME to BUILTIN\\Administrators" 347 false 348 else 349 true 350 fi 351 } 352 353 take_administrative_rights() 354 { 355 bin/net -s $SERVERCONFFILE sam delmem BUILTIN\\Administrators $USERNAME 356 if test "x$?" != "x0" ; then 357 echo "ERROR: removing user $USERNAME from BUILTIN\\Administrators" 358 false 359 else 360 true 361 fi 362 } 363 364 if test "x${RPC}" = "xrpc" ; then 365 testit "giving user ${USERNAME} administrative rights" \ 366 give_administrative_rights 367 if [ "x$?" != "x0" ] ; then 368 failed=`expr $failed + 1` 369 testok $0 $failed 370 fi 371 fi 330 ${NETREG} setvalue ${KEY} "${VALNAME}" ${VALTYPE2} ${VALVALUE2} 331 } 332 372 333 373 334 testit "enumerate HKLM" \ … … 419 380 420 381 testit "set value" \ 421 test_setvalue HKLM/testkey testval sz moin || \382 test_setvalue HKLM/testkey testval sz moin || \ 422 383 failed=`expr $failed + 1` 423 384 424 385 testit "delete value" \ 425 test_deletevalue HKLM/testkey testval || \386 test_deletevalue HKLM/testkey testval || \ 426 387 failed=`expr $failed + 1` 427 388 428 389 testit "delete nonexisting value" \ 429 test_deletevalue_nonexisting HKLM/testkey testval || \390 test_deletevalue_nonexisting HKLM/testkey testval || \ 430 391 failed=`expr $failed + 1` 431 392 … … 434 395 failed=`expr $failed + 1` 435 396 397 398 399 400 401 402 403 404 405 406 407 408 436 409 testit "delete key with value" \ 437 410 test_deletekey HKLM/testkey || \ 438 411 failed=`expr $failed + 1` 439 412 440 if test "x${RPC}" = "xrpc" ; then441 testit "taking administrative rights from user ${USERNAME}" \442 take_administrative_rights || \443 failed=`expr $failed + 1`444 fi445 413 446 414 testok $0 $failed
Note:
See TracChangeset
for help on using the changeset viewer.
