gecko/toolkit/mozapps/update/tests/TestAUSHelper.cpp
Robert Strong f73022b0b2 App update test only changes and build changes for tests. Reorganize app update test structure and remove unneeded Makefiles and moz.build files for Bug 929149. r=bbondy, r=gps for build changes
--HG--
rename : toolkit/mozapps/update/test/Makefile.in => toolkit/mozapps/update/tests/Makefile.in
rename : toolkit/mozapps/update/test/TestAUSHelper.cpp => toolkit/mozapps/update/tests/TestAUSHelper.cpp
rename : toolkit/mozapps/update/test/TestAUSReadStrings.cpp => toolkit/mozapps/update/tests/TestAUSReadStrings.cpp
rename : toolkit/mozapps/update/test/TestAUSReadStrings1.ini => toolkit/mozapps/update/tests/TestAUSReadStrings1.ini
rename : toolkit/mozapps/update/test/TestAUSReadStrings2.ini => toolkit/mozapps/update/tests/TestAUSReadStrings2.ini
rename : toolkit/mozapps/update/test/TestAUSReadStrings3.ini => toolkit/mozapps/update/tests/TestAUSReadStrings3.ini
rename : toolkit/mozapps/update/test/chrome/chrome.ini => toolkit/mozapps/update/tests/chrome/chrome.ini
rename : toolkit/mozapps/update/test/chrome/test_0011_check_basic.xul => toolkit/mozapps/update/tests/chrome/test_0011_check_basic.xul
rename : toolkit/mozapps/update/test/chrome/test_0012_check_basic_license.xul => toolkit/mozapps/update/tests/chrome/test_0012_check_basic_license.xul
rename : toolkit/mozapps/update/test/chrome/test_0013_check_incompat_basic.xul => toolkit/mozapps/update/tests/chrome/test_0013_check_incompat_basic.xul
rename : toolkit/mozapps/update/test/chrome/test_0014_check_incompat_basic_license.xul => toolkit/mozapps/update/tests/chrome/test_0014_check_incompat_basic_license.xul
rename : toolkit/mozapps/update/test/chrome/test_0015_check_incompat_basic_addons.xul => toolkit/mozapps/update/tests/chrome/test_0015_check_incompat_basic_addons.xul
rename : toolkit/mozapps/update/test/chrome/test_0016_check_incompat_basic_license_addons.xul => toolkit/mozapps/update/tests/chrome/test_0016_check_incompat_basic_license_addons.xul
rename : toolkit/mozapps/update/test/chrome/test_0017_check_staging_basic.xul => toolkit/mozapps/update/tests/chrome/test_0017_check_staging_basic.xul
rename : toolkit/mozapps/update/test/chrome/test_0021_check_billboard.xul => toolkit/mozapps/update/tests/chrome/test_0021_check_billboard.xul
rename : toolkit/mozapps/update/test/chrome/test_0022_check_billboard_license.xul => toolkit/mozapps/update/tests/chrome/test_0022_check_billboard_license.xul
rename : toolkit/mozapps/update/test/chrome/test_0023_check_incompat_billboard.xul => toolkit/mozapps/update/tests/chrome/test_0023_check_incompat_billboard.xul
rename : toolkit/mozapps/update/test/chrome/test_0024_check_incompat_billboard_license.xul => toolkit/mozapps/update/tests/chrome/test_0024_check_incompat_billboard_license.xul
rename : toolkit/mozapps/update/test/chrome/test_0025_check_incompat_billboard_addons.xul => toolkit/mozapps/update/tests/chrome/test_0025_check_incompat_billboard_addons.xul
rename : toolkit/mozapps/update/test/chrome/test_0026_check_incompat_billboard_license_addons.xul => toolkit/mozapps/update/tests/chrome/test_0026_check_incompat_billboard_license_addons.xul
rename : toolkit/mozapps/update/test/chrome/test_0031_available_basic.xul => toolkit/mozapps/update/tests/chrome/test_0031_available_basic.xul
rename : toolkit/mozapps/update/test/chrome/test_0032_available_basic_license.xul => toolkit/mozapps/update/tests/chrome/test_0032_available_basic_license.xul
rename : toolkit/mozapps/update/test/chrome/test_0033_available_incompat_basic.xul => toolkit/mozapps/update/tests/chrome/test_0033_available_incompat_basic.xul
rename : toolkit/mozapps/update/test/chrome/test_0034_available_incompat_basic_license.xul => toolkit/mozapps/update/tests/chrome/test_0034_available_incompat_basic_license.xul
rename : toolkit/mozapps/update/test/chrome/test_0035_available_incompat_basic_addons.xul => toolkit/mozapps/update/tests/chrome/test_0035_available_incompat_basic_addons.xul
rename : toolkit/mozapps/update/test/chrome/test_0036_available_incompat_basic_license_addons.xul => toolkit/mozapps/update/tests/chrome/test_0036_available_incompat_basic_license_addons.xul
rename : toolkit/mozapps/update/test/chrome/test_0041_available_billboard.xul => toolkit/mozapps/update/tests/chrome/test_0041_available_billboard.xul
rename : toolkit/mozapps/update/test/chrome/test_0042_available_billboard_license.xul => toolkit/mozapps/update/tests/chrome/test_0042_available_billboard_license.xul
rename : toolkit/mozapps/update/test/chrome/test_0043_available_incompat_billboard.xul => toolkit/mozapps/update/tests/chrome/test_0043_available_incompat_billboard.xul
rename : toolkit/mozapps/update/test/chrome/test_0044_available_incompat_billboard_license.xul => toolkit/mozapps/update/tests/chrome/test_0044_available_incompat_billboard_license.xul
rename : toolkit/mozapps/update/test/chrome/test_0045_available_incompat_billboard_addons.xul => toolkit/mozapps/update/tests/chrome/test_0045_available_incompat_billboard_addons.xul
rename : toolkit/mozapps/update/test/chrome/test_0046_available_incompat_billboard_license_addons.xul => toolkit/mozapps/update/tests/chrome/test_0046_available_incompat_billboard_license_addons.xul
rename : toolkit/mozapps/update/test/chrome/test_0051_check_error_xml_malformed.xul => toolkit/mozapps/update/tests/chrome/test_0051_check_error_xml_malformed.xul
rename : toolkit/mozapps/update/test/chrome/test_0052_check_no_updates.xul => toolkit/mozapps/update/tests/chrome/test_0052_check_no_updates.xul
rename : toolkit/mozapps/update/test/chrome/test_0053_check_billboard_license_noAttr.xul => toolkit/mozapps/update/tests/chrome/test_0053_check_billboard_license_noAttr.xul
rename : toolkit/mozapps/update/test/chrome/test_0054_check_billboard_license_404.xul => toolkit/mozapps/update/tests/chrome/test_0054_check_billboard_license_404.xul
rename : toolkit/mozapps/update/test/chrome/test_0061_check_verifyFailPartial_noComplete.xul => toolkit/mozapps/update/tests/chrome/test_0061_check_verifyFailPartial_noComplete.xul
rename : toolkit/mozapps/update/test/chrome/test_0062_check_verifyFailComplete_noPartial.xul => toolkit/mozapps/update/tests/chrome/test_0062_check_verifyFailComplete_noPartial.xul
rename : toolkit/mozapps/update/test/chrome/test_0063_check_verifyFailPartialComplete.xul => toolkit/mozapps/update/tests/chrome/test_0063_check_verifyFailPartialComplete.xul
rename : toolkit/mozapps/update/test/chrome/test_0064_check_verifyFailPartial_successComplete.xul => toolkit/mozapps/update/tests/chrome/test_0064_check_verifyFailPartial_successComplete.xul
rename : toolkit/mozapps/update/test/chrome/test_0071_notify_verifyFailPartial_noComplete.xul => toolkit/mozapps/update/tests/chrome/test_0071_notify_verifyFailPartial_noComplete.xul
rename : toolkit/mozapps/update/test/chrome/test_0072_notify_verifyFailComplete_noPartial.xul => toolkit/mozapps/update/tests/chrome/test_0072_notify_verifyFailComplete_noPartial.xul
rename : toolkit/mozapps/update/test/chrome/test_0073_notify_verifyFailPartialComplete.xul => toolkit/mozapps/update/tests/chrome/test_0073_notify_verifyFailPartialComplete.xul
rename : toolkit/mozapps/update/test/chrome/test_0074_notify_verifyFailPartial_successComplete.xul => toolkit/mozapps/update/tests/chrome/test_0074_notify_verifyFailPartial_successComplete.xul
rename : toolkit/mozapps/update/test/chrome/test_0081_error_patchApplyFailure_partial_only.xul => toolkit/mozapps/update/tests/chrome/test_0081_error_patchApplyFailure_partial_only.xul
rename : toolkit/mozapps/update/test/chrome/test_0082_error_patchApplyFailure_complete_only.xul => toolkit/mozapps/update/tests/chrome/test_0082_error_patchApplyFailure_complete_only.xul
rename : toolkit/mozapps/update/test/chrome/test_0083_error_patchApplyFailure_partial_complete.xul => toolkit/mozapps/update/tests/chrome/test_0083_error_patchApplyFailure_partial_complete.xul
rename : toolkit/mozapps/update/test/chrome/test_0084_error_patchApplyFailure_verify_failed.xul => toolkit/mozapps/update/tests/chrome/test_0084_error_patchApplyFailure_verify_failed.xul
rename : toolkit/mozapps/update/test/chrome/test_0091_installed.xul => toolkit/mozapps/update/tests/chrome/test_0091_installed.xul
rename : toolkit/mozapps/update/test/chrome/test_0092_finishedBackground.xul => toolkit/mozapps/update/tests/chrome/test_0092_finishedBackground.xul
rename : toolkit/mozapps/update/test/chrome/test_0093_restartNotification.xul => toolkit/mozapps/update/tests/chrome/test_0093_restartNotification.xul
rename : toolkit/mozapps/update/test/chrome/test_0094_restartNotification_remote.xul => toolkit/mozapps/update/tests/chrome/test_0094_restartNotification_remote.xul
rename : toolkit/mozapps/update/test/chrome/test_0095_restartNotification_remoteInvalidNumber.xul => toolkit/mozapps/update/tests/chrome/test_0095_restartNotification_remoteInvalidNumber.xul
rename : toolkit/mozapps/update/test/chrome/test_0096_restartNotification_stagedBackground.xul => toolkit/mozapps/update/tests/chrome/test_0096_restartNotification_stagedBackground.xul
rename : toolkit/mozapps/update/test/chrome/test_0097_restartNotification_stagedServiceBackground.xul => toolkit/mozapps/update/tests/chrome/test_0097_restartNotification_stagedServiceBackground.xul
rename : toolkit/mozapps/update/test/chrome/test_0101_background_restartNotification.xul => toolkit/mozapps/update/tests/chrome/test_0101_background_restartNotification.xul
rename : toolkit/mozapps/update/test/chrome/test_0102_background_restartNotification_staging.xul => toolkit/mozapps/update/tests/chrome/test_0102_background_restartNotification_staging.xul
rename : toolkit/mozapps/update/test/chrome/test_0103_background_restartNotification_stagingService.xul => toolkit/mozapps/update/tests/chrome/test_0103_background_restartNotification_stagingService.xul
rename : toolkit/mozapps/update/test/chrome/test_0111_neverButton_basic.xul => toolkit/mozapps/update/tests/chrome/test_0111_neverButton_basic.xul
rename : toolkit/mozapps/update/test/chrome/test_0112_neverButton_billboard.xul => toolkit/mozapps/update/tests/chrome/test_0112_neverButton_billboard.xul
rename : toolkit/mozapps/update/test/chrome/test_0113_showNeverForVersionRemovedWithPref.xul => toolkit/mozapps/update/tests/chrome/test_0113_showNeverForVersionRemovedWithPref.xul
rename : toolkit/mozapps/update/test/chrome/test_0121_check_requireBuiltinCert.xul => toolkit/mozapps/update/tests/chrome/test_0121_check_requireBuiltinCert.xul
rename : toolkit/mozapps/update/test/chrome/test_0122_check_allowNonBuiltinCert_validCertAttrs.xul => toolkit/mozapps/update/tests/chrome/test_0122_check_allowNonBuiltinCert_validCertAttrs.xul
rename : toolkit/mozapps/update/test/chrome/test_0123_check_allowNonBuiltinCert_noCertAttrsCheck.xul => toolkit/mozapps/update/tests/chrome/test_0123_check_allowNonBuiltinCert_noCertAttrsCheck.xul
rename : toolkit/mozapps/update/test/chrome/test_0131_check_invalidCertAttrs_noUpdate.xul => toolkit/mozapps/update/tests/chrome/test_0131_check_invalidCertAttrs_noUpdate.xul
rename : toolkit/mozapps/update/test/chrome/test_0132_check_invalidCertAttrs_hasUpdate.xul => toolkit/mozapps/update/tests/chrome/test_0132_check_invalidCertAttrs_hasUpdate.xul
rename : toolkit/mozapps/update/test/chrome/test_0141_notify_invalidCertAttrs_noUpdate.xul => toolkit/mozapps/update/tests/chrome/test_0141_notify_invalidCertAttrs_noUpdate.xul
rename : toolkit/mozapps/update/test/chrome/test_0142_notify_invalidCertAttrs_hasUpdate.xul => toolkit/mozapps/update/tests/chrome/test_0142_notify_invalidCertAttrs_hasUpdate.xul
rename : toolkit/mozapps/update/test/chrome/test_0151_notify_backgroundCheckError.xul => toolkit/mozapps/update/tests/chrome/test_0151_notify_backgroundCheckError.xul
rename : toolkit/mozapps/update/test/chrome/test_0161_check_unsupported.xul => toolkit/mozapps/update/tests/chrome/test_0161_check_unsupported.xul
rename : toolkit/mozapps/update/test/chrome/test_0162_notify_unsupported.xul => toolkit/mozapps/update/tests/chrome/test_0162_notify_unsupported.xul
rename : toolkit/mozapps/update/test/chrome/test_0900_deprecatedUpdateFormat_minor.xul => toolkit/mozapps/update/tests/chrome/test_0900_deprecatedUpdateFormat_minor.xul
rename : toolkit/mozapps/update/test/chrome/test_0901_deprecatedUpdateFormat_major.xul => toolkit/mozapps/update/tests/chrome/test_0901_deprecatedUpdateFormat_major.xul
rename : toolkit/mozapps/update/test/chrome/test_9999_cleanup.xul => toolkit/mozapps/update/tests/chrome/test_9999_cleanup.xul
rename : toolkit/mozapps/update/test/chrome/update.sjs => toolkit/mozapps/update/tests/chrome/update.sjs
rename : toolkit/mozapps/update/test/chrome/utils.js => toolkit/mozapps/update/tests/chrome/utils.js
rename : toolkit/mozapps/update/test/unit/data/complete.mar => toolkit/mozapps/update/tests/data/complete.mar
rename : toolkit/mozapps/update/test/unit/data/complete.png => toolkit/mozapps/update/tests/data/complete.png
rename : toolkit/mozapps/update/test/unit/data/complete_cc_log_switch_success => toolkit/mozapps/update/tests/data/complete_cc_log_switch_success
rename : toolkit/mozapps/update/test/unit/data/complete_log_success => toolkit/mozapps/update/tests/data/complete_log_success
rename : toolkit/mozapps/update/test/unit/data/complete_log_switch_success => toolkit/mozapps/update/tests/data/complete_log_switch_success
rename : toolkit/mozapps/update/test/unit/data/complete_precomplete => toolkit/mozapps/update/tests/data/complete_precomplete
rename : toolkit/mozapps/update/test/unit/data/complete_removed-files => toolkit/mozapps/update/tests/data/complete_removed-files
rename : toolkit/mozapps/update/test/unit/data/complete_update_manifest => toolkit/mozapps/update/tests/data/complete_update_manifest
rename : toolkit/mozapps/update/test/unit/data/complete_win.mar => toolkit/mozapps/update/tests/data/complete_win.mar
rename : toolkit/mozapps/update/test/unit/data/old_version_mar.mar => toolkit/mozapps/update/tests/data/old_version.mar
rename : toolkit/mozapps/update/test/unit/data/partial.mar => toolkit/mozapps/update/tests/data/partial.mar
rename : toolkit/mozapps/update/test/unit/data/partial.png => toolkit/mozapps/update/tests/data/partial.png
rename : toolkit/mozapps/update/test/unit/data/partial_in_use_win_after.exe => toolkit/mozapps/update/tests/data/partial_in_use_win_after.exe
rename : toolkit/mozapps/update/test/unit/data/partial_in_use_win_before.exe => toolkit/mozapps/update/tests/data/partial_in_use_win_before.exe
rename : toolkit/mozapps/update/test/unit/data/partial_log_failure => toolkit/mozapps/update/tests/data/partial_log_failure
rename : toolkit/mozapps/update/test/unit/data/partial_log_success => toolkit/mozapps/update/tests/data/partial_log_success
rename : toolkit/mozapps/update/test/unit/data/partial_log_switch_success => toolkit/mozapps/update/tests/data/partial_log_switch_success
rename : toolkit/mozapps/update/test/unit/data/partial_precomplete => toolkit/mozapps/update/tests/data/partial_precomplete
rename : toolkit/mozapps/update/test/unit/data/partial_removed-files => toolkit/mozapps/update/tests/data/partial_removed-files
rename : toolkit/mozapps/update/test/unit/data/partial_update_manifest => toolkit/mozapps/update/tests/data/partial_update_manifest
rename : toolkit/mozapps/update/test/unit/data/partial_win.mar => toolkit/mozapps/update/tests/data/partial_win.mar
rename : toolkit/mozapps/update/test/unit/data/simple.mar => toolkit/mozapps/update/tests/data/simple.mar
rename : toolkit/mozapps/update/test/unit/data/simple_no_pib.mar => toolkit/mozapps/update/tests/data/simple_no_pib.mar
rename : toolkit/mozapps/update/test/unit/data/wrong_product_channel_mar.mar => toolkit/mozapps/update/tests/data/wrong_product_channel.mar
rename : toolkit/mozapps/update/test/marionette/data/bad.xml => toolkit/mozapps/update/tests/marionette/data/bad.xml
rename : toolkit/mozapps/update/test/marionette/data/err.cgi => toolkit/mozapps/update/tests/marionette/data/err.cgi
rename : toolkit/mozapps/update/test/marionette/update-smoketests.ini => toolkit/mozapps/update/tests/marionette/update-smoketests.ini
rename : toolkit/mozapps/update/test/marionette/update-tests.ini => toolkit/mozapps/update/tests/marionette/update-tests.ini
rename : toolkit/mozapps/update/test/marionette/update_smoketest_ota_same_version.js => toolkit/mozapps/update/tests/marionette/update_smoketest_ota_same_version.js
rename : toolkit/mozapps/update/test/marionette/update_smoketest_ota_same_version.py => toolkit/mozapps/update/tests/marionette/update_smoketest_ota_same_version.py
rename : toolkit/mozapps/update/test/marionette/update_smoketest_ota_simple.js => toolkit/mozapps/update/tests/marionette/update_smoketest_ota_simple.js
rename : toolkit/mozapps/update/test/marionette/update_smoketest_ota_simple.py => toolkit/mozapps/update/tests/marionette/update_smoketest_ota_simple.py
rename : toolkit/mozapps/update/test/marionette/update_test_ota_simple.js => toolkit/mozapps/update/tests/marionette/update_test_ota_simple.js
rename : toolkit/mozapps/update/test/marionette/update_test_ota_simple.py => toolkit/mozapps/update/tests/marionette/update_test_ota_simple.py
rename : toolkit/mozapps/update/test/marionette/update_test_status.js => toolkit/mozapps/update/tests/marionette/update_test_status.js
rename : toolkit/mozapps/update/test/marionette/update_test_status.py => toolkit/mozapps/update/tests/marionette/update_test_status.py
rename : toolkit/mozapps/update/test/moz.build => toolkit/mozapps/update/tests/moz.build
rename : toolkit/mozapps/update/test/shared.js => toolkit/mozapps/update/tests/shared.js
rename : toolkit/mozapps/update/test/sharedUpdateXML.js => toolkit/mozapps/update/tests/sharedUpdateXML.js
rename : toolkit/mozapps/update/test/unit/test_0010_general.js => toolkit/mozapps/update/tests/unit_aus_update/canCheckForAndCanApplyUpdates.js
rename : toolkit/mozapps/update/test/unit/test_0063_manager.js => toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForDifferentChannel.js
rename : toolkit/mozapps/update/test/unit/test_0061_manager.js => toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForOlderAppVersion.js
rename : toolkit/mozapps/update/test/unit/test_0064_manager.js => toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForSameVersionAndBuildID.js
rename : toolkit/mozapps/update/test/unit/test_0072_update_dir_cleanup.js => toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingIncorrectStatus.js
rename : toolkit/mozapps/update/test/unit/test_0073_update_dir_cleanup.js => toolkit/mozapps/update/tests/unit_aus_update/cleanupPendingVersionFileIncorrectStatus.js
rename : toolkit/mozapps/update/test/unit/test_0070_update_dir_cleanup.js => toolkit/mozapps/update/tests/unit_aus_update/cleanupSuccessLogMove.js
rename : toolkit/mozapps/update/test/unit/test_0071_update_dir_cleanup.js => toolkit/mozapps/update/tests/unit_aus_update/cleanupSuccessLogsFIFO.js
rename : toolkit/mozapps/update/test/unit/test_bug595059.js => toolkit/mozapps/update/tests/unit_aus_update/downloadCompleteAfterPartialFailure.js
rename : toolkit/mozapps/update/test/unit/test_bug833708.js => toolkit/mozapps/update/tests/unit_aus_update/downloadFileTooBig_gonk.js
rename : toolkit/mozapps/update/test/unit/test_bug794211.js => toolkit/mozapps/update/tests/unit_aus_update/downloadInterruptedByOfflineRetry.js
rename : toolkit/mozapps/update/test/unit/test_0030_general.js => toolkit/mozapps/update/tests/unit_aus_update/downloadMar.js
rename : toolkit/mozapps/update/test/unit/test_0062_manager.js => toolkit/mozapps/update/tests/unit_aus_update/downloadResumeForSameAppVersion.js
rename : toolkit/mozapps/update/test/unit/head_update.js.in => toolkit/mozapps/update/tests/unit_aus_update/head_update.js
rename : toolkit/mozapps/update/test/unit/test_0020_general.js => toolkit/mozapps/update/tests/unit_aus_update/remoteUpdateXML.js
rename : toolkit/mozapps/update/test/unit/test_0081_prompt_uiAlreadyOpen.js => toolkit/mozapps/update/tests/unit_aus_update/uiOnlyAllowOneWindow.js
rename : toolkit/mozapps/update/test/unit/test_0080_prompt_silent.js => toolkit/mozapps/update/tests/unit_aus_update/uiSilentPref.js
rename : toolkit/mozapps/update/test/unit/test_0082_prompt_unsupportAlreadyNotified.js => toolkit/mozapps/update/tests/unit_aus_update/uiUnsupportedAlreadyNotified.js
rename : toolkit/mozapps/update/test/unit/test_0050_general.js => toolkit/mozapps/update/tests/unit_aus_update/updateCheckOnLoadOnErrorStatusText.js
rename : toolkit/mozapps/update/test/unit/test_0060_manager.js => toolkit/mozapps/update/tests/unit_aus_update/updateManagerXML.js
rename : toolkit/mozapps/update/test/unit/test_0300_update_root_dir_migration.js => toolkit/mozapps/update/tests/unit_aus_update/updateRootDirMigration_win.js
rename : toolkit/mozapps/update/test/unit/test_0040_general.js => toolkit/mozapps/update/tests/unit_aus_update/urlConstruction.js
rename : toolkit/mozapps/update/test/unit/xpcshell.ini => toolkit/mozapps/update/tests/unit_aus_update/xpcshell.ini
rename : toolkit/mozapps/update/test/unit/test_0203_app_launch_apply_update.js => toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateAppBinInUseStageSuccess_win.js
rename : toolkit/mozapps/update/test/unit/test_0201_app_launch_apply_update.js => toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateStageSuccess.js
rename : toolkit/mozapps/update/test/unit/test_0200_app_launch_apply_update.js => toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateSuccess.js
rename : toolkit/mozapps/update/test/unit/test_0162_appInUse_xp_win_complete.js => toolkit/mozapps/update/tests/unit_base_updater/marAppInUseFallbackStageFailureComplete_win.js
rename : toolkit/mozapps/update/test/unit/test_0161_appInUse_xp_win_complete.js => toolkit/mozapps/update/tests/unit_base_updater/marAppInUseStageFailureComplete_win.js
rename : toolkit/mozapps/update/test/unit/test_0161_appInUse_xp_unix_complete.js => toolkit/mozapps/update/tests/unit_base_updater/marAppInUseStageSuccessComplete_unix.js
rename : toolkit/mozapps/update/test/unit/test_0160_appInUse_complete.js => toolkit/mozapps/update/tests/unit_base_updater/marAppInUseSuccessComplete.js
rename : toolkit/mozapps/update/test/unit/test_0152_appBinReplaced_xp_win_complete.js => toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppStageSuccessComplete_win.js
rename : toolkit/mozapps/update/test/unit/test_0153_appBinPatched_xp_win_partial.js => toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppStageSuccessPartial_win.js
rename : toolkit/mozapps/update/test/unit/test_0150_appBinReplaced_xp_win_complete.js => toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppSuccessComplete_win.js
rename : toolkit/mozapps/update/test/unit/test_0151_appBinPatched_xp_win_partial.js => toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppSuccessPartial_win.js
rename : toolkit/mozapps/update/test/unit/test_0202_app_launch_apply_update_dirlocked.js => toolkit/mozapps/update/tests/unit_base_updater/marDirLockedStageFailure_win.js
rename : toolkit/mozapps/update/test/unit/test_0112_general.js => toolkit/mozapps/update/tests/unit_base_updater/marFailurePartial.js
rename : toolkit/mozapps/update/test/unit/test_0188_fileInUse_xp_win_complete.js => toolkit/mozapps/update/tests/unit_base_updater/marFileInUseFallbackStageFailureComplete_win.js
rename : toolkit/mozapps/update/test/unit/test_0189_fileInUse_xp_win_partial.js => toolkit/mozapps/update/tests/unit_base_updater/marFileInUseFallbackStageFailurePartial_win.js
rename : toolkit/mozapps/update/test/unit/test_0184_fileInUse_xp_win_complete.js => toolkit/mozapps/update/tests/unit_base_updater/marFileInUseStageSuccessComplete_win.js
rename : toolkit/mozapps/update/test/unit/test_0185_fileInUse_xp_win_partial.js => toolkit/mozapps/update/tests/unit_base_updater/marFileInUseStageSuccessPartial_win.js
rename : toolkit/mozapps/update/test/unit/test_0180_fileInUse_xp_win_complete.js => toolkit/mozapps/update/tests/unit_base_updater/marFileInUseSuccessComplete_win.js
rename : toolkit/mozapps/update/test/unit/test_0181_fileInUse_xp_win_partial.js => toolkit/mozapps/update/tests/unit_base_updater/marFileInUseSuccessPartial_win.js
rename : toolkit/mozapps/update/test/unit/test_0170_fileLocked_xp_win_complete.js => toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFailureComplete_win.js
rename : toolkit/mozapps/update/test/unit/test_0171_fileLocked_xp_win_partial.js => toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFailurePartial_win.js
rename : toolkit/mozapps/update/test/unit/test_0174_fileLocked_xp_win_complete.js => toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFallbackStageFailureComplete_win.js
rename : toolkit/mozapps/update/test/unit/test_0175_fileLocked_xp_win_partial.js => toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFallbackStageFailurePartial_win.js
rename : toolkit/mozapps/update/test/unit/test_0172_fileLocked_xp_win_complete.js => toolkit/mozapps/update/tests/unit_base_updater/marFileLockedStageFailureComplete_win.js
rename : toolkit/mozapps/update/test/unit/test_0173_fileLocked_xp_win_partial.js => toolkit/mozapps/update/tests/unit_base_updater/marFileLockedStageFailurePartial_win.js
rename : toolkit/mozapps/update/test/unit/test_0190_rmrfdirFileInUse_xp_win_complete.js => toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseFallbackStageFailureComplete_win.js
rename : toolkit/mozapps/update/test/unit/test_0191_rmrfdirFileInUse_xp_win_partial.js => toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseFallbackStageFailurePartial_win.js
rename : toolkit/mozapps/update/test/unit/test_0186_rmrfdirFileInUse_xp_win_complete.js => toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseStageSuccessComplete_win.js
rename : toolkit/mozapps/update/test/unit/test_0187_rmrfdirFileInUse_xp_win_partial.js => toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseStageSuccessPartial_win.js
rename : toolkit/mozapps/update/test/unit/test_0182_rmrfdirFileInUse_xp_win_complete.js => toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseSuccessComplete_win.js
rename : toolkit/mozapps/update/test/unit/test_0183_rmrfdirFileInUse_xp_win_partial.js => toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseSuccessPartial_win.js
rename : toolkit/mozapps/update/test/unit/test_0115_general.js => toolkit/mozapps/update/tests/unit_base_updater/marStageFailurePartial.js
rename : toolkit/mozapps/update/test/unit/test_0113_general.js => toolkit/mozapps/update/tests/unit_base_updater/marStageSuccessComplete.js
rename : toolkit/mozapps/update/test/unit/test_0114_general.js => toolkit/mozapps/update/tests/unit_base_updater/marStageSuccessPartial.js
rename : toolkit/mozapps/update/test/unit/test_0110_general.js => toolkit/mozapps/update/tests/unit_base_updater/marSuccessComplete.js
rename : toolkit/mozapps/update/test/unit/test_0111_general.js => toolkit/mozapps/update/tests/unit_base_updater/marSuccessPartial.js
rename : toolkit/mozapps/update/test/unit/test_0113_versionDowngradeCheck.js => toolkit/mozapps/update/tests/unit_base_updater/marVersionDowngrade.js
rename : toolkit/mozapps/update/test/unit/test_0114_productChannelCheck.js => toolkit/mozapps/update/tests/unit_base_updater/marWrongChannel.js
rename : toolkit/mozapps/update/test/unit/xpcshell_updater.ini => toolkit/mozapps/update/tests/unit_base_updater/xpcshell.ini
rename : toolkit/mozapps/update/test_svc/unit/test_0000_bootstrap_svc.js => toolkit/mozapps/update/tests/unit_service_updater/bootstrapSvc.js
rename : toolkit/mozapps/update/test_svc/unit/test_0203_app_launch_apply_update_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateAppBinInUseStageSuccessSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0201_app_launch_apply_update_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateStageSuccessSvc.js
rename : toolkit/mozapps/update/test_svc/unit/test_0200_app_launch_apply_update_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateSuccessSvc.js
rename : toolkit/mozapps/update/test_svc/unit/test_0162_appInUse_xp_win_complete_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marAppInUseFallbackStageFailureCompleteSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0161_appInUse_xp_win_complete_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marAppInUseStageFailureCompleteSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0160_appInUse_complete_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marAppInUseSuccessCompleteSvc.js
rename : toolkit/mozapps/update/test_svc/unit/test_0152_appBinReplaced_xp_win_complete_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppStageSuccessCompleteSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0153_appBinPatched_xp_win_partial_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppStageSuccessPartialSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0150_appBinReplaced_xp_win_complete_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppSuccessCompleteSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0151_appBinPatched_xp_win_partial_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppSuccessPartialSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0202_app_launch_apply_update_dirlocked_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marDirLockedStageFailureSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0112_general_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marFailurePartialSvc.js
rename : toolkit/mozapps/update/test_svc/unit/test_0188_fileInUse_xp_win_complete_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marFileInUseFallbackStageFailureCompleteSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0189_fileInUse_xp_win_partial_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marFileInUseFallbackStageFailurePartialSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0184_fileInUse_xp_win_complete_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageSuccessCompleteSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0185_fileInUse_xp_win_partial_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageSuccessPartialSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0180_fileInUse_xp_win_complete_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marFileInUseSuccessCompleteSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0181_fileInUse_xp_win_partial_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marFileInUseSuccessPartialSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0170_fileLocked_xp_win_complete_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFailureCompleteSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0171_fileLocked_xp_win_partial_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFailurePartialSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0174_fileLocked_xp_win_complete_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFallbackStageFailureCompleteSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0175_fileLocked_xp_win_partial_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFallbackStageFailurePartialSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0172_fileLocked_xp_win_complete_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marFileLockedStageFailureCompleteSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0173_fileLocked_xp_win_partial_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marFileLockedStageFailurePartialSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0190_rmrfdirFileInUse_xp_win_complete_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseFallbackStageFailureCompleteSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0191_rmrfdirFileInUse_xp_win_partial_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseFallbackStageFailurePartialSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0186_rmrfdirFileInUse_xp_win_complete_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageSuccessCompleteSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0187_rmrfdirFileInUse_xp_win_partial_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageSuccessPartialSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0182_rmrfdirFileInUse_xp_win_complete_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseSuccessCompleteSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0183_rmrfdirFileInUse_xp_win_partial_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseSuccessPartialSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0115_general_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marStageFailurePartialSvc.js
rename : toolkit/mozapps/update/test_svc/unit/test_0113_general_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marStageSuccessCompleteSvc.js
rename : toolkit/mozapps/update/test_svc/unit/test_0114_general_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marStageSuccessPartialSvc.js
rename : toolkit/mozapps/update/test_svc/unit/test_0110_general_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marSuccessCompleteSvc.js
rename : toolkit/mozapps/update/test_svc/unit/test_0111_general_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marSuccessPartialSvc.js
rename : toolkit/mozapps/update/test_svc/unit/xpcshell.ini => toolkit/mozapps/update/tests/unit_service_updater/xpcshell.ini
rename : toolkit/mozapps/update/test_timermanager/unit/test_0010_timermanager.js => toolkit/mozapps/update/tests/unit_timermanager/consumerNotifications.js
rename : toolkit/mozapps/update/test_timermanager/unit/xpcshell.ini => toolkit/mozapps/update/tests/unit_timermanager/xpcshell.ini
2013-10-25 18:37:29 -07:00

