Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #18019 from yurenju/maxBuffer
Browse files Browse the repository at this point in the history
Bug 992773 - maxBuffer for child_process.exec is exceeded in |make build... r=@cctuan
  • Loading branch information
yurenju committed Apr 8, 2014
2 parents 3aef168 + 8213581 commit c110fc3
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
19 changes: 9 additions & 10 deletions build/test/integration/build.test.js
@@ -1,4 +1,3 @@
var exec = require('child_process').exec;
var assert = require('chai').assert;
var rmrf = require('rimraf').sync;
var fs = require('fs');
Expand All @@ -22,7 +21,7 @@ suite('ADB tests', function() {
'push test_media/Movies /sdcard/Movies\n' +
'push test_media/Music /sdcard/Music\n';

exec('ADB=build/test/bin/fake-adb make install-test-media',
helper.exec('ADB=build/test/bin/fake-adb make install-test-media',
function(error, stdout, stderr) {
helper.checkError(error, stdout, stderr);
var presetsContent = fs.readFileSync(path.join(process.cwd(), 'build',
Expand All @@ -38,7 +37,7 @@ suite('Node modules tests', function() {
rmrf('modules.tar');
rmrf('node_modules');
rmrf('git-gaia-node-modules');
exec('NODE_MODULES_GIT_URL=https://git.mozilla.org/b2g/gaia-node-modules.git make node_modules',
helper.exec('NODE_MODULES_GIT_URL=https://git.mozilla.org/b2g/gaia-node-modules.git make node_modules',
function(error, stdout, stderr) {
helper.checkError(error, stdout, stderr);

Expand All @@ -58,7 +57,7 @@ suite('Node modules tests', function() {
rmrf('modules.tar');
rmrf('node_modules');
rmrf('git-gaia-node-modules');
exec('make node_modules',
helper.exec('make node_modules',
function(error, stdout, stderr) {
helper.checkError(error, stdout, stderr);

Expand All @@ -85,7 +84,7 @@ suite('Build Integration tests', function() {
});

test('make without rule & variable', function(done) {
exec('ROCKETBAR=none make', { maxBuffer: 400*1024 },
helper.exec('ROCKETBAR=none make', { maxBuffer: 400*1024 },
function(error, stdout, stderr) {
helper.checkError(error, stdout, stderr);

Expand Down Expand Up @@ -237,7 +236,7 @@ suite('Build Integration tests', function() {
});

test('make with PRODUCTION=1', function(done) {
exec('PRODUCTION=1 make', function(error, stdout, stderr) {
helper.exec('PRODUCTION=1 make', function(error, stdout, stderr) {
helper.checkError(error, stdout, stderr);

var settingsPath = path.join(process.cwd(), 'profile', 'settings.json');
Expand All @@ -259,7 +258,7 @@ suite('Build Integration tests', function() {
});

test('make with SIMULATOR=1', function(done) {
exec('SIMULATOR=1 make', { maxBuffer: 400*1024 },
helper.exec('SIMULATOR=1 make', { maxBuffer: 400*1024 },
function(error, stdout, stderr) {
helper.checkError(error, stdout, stderr);

Expand Down Expand Up @@ -337,7 +336,7 @@ suite('Build Integration tests', function() {
});

test('make with DEBUG=1', function(done) {
exec('DEBUG=1 make', { maxBuffer: 400*1024 },
helper.exec('DEBUG=1 make', { maxBuffer: 400*1024 },
function(error, stdout, stderr) {
helper.checkError(error, stdout, stderr);

Expand Down Expand Up @@ -446,7 +445,7 @@ suite('Build Integration tests', function() {
});

test('make with MOZILLA_OFFICIAL=1', function(done) {
exec('MOZILLA_OFFICIAL=1 make', { maxBuffer: 400*1024 },
helper.exec('MOZILLA_OFFICIAL=1 make', { maxBuffer: 400*1024 },
function(error, stdout, stderr) {
helper.checkError(error, stdout, stderr);

Expand All @@ -464,7 +463,7 @@ suite('Build Integration tests', function() {
});

test('make with ROCKETBAR=full', function(done) {
exec('ROCKETBAR=full make', { maxBuffer: 400*1024 },
helper.exec('ROCKETBAR=full make', { maxBuffer: 400*1024 },
function(error, stdout, stderr) {
helper.checkError(error, stdout, stderr);

Expand Down
3 changes: 1 addition & 2 deletions build/test/integration/distribution.test.js
Expand Up @@ -2,7 +2,6 @@

/* global require, process, suite, suiteSetup, test, teardown */
var rmrf = require('rimraf').sync;
var exec = require('child_process').exec;
var vm = require('vm');
var AdmZip = require('adm-zip');
var helper = require('./helper');
Expand Down Expand Up @@ -228,7 +227,7 @@ suite('Distribution mechanism', function() {
test('build with GAIA_DISTRIBUTION_DIR', function(done) {
cusDir = path.join(process.cwd(), 'customization');
var cmd = 'GAIA_DISTRIBUTION_DIR=' + cusDir + ' make';
exec(cmd, { maxBuffer: 400*1024 }, function(error, stdout, stderr) {
helper.exec(cmd, { maxBuffer: 400*1024 }, function(error, stdout, stderr) {
helper.checkError(error, stdout, stderr);
validatePreloadSettingDB();
validateSettings();
Expand Down
10 changes: 10 additions & 0 deletions build/test/integration/helper.js
@@ -1,6 +1,7 @@
var assert = require('chai').assert;
var fs = require('fs');
var AdmZip = require('adm-zip');
var exec = require('child_process').exec;

function getPrefsSandbox() {
var sandbox = {
Expand Down Expand Up @@ -87,6 +88,14 @@ function checkFileContentInZip(zipPath, pathInZip, expectedContent, isJSON) {
assert.deepEqual(actual, expectedContent);
}

function exec(command, callback) {
var options = {
maxBuffer: 400*1024
};

exec(command, options, callback);
}

exports.getPrefsSandbox = getPrefsSandbox;
exports.checkError = checkError;
exports.checkSettings = checkSettings;
Expand All @@ -95,3 +104,4 @@ exports.checkWebappsScheme = checkWebappsScheme;
exports.checkFileInZip = checkFileInZip;
exports.checkFileContentInZip = checkFileContentInZip;
exports.checkFileContentByPathInZip = checkFileContentByPathInZip;
exports.exec = exec;
3 changes: 1 addition & 2 deletions build/test/integration/multilocale.test.js
@@ -1,4 +1,3 @@
var exec = require('child_process').exec;
var assert = require('chai').assert;
var rmrf = require('rimraf').sync;
var download = require('download');
Expand Down Expand Up @@ -55,7 +54,7 @@ suite('multilocale Integration tests', function() {
// We were failing because the output from the gaia build process was
// larger than the default maximum buffer size on Travis, so we explicitly
// set a size here. The default of 200kb is not enough.
exec(command, { maxBuffer: 400*1024 }, function(error, stdout, stderr) {
helper.exec(command, { maxBuffer: 400*1024 }, function(error, stdout, stderr) {
helper.checkError(error, stdout, stderr);
var zip = new AdmZip(settingsZipPath);
if (inlineAndConcat) {
Expand Down

0 comments on commit c110fc3

Please sign in to comment.