Use the correct binary names in the updater test on Win32.

Binary names on Windows end with '.exe'
This commit is contained in:
Robert Knight 2011-08-22 17:01:33 +01:00
parent cf606b0cfe
commit b57696aa18

View file

@ -5,6 +5,11 @@ require 'fileutils.rb'
INSTALL_DIR = "install-dir/"
PACKAGE_DIR = "package-dir/"
OLDAPP_NAME = "oldapp.exe"
NEWAPP_NAME = "newapp.exe"
APP_NAME = "app.exe"
UPDATER_NAME = "updater.exe"
# Remove the install and package dirs if they
# already exist
FileUtils.rm_rf(INSTALL_DIR)
@ -12,7 +17,7 @@ FileUtils.rm_rf(PACKAGE_DIR)
# Create the install directory with the old app
Dir.mkdir(INSTALL_DIR)
FileUtils.cp("oldapp","#{INSTALL_DIR}/app")
FileUtils.cp(OLDAPP_NAME,"#{INSTALL_DIR}/#{APP_NAME}")
# Create a dummy file to uninstall
uninstall_test_file = "#{INSTALL_DIR}/file-to-uninstall.txt"
@ -22,23 +27,23 @@ end
# Create the update archive containing the new app
Dir.mkdir(PACKAGE_DIR)
FileUtils.cp("newapp","#{PACKAGE_DIR}/app")
system("zip #{PACKAGE_DIR}/app-pkg.zip -j #{PACKAGE_DIR}/app")
FileUtils.rm("#{PACKAGE_DIR}/app")
FileUtils.cp(NEWAPP_NAME,"#{PACKAGE_DIR}/#{APP_NAME}")
system("zip #{PACKAGE_DIR}/app-pkg.zip -j #{PACKAGE_DIR}/#{APP_NAME}")
FileUtils.rm("#{PACKAGE_DIR}/#{APP_NAME}")
# Copy the install script and updater to the target
# directory
FileUtils.cp("file_list.xml","#{PACKAGE_DIR}/file_list.xml")
FileUtils.cp("../updater","#{PACKAGE_DIR}/updater")
FileUtils.cp("../#{UPDATER_NAME}","#{PACKAGE_DIR}/#{UPDATER_NAME}")
# Run the updater using the new syntax
system("#{PACKAGE_DIR}/updater --install-dir #{INSTALL_DIR} --package-dir #{PACKAGE_DIR} --script #{PACKAGE_DIR}/file_list.xml")
system("#{PACKAGE_DIR}/#{UPDATER_NAME} --install-dir #{INSTALL_DIR} --package-dir #{PACKAGE_DIR} --script #{PACKAGE_DIR}/file_list.xml")
# TODO - Correctly wait until updater has finished
sleep(1)
# Check that the app was updated
app_path = "#{INSTALL_DIR}/app"
app_path = "#{INSTALL_DIR}/#{APP_NAME}"
output = `#{app_path}`
if (output.strip != "new app starting")
throw "Updated app produced unexpected output: #{output}"