Files: 65191f9a9664f013ebe726bb95a1a54b086e1bd5 / test / test-46-multi-arch-2 / main.js
1021 bytesRaw
1 | |
2 | |
3 | 'use strict'; |
4 | |
5 | const path = require('path'); |
6 | const assert = require('assert'); |
7 | const utils = require('../utils.js'); |
8 | |
9 | assert(!module.parent); |
10 | assert(__dirname === process.cwd()); |
11 | |
12 | if (function () { |
13 | // testing armv7-to-armv6 crosscompilation |
14 | if (process.platform === 'linux' && process.arch === 'arm') return false; |
15 | // TODO what about armv8? we need to distingish host arch |
16 | // armv6/armv7/armv8 - not just 'arm' we have now |
17 | // linux may not have multiarch installed |
18 | if (process.platform === 'linux') return true; |
19 | return false; |
20 | }()) return; |
21 | |
22 | const opposite = { x64: 'x86', |
23 | x86: 'x64', ia32: 'x64', arm: 'armv6' }; |
24 | |
25 | const target = opposite[process.arch]; |
26 | const input = './test-x-index.js'; |
27 | const output = './test-output.exe'; |
28 | |
29 | let right; |
30 | |
31 | utils.pkg.sync([ |
32 | '--target', target, |
33 | '--output', output, input |
34 | ], { stdio: 'inherit' }); |
35 | |
36 | right = utils.spawn.sync( |
37 | './' + path.basename(output), [], |
38 | { cwd: path.dirname(output) } |
39 | ); |
40 | |
41 | assert.equal(right, '42\n'); |
42 | utils.vacuum.sync(output); |
43 |
Built with git-ssb-web