VirtualBox

忽略:
時間撮記:
2010-2-4 下午09:44:09 (15 年 以前)
作者:
vboxsync
訊息:

HostServices/GuestProperties: fixed the test case

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/HostServices/GuestProperties/testcase/tstGuestPropSvc.cpp

    r25306 r26247  
    866866    /** Should we use SET_PROP or SET_PROP_VALUE? */
    867867    bool useSetProp;
    868     /** Should this succeed or be rejected with VERR_PERMISSION_DENIED? */
     868    /** Should this succeed or be rejected with VERR_ (NOT VINF_!)
     869     * PERMISSION_DENIED?  The global check is done after the property one. */
    869870    bool isAllowed;
    870871}
    871872setPropertiesROGuest[] =
    872873{
    873     { "Red", "Stop!", "transient", false, true, false },
    874     { "Amber", "Caution!", "", false, false, false },
     874    { "Red", "Stop!", "transient", false, true, true },
     875    { "Amber", "Caution!", "", false, false, true },
    875876    { "Green", "Go!", "readonly", true, true, true },
    876877    { "Blue", "What on earth...?", "", true, false, true },
    877     { "/test/name", "test", "", false, true, false },
     878    { "/test/name", "test", "", false, true, true },
    878879    { "TEST NAME", "test", "", true, true, true },
    879880    { "Green", "gone out...", "", false, false, false },
    880     { "Green", "gone out...", "", true, false, false },
    881     { NULL, NULL, NULL, false, false, false }
     881    { "Green", "gone out....", "", true, false, false },
     882    { NULL, NULL, NULL, false, false, true }
    882883};
    883884
     
    931932                           setPropertiesROGuest[i].useSetProp);
    932933        if (setPropertiesROGuest[i].isAllowed && RT_FAILURE(rc))
    933             RTPrintf("Setting property '%s' failed with rc=%Rrc.\n",
    934                      setPropertiesROGuest[i].pcszName, rc);
     934            RTPrintf("Setting property '%s' to '%s' failed with rc=%Rrc.\n",
     935                     setPropertiesROGuest[i].pcszName,
     936                     setPropertiesROGuest[i].pcszValue, rc);
    935937        else if (   !setPropertiesROGuest[i].isAllowed
    936938                 && (rc != VERR_PERMISSION_DENIED))
    937939        {
    938             RTPrintf("Setting property '%s' returned %Rrc instead of VERR_PERMISSION_DENIED.\n",
    939                      setPropertiesROGuest[i].pcszName, rc);
     940            RTPrintf("Setting property '%s' to '%s' returned %Rrc instead of VERR_PERMISSION_DENIED.\n",
     941                     setPropertiesROGuest[i].pcszName,
     942                     setPropertiesROGuest[i].pcszValue, rc);
     943            rc = VERR_IPE_UNEXPECTED_STATUS;
     944        }
     945        else if (   !setPropertiesROGuest[i].isHost
     946                 && setPropertiesROGuest[i].isAllowed
     947                 && (rc != VINF_PERMISSION_DENIED))
     948        {
     949            RTPrintf("Setting property '%s' to '%s' returned %Rrc instead of VINF_PERMISSION_DENIED.\n",
     950                     setPropertiesROGuest[i].pcszName,
     951                     setPropertiesROGuest[i].pcszValue, rc);
    940952            rc = VERR_IPE_UNEXPECTED_STATUS;
    941953        }
     
    960972    /** And with what flags? */
    961973    const char *pcszFlags;
    962     /** Should this succeed or be rejected with VERR_PERMISSION_DENIED? */
     974    /** Should this succeed or be rejected with VERR_ (NOT VINF_!)
     975     * PERMISSION_DENIED?  The global check is done after the property one. */
    963976    bool isAllowed;
    964977}
     
    966979{
    967980    { "Red", true, true, "", true },
    968     { "Amber", false, true, "", false },
     981    { "Amber", false, true, "", true },
    969982    { "Red2", true, false, "", true },
    970     { "Amber2", false, false, "", false },
     983    { "Amber2", false, false, "", true },
    971984    { "Red3", true, true, "READONLY", false },
    972985    { "Amber3", false, true, "READONLY", false },
    973986    { "Red4", true, true, "RDONLYHOST", false },
    974     { "Amber4", false, true, "RDONLYHOST", false },
     987    { "Amber4", false, true, "RDONLYHOST", true },
    975988    { NULL, false, false, "", false }
    976989};
     
    10101023            rc = VERR_IPE_UNEXPECTED_STATUS;
    10111024        }
     1025        else if (   !delPropertiesROGuest[i].isHost
     1026                 && delPropertiesROGuest[i].shouldCreate
     1027                 && delPropertiesROGuest[i].isAllowed
     1028                 && (rc != VINF_PERMISSION_DENIED))
     1029        {
     1030            RTPrintf("Deleting property '%s' as guest returned %Rrc instead of VINF_PERMISSION_DENIED.\n",
     1031                     delPropertiesROGuest[i].pcszName, rc);
     1032            rc = VERR_IPE_UNEXPECTED_STATUS;
     1033        }
    10121034        else
    10131035            rc = VINF_SUCCESS;
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette