Changeset 66800 in vbox for trunk/src/VBox/ValidationKit/testboxscript/setup.sh
- Timestamp:
- May 4, 2017 11:55:34 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testboxscript/setup.sh
r66798 r66800 6 6 7 7 # 8 # Copyright (C) 2006-201 5Oracle Corporation8 # Copyright (C) 2006-2017 Oracle Corporation 9 9 # 10 10 # This file is part of VirtualBox Open Source Edition (OSE), as … … 334 334 } 335 335 336 ## 337 # Parses the testboxscript.py invocation, setting TESTBOXSCRIPT_xxx config 338 # variables accordingly. Both darwin and solaris uses this. 339 common_testboxscript_args_to_config() 340 { 341 MY_ARG=0 342 while [ $# -gt 0 ]; 343 do 344 case "$1" in 345 # boolean 346 "--hwvirt") TESTBOXSCRIPT_HWVIRT="yes";; 347 "--no-hwvirt") TESTBOXSCRIPT_HWVIRT="no";; 348 "--nested-paging") TESTBOXSCRIPT_NESTED_PAGING="yes";; 349 "--no-nested-paging") TESTBOXSCRIPT_NESTED_PAGING="no";; 350 "--io-mmu") TESTBOXSCRIPT_IOMMU="yes";; 351 "--no-io-mmu") TESTBOXSCRIPT_IOMMU="no";; 352 # optios taking values. 353 "--system-uuid") TESTBOXSCRIPT_SYSTEM_UUID="$2"; shift;; 354 "--scratch-root") TESTBOXSCRIPT_SCRATCH_ROOT="$2"; shift;; 355 "--test-manager") TESTBOXSCRIPT_TEST_MANAGER="$2"; shift;; 356 "--builds-path") TESTBOXSCRIPT_BUILDS_PATH="$2"; shift;; 357 "--builds-server-type") TESTBOXSCRIPT_BUILDS_TYPE="$2"; shift;; 358 "--builds-server-name") TESTBOXSCRIPT_BUILDS_NAME="$2"; shift;; 359 "--builds-server-share") TESTBOXSCRIPT_BUILDS_SHARE="$2"; shift;; 360 "--builds-server-user") TESTBOXSCRIPT_BUILDS_USER="$2"; shift;; 361 "--builds-server-passwd") TESTBOXSCRIPT_BUILDS_PASSWD="$2"; shift;; 362 "--testrsrc-path") TESTBOXSCRIPT_TESTRSRC_PATH="$2"; shift;; 363 "--testrsrc-server-type") TESTBOXSCRIPT_TESTRSRC_TYPE="$2"; shift;; 364 "--testrsrc-server-name") TESTBOXSCRIPT_TESTRSRC_NAME="$2"; shift;; 365 "--testrsrc-server-share") TESTBOXSCRIPT_TESTRSRC_SHARE="$2"; shift;; 366 "--testrsrc-server-user") TESTBOXSCRIPT_TESTRSRC_USER="$2"; shift;; 367 "--testrsrc-server-passwd") TESTBOXSCRIPT_TESTRSRC_PASSWD="$2"; shift;; 368 "--putenv") 369 ## @todo remove any existing variable or we'll end up with a pretty long number of putenv statements on solaris. 370 TESTBOXSCRIPT_ENVVARS+=("$2"); 371 shift;; 372 --*) 373 echo "error: Unknown option '$1' in existing config" 374 exit 1 375 ;; 376 377 # Non-option bits. 378 *.py) ;; # ignored, should be the script. 379 380 *) if [ ${MY_ARG} -ne 0 ]; then 381 echo "error: unknown non-option '$1' in existing config" 382 exit 1 383 fi 384 TESTBOXSCRIPT_PYTHON="$1" 385 ;; 386 esac 387 shift 388 MY_ARG=$((${MY_ARG} + 1)) 389 done 390 } 391 392 ## 393 # Used by common_compile_testboxscript_command_line, please override. 394 # 395 os_add_args() { 396 echo "os_add_args is not implemented" 2>&1 397 exit 1 398 } 399 400 ## 401 # Compiles the testboxscript.py command line given the current 402 # configuration and defaults. 403 # 404 # This is used by solaris and darwin. 405 # 406 # The os_add_args function will be called several with one or two arguments 407 # each time. The caller must override it. 408 # 409 common_compile_testboxscript_command_line() { 410 if [ -n "${TESTBOXSCRIPT_PYTHON}" ]; then 411 os_add_args "${TESTBOXSCRIPT_PYTHON}" 412 fi 413 os_add_args "${TESTBOXSCRIPT_DIR}/testboxscript/testboxscript.py" 414 415 for var in ${TESTBOXSCRIPT_CFG_NAMES}; 416 do 417 varcfg=TESTBOXSCRIPT_${var} 418 vardef=TESTBOXSCRIPT_DEFAULT_${var} 419 if [ "${!varcfg}" != "${!vardef}" -a "${var}" != "PYTHON" ]; then # PYTHON handled above. 420 my_opt=TESTBOXSCRIPT_OPT_${var} 421 if [ -n "${!my_opt}" ]; then 422 if [ "${!my_opt}" != "--skip" ]; then 423 os_add_args "${!my_opt}" "${!varcfg}" 424 fi 425 else 426 my_opt_yes=${my_opt}_YES 427 my_opt_no=${my_opt}_NO 428 if [ -n "${!my_opt_yes}" -a -n "${!my_opt_no}" ]; then 429 if [ "${!varcfg}" = "yes" ]; then 430 os_add_args "${!my_opt_yes}"; 431 else 432 if [ "${!varcfg}" != "no" ]; then 433 echo "internal option misconfig: var=${var} not a yes/no value: ${!varcfg}"; 434 exit 1; 435 fi 436 os_add_args "${!my_opt_yes}"; 437 fi 438 else 439 echo "internal option misconfig: var=${var} my_opt_yes=${my_opt_yes}=${!my_opt_yes} my_opt_no=${my_opt_no}=${!my_opt_no}" 440 exit 1; 441 fi 442 fi 443 fi 444 done 445 446 i=0 447 while [ "${i}" -lt "${#TESTBOXSCRIPT_ENVVARS[@]}" ]; 448 do 449 os_add_args "--putenv" "${TESTBOXSCRIPT_ENVVARS[${i}]}" 450 i=$((${i} + 1)) 451 done 452 } 453 336 454 337 455 # … … 361 479 # Config. 362 480 # 363 TESTBOXSCRIPT_PYTHON="" 364 TESTBOXSCRIPT_USER="" 365 TESTBOXSCRIPT_HWVIRT="" 366 TESTBOXSCRIPT_IOMMU="" 367 TESTBOXSCRIPT_NESTED_PAGING="" 368 TESTBOXSCRIPT_SYSTEM_UUID="" 369 TESTBOXSCRIPT_PATH_TESTRSRC="" 370 TESTBOXSCRIPT_TEST_MANAGER="" 371 TESTBOXSCRIPT_SCRATCH_ROOT="" 372 TESTBOXSCRIPT_BUILDS_PATH="" 373 TESTBOXSCRIPT_BUILDS_TYPE="cifs" 374 TESTBOXSCRIPT_BUILDS_NAME="vboxstor.de.oracle.com" 375 TESTBOXSCRIPT_BUILDS_SHARE="builds" 376 TESTBOXSCRIPT_BUILDS_USER="guestr" 377 TESTBOXSCRIPT_BUILDS_PASSWD="guestr" 378 TESTBOXSCRIPT_TESTRSRC_PATH="" 379 TESTBOXSCRIPT_TESTRSRC_TYPE="cifs" 380 TESTBOXSCRIPT_TESTRSRC_NAME="teststor.de.oracle.com" 381 TESTBOXSCRIPT_TESTRSRC_SHARE="testrsrc" 382 TESTBOXSCRIPT_TESTRSRC_USER="guestr" 383 TESTBOXSCRIPT_TESTRSRC_PASSWD="guestr" 481 TESTBOXSCRIPT_CFG_NAMES="DIR PYTHON USER HWVIRT IOMMU NESTED_PAGING SYSTEM_UUID PATH_TESTRSRC TEST_MANAGER SCRATCH_ROOT" 482 TESTBOXSCRIPT_CFG_NAMES="${TESTBOXSCRIPT_CFG_NAMES} BUILDS_PATH BUILDS_TYPE BUILDS_NAME BUILDS_SHARE BUILDS_USER BUILDS_PASSWD" 483 TESTBOXSCRIPT_CFG_NAMES="${TESTBOXSCRIPT_CFG_NAMES} TESTRSRC_PATH TESTRSRC_TYPE TESTRSRC_NAME TESTRSRC_SHARE TESTRSRC_USER TESTRSRC_PASSWD" 484 485 # testboxscript.py option to config mappings. 486 TESTBOXSCRIPT_OPT_DIR="--skip" 487 TESTBOXSCRIPT_OPT_PYTHON="--skip" 488 TESTBOXSCRIPT_OPT_USER="--skip" 489 TESTBOXSCRIPT_OPT_HWVIRT_YES="--hwvirt" 490 TESTBOXSCRIPT_OPT_HWVIRT_NO="--no-hwvirt" 491 TESTBOXSCRIPT_OPT_NESTED_PAGING_YES="--nested-paging" 492 TESTBOXSCRIPT_OPT_NESTED_PAGING_NO="--no-nested-paging" 493 TESTBOXSCRIPT_OPT_IOMMU_YES="--io-mmu" 494 TESTBOXSCRIPT_OPT_IOMMU_NO="--no-io-mmu" 495 TESTBOXSCRIPT_OPT_SYSTEM_UUID="--system-uuid" 496 TESTBOXSCRIPT_OPT_TEST_MANAGER="--test-manager" 497 TESTBOXSCRIPT_OPT_SCRATCH_ROOT="--scratch-root" 498 TESTBOXSCRIPT_OPT_BUILDS_PATH="--builds-path" 499 TESTBOXSCRIPT_OPT_BUILDS_TYPE="--builds-server-type" 500 TESTBOXSCRIPT_OPT_BUILDS_NAME="--builds-server-name" 501 TESTBOXSCRIPT_OPT_BUILDS_SHARE="--builds-server-share" 502 TESTBOXSCRIPT_OPT_BUILDS_USER="--builds-server-user" 503 TESTBOXSCRIPT_OPT_BUILDS_PASSWD="--builds-server-passwd" 504 TESTBOXSCRIPT_OPT_PATH_TESTRSRC="--testrsrc-path" 505 TESTBOXSCRIPT_OPT_TESTRSRC_TYPE="--testrsrc-server-type" 506 TESTBOXSCRIPT_OPT_TESTRSRC_NAME="--testrsrc-server-name" 507 TESTBOXSCRIPT_OPT_TESTRSRC_SHARE="--testrsrc-server-share" 508 TESTBOXSCRIPT_OPT_TESTRSRC_USER="--testrsrc-server-user" 509 TESTBOXSCRIPT_OPT_TESTRSRC_PASSWD="--testrsrc-server-passwd" 510 511 # Defaults: 512 TESTBOXSCRIPT_DEFAULT_DIR="there-is-no-default-for-this-value" 513 TESTBOXSCRIPT_DEFAULT_PYTHON="" 514 TESTBOXSCRIPT_DEFAULT_USER="vbox" 515 TESTBOXSCRIPT_DEFAULT_HWVIRT="" 516 TESTBOXSCRIPT_DEFAULT_IOMMU="" 517 TESTBOXSCRIPT_DEFAULT_NESTED_PAGING="" 518 TESTBOXSCRIPT_DEFAULT_SYSTEM_UUID="" 519 TESTBOXSCRIPT_DEFAULT_PATH_TESTRSRC="" 520 TESTBOXSCRIPT_DEFAULT_TEST_MANAGER="" 521 TESTBOXSCRIPT_DEFAULT_SCRATCH_ROOT="" 522 TESTBOXSCRIPT_DEFAULT_BUILDS_PATH="" 523 TESTBOXSCRIPT_DEFAULT_BUILDS_TYPE="cifs" 524 TESTBOXSCRIPT_DEFAULT_BUILDS_NAME="vboxstor.de.oracle.com" 525 TESTBOXSCRIPT_DEFAULT_BUILDS_SHARE="builds" 526 TESTBOXSCRIPT_DEFAULT_BUILDS_USER="guestr" 527 TESTBOXSCRIPT_DEFAULT_BUILDS_PASSWD="guestr" 528 TESTBOXSCRIPT_DEFAULT_TESTRSRC_PATH="" 529 TESTBOXSCRIPT_DEFAULT_TESTRSRC_TYPE="cifs" 530 TESTBOXSCRIPT_DEFAULT_TESTRSRC_NAME="teststor.de.oracle.com" 531 TESTBOXSCRIPT_DEFAULT_TESTRSRC_SHARE="testrsrc" 532 TESTBOXSCRIPT_DEFAULT_TESTRSRC_USER="guestr" 533 TESTBOXSCRIPT_DEFAULT_TESTRSRC_PASSWD="guestr" 534 535 # Set config values to defaults. 536 for var in ${TESTBOXSCRIPT_CFG_NAMES} 537 do 538 defvar=TESTBOXSCRIPT_DEFAULT_${var} 539 eval TESTBOXSCRIPT_${var}="${!defvar}" 540 done 384 541 declare -a TESTBOXSCRIPT_ENVVARS 385 542 … … 387 544 os_load_config 388 545 389 # Set defaults. 546 547 # 548 # Config tweaks. 549 # 550 551 # The USER must be a non-empty value for the successful execution of this script. 390 552 if [ -z "${TESTBOXSCRIPT_USER}" ]; then 391 TESTBOXSCRIPT_USER= vbox;553 TESTBOXSCRIPT_USER=${TESTBOXSCRIPT_DEFAULT_USER}; 392 554 fi; 555 556 # The DIR must be according to the setup.sh location. 393 557 TESTBOXSCRIPT_DIR=`dirname "${DIR}"` 558 559 # Storage server replacement trick. 560 if [ "${TESTBOXSCRIPT_BUILDS_NAME}" = "solserv.de.oracle.com" ]; then 561 TESTBOXSCRIPT_BUILDS_NAME=${TESTBOXSCRIPT_DEFAULT_BUILDS_NAME} 562 fi 563 if [ "${TESTBOXSCRIPT_TESTRSRC_NAME}" = "solserv.de.oracle.com" ]; then 564 TESTBOXSCRIPT_TESTRSRC_NAME=${TESTBOXSCRIPT_DEFAULT_TESTRSRC_NAME} 565 fi 394 566 395 567
Note:
See TracChangeset
for help on using the changeset viewer.