371 lines
9.9 KiB
C++

/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
#ifdef XP_WIN
#pragma comment(lib, "wintrust.lib")
#pragma comment(lib, "crypt32.lib")
# include <windows.h>
# include <wintrust.h>
# include <tlhelp32.h>
# include <softpub.h>
# include <direct.h>
# include <io.h>
typedef WCHAR NS_tchar;
# define NS_main wmain
# define F_OK 00
# define W_OK 02
# define R_OK 04
# define stat _stat
# define NS_T(str) L ## str
# define NS_tsnprintf(dest, count, fmt, ...) \
{ \
int _count = count - 1; \
_snwprintf(dest, _count, fmt, ##__VA_ARGS__); \
dest[_count] = L'\0'; \
}
# define NS_taccess _waccess
# define NS_tchdir _wchdir
# define NS_tfopen _wfopen
# define NS_tstrcmp wcscmp
# define NS_ttoi _wtoi
# define NS_tstat _wstat
# define NS_tgetcwd _wgetcwd
# define LOG_S "%S"
#include "../common/updatehelper.h"
#else
# include <unistd.h>
# define NS_main main
typedef char NS_tchar;
# define NS_T(str) str
# define NS_tsnprintf snprintf
# define NS_taccess access
# define NS_tchdir chdir
# define NS_tfopen fopen
# define NS_tstrcmp strcmp
# define NS_ttoi atoi
# define NS_tstat stat
# define NS_tgetcwd getcwd
# define NS_tfputs fputs
# define LOG_S "%s"
#endif
#include "mozilla/NullPtr.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifndef MAXPATHLEN
# ifdef PATH_MAX
# define MAXPATHLEN PATH_MAX
# elif defined(MAX_PATH)
# define MAXPATHLEN MAX_PATH
# elif defined(_MAX_PATH)
# define MAXPATHLEN _MAX_PATH
# elif defined(CCHMAXPATH)
# define MAXPATHLEN CCHMAXPATH
# else
# define MAXPATHLEN 1024
# endif
#endif
static void
WriteMsg(const NS_tchar *path, const char *status)
{
FILE* outFP = NS_tfopen(path, NS_T("wb"));
if (!outFP)
return;
fprintf(outFP, "%s\n", status);
fclose(outFP);
outFP = nullptr;
}
static bool
CheckMsg(const NS_tchar *path, const char *expected)
{
if (NS_taccess(path, F_OK)) {
return false;
}
FILE *inFP = NS_tfopen(path, NS_T("rb"));
if (!inFP) {
return false;
}
struct stat ms;
if (fstat(fileno(inFP), &ms)) {
return false;
}
char *mbuf = (char *) malloc(ms.st_size + 1);
if (!mbuf) {
return false;
}
size_t r = ms.st_size;
char *rb = mbuf;
size_t c = fread(rb, sizeof(char), 50, inFP);
r -= c;
rb += c;
if (c == 0 && r) {
return false;
}
mbuf[ms.st_size] = '\0';
rb = mbuf;
fclose(inFP);
inFP = nullptr;
return strcmp(rb, expected) == 0;
}
#ifdef XP_WIN
/**
* Verifies the trust of the specified file path.
*
* @param filePath The file path to check.
* @return ERROR_SUCCESS if successful, or the last error code otherwise.
*/
DWORD
VerifyCertificateTrustForFile(LPCWSTR filePath)
{
// Setup the file to check.
WINTRUST_FILE_INFO fileToCheck;
ZeroMemory(&fileToCheck, sizeof(fileToCheck));
fileToCheck.cbStruct = sizeof(WINTRUST_FILE_INFO);
fileToCheck.pcwszFilePath = filePath;
// Setup what to check, we want to check it is signed and trusted.
WINTRUST_DATA trustData;
ZeroMemory(&trustData, sizeof(trustData));
trustData.cbStruct = sizeof(trustData);
trustData.pPolicyCallbackData = nullptr;
trustData.pSIPClientData = nullptr;
trustData.dwUIChoice = WTD_UI_NONE;
trustData.fdwRevocationChecks = WTD_REVOKE_NONE;
trustData.dwUnionChoice = WTD_CHOICE_FILE;
trustData.dwStateAction = 0;
trustData.hWVTStateData = nullptr;
trustData.pwszURLReference = nullptr;
// no UI
trustData.dwUIContext = 0;
trustData.pFile = &fileToCheck;
GUID policyGUID = WINTRUST_ACTION_GENERIC_VERIFY_V2;
// Check if the file is signed by something that is trusted.
return WinVerifyTrust(nullptr, &policyGUID, &trustData);
}
#endif
int NS_main(int argc, NS_tchar **argv)
{
if (argc < 3) {
fprintf(stderr, \
"\n" \
"Application Update Service Test Helper\n" \
"\n" \
"Usage: WORKINGDIR INFILE OUTFILE -s SECONDS [FILETOLOCK]\n" \
" or: WORKINGDIR LOGFILE [ARG2 ARG3...]\n" \
" or: signature-check filepath\n" \
" or: setup-symlink dir1 dir2 file symlink\n" \
" or: remove-symlink dir1 dir2 file symlink\n" \
" or: check-symlink symlink\n" \
"\n" \
" WORKINGDIR \tThe relative path to the working directory to use.\n" \
" INFILE \tThe relative path from the working directory for the file to\n" \
" \tread actions to perform such as finish.\n" \
" OUTFILE \tThe relative path from the working directory for the file to\n" \
" \twrite status information.\n" \
" SECONDS \tThe number of seconds to sleep.\n" \
" FILETOLOCK \tThe relative path from the working directory to an existing\n" \
" \tfile to open exlusively.\n" \
" \tOnly available on Windows platforms and silently ignored on\n" \
" \tother platforms.\n" \
" LOGFILE \tThe relative path from the working directory to log the\n" \
" \tcommand line arguments.\n" \
" ARG2 ARG3...\tArguments to write to the LOGFILE after the preceding command\n" \
" \tline arguments.\n" \
"\n" \
"Note: All paths must be relative.\n" \
"\n");
return 1;
}
if (!NS_tstrcmp(argv[1], NS_T("check-signature"))) {
#ifdef XP_WIN
if (ERROR_SUCCESS == VerifyCertificateTrustForFile(argv[2])) {
return 0;
} else {
return 1;
}
#else
// Not implemented on non-Windows platforms
return 1;
#endif
}
if (!NS_tstrcmp(argv[1], NS_T("setup-symlink"))) {
#ifdef XP_UNIX
NS_tchar path[MAXPATHLEN];
NS_tsnprintf(path, sizeof(path)/sizeof(path[0]),
NS_T("%s/%s"), NS_T("/tmp"), argv[2]);
mkdir(path, 0755);
NS_tsnprintf(path, sizeof(path)/sizeof(path[0]),
NS_T("%s/%s/%s"), NS_T("/tmp"), argv[2], argv[3]);
mkdir(path, 0755);
NS_tsnprintf(path, sizeof(path)/sizeof(path[0]),
NS_T("%s/%s/%s/%s"), NS_T("/tmp"), argv[2], argv[3], argv[4]);
FILE * file = NS_tfopen(path, NS_T("w"));
if (file) {
NS_tfputs(NS_T("test"), file);
fclose(file);
}
symlink(path, argv[5]);
NS_tsnprintf(path, sizeof(path)/sizeof(path[0]),
NS_T("%s/%s"), NS_T("/tmp"), argv[2]);
if (argc > 6 && !NS_tstrcmp(argv[6], NS_T("change-perm"))) {
chmod(path, 0644);
}
return 0;
#else
// Not implemented on non-Unix platforms
return 1;
#endif
}
if (!NS_tstrcmp(argv[1], NS_T("remove-symlink"))) {
#ifdef XP_UNIX
NS_tchar path[MAXPATHLEN];
NS_tsnprintf(path, sizeof(path)/sizeof(path[0]),
NS_T("%s/%s"), NS_T("/tmp"), argv[2]);
chmod(path, 0755);
NS_tsnprintf(path, sizeof(path)/sizeof(path[0]),
NS_T("%s/%s/%s/%s"), NS_T("/tmp"), argv[2], argv[3], argv[4]);
unlink(path);
NS_tsnprintf(path, sizeof(path)/sizeof(path[0]),
NS_T("%s/%s/%s"), NS_T("/tmp"), argv[2], argv[3]);
rmdir(path);
NS_tsnprintf(path, sizeof(path)/sizeof(path[0]),
NS_T("%s/%s"), NS_T("/tmp"), argv[2]);
rmdir(path);
return 0;
#else
// Not implemented on non-Unix platforms
return 1;
#endif
}
if (!NS_tstrcmp(argv[1], NS_T("check-symlink"))) {
#ifdef XP_UNIX
struct stat ss;
lstat(argv[2], &ss);
return S_ISLNK(ss.st_mode) ? 0 : 1;
#else
// Not implemented on non-Unix platforms
return 1;
#endif
}
if (!NS_tstrcmp(argv[1], NS_T("wait-for-service-stop"))) {
#ifdef XP_WIN
const int maxWaitSeconds = NS_ttoi(argv[3]);
LPCWSTR serviceName = argv[2];
DWORD serviceState = WaitForServiceStop(serviceName, maxWaitSeconds);
if (SERVICE_STOPPED == serviceState) {
return 0;
} else {
return serviceState;
}
#else
// Not implemented on non-Windows platforms
return 1;
#endif
}
if (!NS_tstrcmp(argv[1], NS_T("wait-for-application-exit"))) {
#ifdef XP_WIN
const int maxWaitSeconds = NS_ttoi(argv[3]);
LPCWSTR application = argv[2];
DWORD ret = WaitForProcessExit(application, maxWaitSeconds);
if (ERROR_SUCCESS == ret) {
return 0;
} else if (WAIT_TIMEOUT == ret) {
return 1;
} else {
return 2;
}
#else
// Not implemented on non-Windows platforms
return 1;
#endif
}
int i = 0;
if (NS_tchdir(argv[1]) != 0) {
return 1;
}
// File in use test helper section
if (!NS_tstrcmp(argv[4], NS_T("-s"))) {
NS_tchar *cwd = NS_tgetcwd(nullptr, 0);
NS_tchar inFilePath[MAXPATHLEN];
NS_tsnprintf(inFilePath, sizeof(inFilePath)/sizeof(inFilePath[0]),
NS_T("%s/%s"), cwd, argv[2]);
NS_tchar outFilePath[MAXPATHLEN];
NS_tsnprintf(outFilePath, sizeof(outFilePath)/sizeof(outFilePath[0]),
NS_T("%s/%s"), cwd, argv[3]);
int seconds = NS_ttoi(argv[5]);
#ifdef XP_WIN
HANDLE hFile = INVALID_HANDLE_VALUE;
if (argc == 7) {
hFile = CreateFileW(argv[6],
DELETE | GENERIC_WRITE, 0,
nullptr, OPEN_EXISTING, 0, nullptr);
if (hFile == INVALID_HANDLE_VALUE) {
WriteMsg(outFilePath, "error_locking");
return 1;
}
}
WriteMsg(outFilePath, "sleeping");
while (!CheckMsg(inFilePath, "finish\n") && i++ <= seconds) {
Sleep(1000);
}
if (argc == 7) {
CloseHandle(hFile);
}
#else
WriteMsg(outFilePath, "sleeping");
while (!CheckMsg(inFilePath, "finish\n") && i++ <= seconds) {
sleep(1);
}
#endif
WriteMsg(outFilePath, "finished");
return 0;
}
// Command line argument test helper section
NS_tchar logFilePath[MAXPATHLEN];
NS_tsnprintf(logFilePath, sizeof(logFilePath)/sizeof(logFilePath[0]),
NS_T("%s"), argv[2]);
FILE* logFP = NS_tfopen(logFilePath, NS_T("wb"));
for (i = 1; i < argc; ++i) {
fprintf(logFP, LOG_S "\n", argv[i]);
}
fclose(logFP);
logFP = nullptr;
return 0;
}