From 37fc8b5945dc8c02f461229daadac34c9c04f22e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 26 Aug 2014 12:40:21 -0700 Subject: [PATCH 1/3] Add initial spec task support on linux --- build/tasks/spec-task.coffee | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/build/tasks/spec-task.coffee b/build/tasks/spec-task.coffee index 1d2355f2d..baa8f2243 100644 --- a/build/tasks/spec-task.coffee +++ b/build/tasks/spec-task.coffee @@ -2,7 +2,6 @@ fs = require 'fs' path = require 'path' _ = require 'underscore-plus' - async = require 'async' module.exports = (grunt) -> @@ -10,18 +9,24 @@ module.exports = (grunt) -> packageSpecQueue = null + getAppPath = -> + contentsDir = grunt.config.get('atom.contentsDir') + switch process.platform + when 'darwin' + path.join(contentsDir, 'MacOS', 'Atom') + when 'linux' + path.join(contentsDir, 'atom') + when 'win32' + path.join(contentsDir, 'atom.exe') + runPackageSpecs = (callback) -> failedPackages = [] rootDir = grunt.config.get('atom.shellAppDir') - contentsDir = grunt.config.get('atom.contentsDir') resourcePath = process.cwd() - if process.platform is 'darwin' - appPath = path.join(contentsDir, 'MacOS', 'Atom') - else if process.platform is 'win32' - appPath = path.join(contentsDir, 'atom.exe') + appPath = getAppPath() packageSpecQueue = async.queue (packagePath, callback) -> - if process.platform is 'darwin' + if process.platform in ['darwin', 'linux'] options = cmd: appPath args: ['--test', "--resource-path=#{resourcePath}", "--spec-directory=#{path.join(packagePath, 'spec')}"] @@ -57,15 +62,11 @@ module.exports = (grunt) -> packageSpecQueue.drain = -> callback(null, failedPackages) runCoreSpecs = (callback) -> - contentsDir = grunt.config.get('atom.contentsDir') - if process.platform is 'darwin' - appPath = path.join(contentsDir, 'MacOS', 'Atom') - else if process.platform is 'win32' - appPath = path.join(contentsDir, 'atom.exe') + appPath = getAppPath() resourcePath = process.cwd() coreSpecsPath = path.resolve('spec') - if process.platform is 'darwin' + if process.platform in ['darwin', 'linux'] options = cmd: appPath args: ['--test', "--resource-path=#{resourcePath}", "--spec-directory=#{coreSpecsPath}"] @@ -90,7 +91,7 @@ module.exports = (grunt) -> # TODO: This should really be parallel on both platforms, however our # fixtures step on each others toes currently. - if process.platform is 'darwin' + if process.platform in ['darwin', 'linux'] method = async.parallel else if process.platform is 'win32' method = async.series From 08decbe533a2eaf847f24bcdc664a11fa84250a7 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 26 Aug 2014 14:29:30 -0700 Subject: [PATCH 2/3] Explicitly set app path perms to 755 on Linux --- build/tasks/spec-task.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build/tasks/spec-task.coffee b/build/tasks/spec-task.coffee index baa8f2243..5ddd0275a 100644 --- a/build/tasks/spec-task.coffee +++ b/build/tasks/spec-task.coffee @@ -25,6 +25,9 @@ module.exports = (grunt) -> resourcePath = process.cwd() appPath = getAppPath() + # Ensure application is executable on Linux + fs.chmodSync(appPath, '755') if process.platform is 'linux' + packageSpecQueue = async.queue (packagePath, callback) -> if process.platform in ['darwin', 'linux'] options = From 496e49a5b989eb32d4b7ac16b8ddd74ff3bae14e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 26 Aug 2014 15:10:43 -0700 Subject: [PATCH 3/3] Use correct process name on Linux --- build/Gruntfile.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Gruntfile.coffee b/build/Gruntfile.coffee index 6b1dae4a8..c9749a392 100644 --- a/build/Gruntfile.coffee +++ b/build/Gruntfile.coffee @@ -60,7 +60,7 @@ module.exports = (grunt) -> contentsDir = shellAppDir appDir = path.join(shellAppDir, 'resources', 'app') installDir ?= process.env.INSTALL_PREFIX ? '/usr/local' - killCommand ='pkill -9 Atom' + killCommand ='pkill -9 atom' coffeeConfig = glob_to_multiple: