@webos-tools/cli 3.0.3 → 3.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +1 -1
- package/.eslintrc.js +52 -52
- package/APIs.js +79 -79
- package/CHANGELOG.md +128 -123
- package/LICENSE +201 -201
- package/README.md +218 -218
- package/bin/ares-config.js +199 -199
- package/bin/ares-device-info.js +30 -30
- package/bin/ares-device.js +219 -219
- package/bin/ares-generate.js +270 -270
- package/bin/ares-inspect.js +179 -179
- package/bin/ares-install.js +223 -223
- package/bin/ares-launch.js +318 -318
- package/bin/ares-log.js +255 -255
- package/bin/ares-novacom.js +223 -223
- package/bin/ares-package.js +336 -336
- package/bin/ares-pull.js +156 -156
- package/bin/ares-push.js +155 -155
- package/bin/ares-server.js +174 -174
- package/bin/ares-setup-device.js +520 -520
- package/bin/ares-shell.js +132 -132
- package/bin/ares.js +166 -166
- package/files/conf/ares.json +49 -49
- package/files/conf/command-service.json +73 -73
- package/files/conf/config.json +22 -22
- package/files/conf/ipk.json +30 -30
- package/files/conf/novacom-devices.json +35 -35
- package/files/conf/query/query-app.json +14 -14
- package/files/conf/query/query-hosted.json +18 -18
- package/files/conf/query/query-package.json +10 -10
- package/files/conf/query/query-service.json +6 -6
- package/files/conf/sdk.json +8 -8
- package/files/conf/template.json +57 -57
- package/files/conf/webos_emul +27 -27
- package/files/conf-base/env/sdk-ose.json +8 -8
- package/files/conf-base/env/sdk-tv.json +8 -8
- package/files/conf-base/profile/config-ose.json +21 -21
- package/files/conf-base/profile/config-tv.json +22 -22
- package/files/conf-base/query/query-app.json +14 -14
- package/files/conf-base/query/query-hosted.json +18 -18
- package/files/conf-base/query/query-package.json +10 -10
- package/files/conf-base/query/query-service.json +6 -6
- package/files/conf-base/template-conf/ose-templates.json +67 -67
- package/files/conf-base/template-conf/tv-sdk-templates.json +57 -57
- package/files/help/ares-config.help +43 -43
- package/files/help/ares-device.help +94 -94
- package/files/help/ares-generate.help +65 -65
- package/files/help/ares-inspect.help +70 -70
- package/files/help/ares-install.help +90 -90
- package/files/help/ares-launch.help +100 -100
- package/files/help/ares-log-pmlogd.help +84 -84
- package/files/help/ares-log.help +101 -101
- package/files/help/ares-novacom.help +68 -68
- package/files/help/ares-package.help +101 -101
- package/files/help/ares-pull.help +38 -38
- package/files/help/ares-push.help +38 -38
- package/files/help/ares-server.help +39 -39
- package/files/help/ares-setup-device.help +75 -75
- package/files/help/ares-shell.help +42 -42
- package/files/help/ares.help +47 -47
- package/files/help/readme.help +23 -23
- package/files/schema/ApplicationDescription.schema +319 -319
- package/files/schema/NovacomDevices.schema +61 -61
- package/files/templates/ose-sdk-templates/appinfo/appinfo.json +10 -10
- package/files/templates/ose-sdk-templates/bootplate-web/index.html +88 -88
- package/files/templates/ose-sdk-templates/hosted-webapp/index.html +13 -13
- package/files/templates/ose-sdk-templates/icon/icon.png +0 -0
- package/files/templates/ose-sdk-templates/js-service/helloclient.js +31 -31
- package/files/templates/ose-sdk-templates/js-service/helloworld_webos_service.js +188 -188
- package/files/templates/ose-sdk-templates/qml-app/main.qml +68 -68
- package/files/templates/ose-sdk-templates/qmlappinfo/appinfo.json +10 -10
- package/files/templates/ose-sdk-templates/serviceinfo/package.json +11 -11
- package/files/templates/ose-sdk-templates/serviceinfo/services.json +8 -8
- package/files/templates/tv-sdk-templates/appinfo/appinfo.json +10 -10
- package/files/templates/tv-sdk-templates/bootplate-web/index.html +58 -58
- package/files/templates/tv-sdk-templates/bootplate-web/webOSTVjs-1.2.10/LICENSE-2.0.txt +202 -202
- package/files/templates/tv-sdk-templates/hosted-webapp/index.html +14 -14
- package/files/templates/tv-sdk-templates/js-service/helloworld_service.js +39 -39
- package/files/templates/tv-sdk-templates/packageinfo/packageinfo.json +3 -3
- package/files/templates/tv-sdk-templates/serviceinfo/package.json +11 -11
- package/files/templates/tv-sdk-templates/serviceinfo/services.json +8 -8
- package/files/templates/tv-sdk-templates/webicon/icon.png +0 -0
- package/files/templates/tv-sdk-templates/webicon/largeIcon.png +0 -0
- package/lib/base/ares.html +40 -40
- package/lib/base/cli-appdata.js +290 -301
- package/lib/base/cli-control.js +44 -44
- package/lib/base/common-tools.js +29 -29
- package/lib/base/error-handler.js +265 -265
- package/lib/base/file-watcher.js +155 -155
- package/lib/base/help-format.js +147 -147
- package/lib/base/luna.js +178 -178
- package/lib/base/novacom.js +1191 -1191
- package/lib/base/sdkenv.js +59 -59
- package/lib/base/server.js +137 -137
- package/lib/base/setup-device.js +328 -328
- package/lib/base/version-tools.js +79 -79
- package/lib/device.js +1419 -1419
- package/lib/generator.js +377 -377
- package/lib/inspect.js +494 -494
- package/lib/install.js +463 -463
- package/lib/launch.js +605 -605
- package/lib/log.js +584 -584
- package/lib/package.js +2129 -2129
- package/lib/pull.js +231 -231
- package/lib/pusher.js +210 -210
- package/lib/session.js +74 -74
- package/lib/shell.js +193 -193
- package/lib/tar-filter-pack.js +62 -62
- package/lib/util/copy.js +31 -31
- package/lib/util/createFileName.js +40 -40
- package/lib/util/eof.js +30 -30
- package/lib/util/json.js +63 -63
- package/lib/util/merge.js +14 -14
- package/lib/util/objclone.js +40 -40
- package/lib/util/spinner.js +37 -37
- package/npm-shrinkwrap.json +9115 -9115
- package/package.json +100 -97
- package/scripts/postinstall.js +24 -0
- package/spec/helpers/reporter.js +65 -65
- package/spec/jsSpecs/apiTest/generator.spec.js +372 -372
- package/spec/jsSpecs/apiTest/inspector.spec.js +89 -89
- package/spec/jsSpecs/apiTest/installer.spec.js +67 -67
- package/spec/jsSpecs/apiTest/launcher.spec.js +150 -150
- package/spec/jsSpecs/apiTest/packager.spec.js +194 -194
- package/spec/jsSpecs/apiTest/puller.spec.js +101 -101
- package/spec/jsSpecs/apiTest/pusher.spec.js +103 -103
- package/spec/jsSpecs/apiTest/server.spec.js +115 -115
- package/spec/jsSpecs/apiTest/setupDevice.spec.js +93 -93
- package/spec/jsSpecs/apiTest/shell.spec.js +49 -49
- package/spec/jsSpecs/ares-config.spec.js +78 -78
- package/spec/jsSpecs/ares-device.spec.js +443 -443
- package/spec/jsSpecs/ares-generate.spec.js +397 -397
- package/spec/jsSpecs/ares-inspect.spec.js +252 -252
- package/spec/jsSpecs/ares-install.spec.js +150 -150
- package/spec/jsSpecs/ares-launch.spec.js +301 -301
- package/spec/jsSpecs/ares-log.spec.js +824 -824
- package/spec/jsSpecs/ares-novacom.spec.js +149 -149
- package/spec/jsSpecs/ares-package.spec.js +1211 -1211
- package/spec/jsSpecs/ares-pull.spec.js +157 -157
- package/spec/jsSpecs/ares-push.spec.js +146 -146
- package/spec/jsSpecs/ares-server.spec.js +160 -160
- package/spec/jsSpecs/ares-setup-device.spec.js +281 -281
- package/spec/jsSpecs/ares-shell.spec.js +220 -220
- package/spec/jsSpecs/ares.spec.js +83 -83
- package/spec/jsSpecs/common-spec.js +169 -169
- package/spec/support/jasmine.json +22 -22
- package/spec/tempFiles/nativeApp/auto/pkg_arm64/GLES2 +0 -0
- package/spec/tempFiles/nativeApp/auto/pkg_arm64/appinfo.json +9 -9
- package/spec/tempFiles/nativeApp/ose/pkg_arm/Hello +0 -0
- package/spec/tempFiles/nativeApp/ose/pkg_arm/appinfo.json +8 -8
- package/spec/tempFiles/nativeApp/ose/pkg_arm/package.properties +2 -2
- package/spec/tempFiles/nativeApp/oseEmul/pkg_x86/Hello +0 -0
- package/spec/tempFiles/nativeApp/oseEmul/pkg_x86/appinfo.json +9 -9
- package/spec/tempFiles/nativeApp/rsi/pkg_x86/GLES2 +0 -0
- package/spec/tempFiles/nativeApp/rsi/pkg_x86/appinfo.json +9 -9
- package/spec/tempFiles/sign/sign.crt +32 -32
- package/spec/tempFiles/sign/signPriv.key +52 -52
- package/spec/test_data/ares-generate.json +41 -41
- package/spec/test_data/ares.json +33 -33
|
@@ -1,1211 +1,1211 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2020-2024 LG Electronics Inc.
|
|
3
|
-
*
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
const path = require('path'),
|
|
8
|
-
fs = require('fs'),
|
|
9
|
-
exec = require('child_process').exec,
|
|
10
|
-
common = require('./common-spec');
|
|
11
|
-
|
|
12
|
-
const tempDirPath = path.join(__dirname, "..", "tempFiles"),
|
|
13
|
-
sampleAppPath = path.join(tempDirPath, "sampleApp"),
|
|
14
|
-
sampleServicePath = path.join(tempDirPath, "sampleService"),
|
|
15
|
-
sampleResourcePath = path.join(tempDirPath, "sampleResource"),
|
|
16
|
-
nativeDirPath = path.join(tempDirPath, "nativeApp"),
|
|
17
|
-
pkgInfoPath = path.join(tempDirPath, "packageinfo.json"),
|
|
18
|
-
outputPath = path.join(tempDirPath, "output"),
|
|
19
|
-
appPathByRom = path.join(outputPath, "usr/palm/applications"),
|
|
20
|
-
appPkgPath = path.join(outputPath, "com.webos.sample.app_1.0.0_all.ipk"),
|
|
21
|
-
svcPkgPath = path.join(outputPath, "com.webos.sample_1.0.0_all.ipk"),
|
|
22
|
-
appinfoPath = path.join(sampleAppPath, "appinfo.json"),
|
|
23
|
-
signKeyPath = path.join(tempDirPath, "sign/signPriv.key"),
|
|
24
|
-
crtPath = path.join(tempDirPath,"sign/sign.crt"),
|
|
25
|
-
ipkBasePath = path.join(tempDirPath, "ipks"),
|
|
26
|
-
pkgDirPath = path.join(tempDirPath, "pkgDir");
|
|
27
|
-
|
|
28
|
-
const aresCmd = 'ares-package',
|
|
29
|
-
sampleServicePaths = [];
|
|
30
|
-
|
|
31
|
-
let cmd,
|
|
32
|
-
expectedTemplate;
|
|
33
|
-
|
|
34
|
-
beforeAll(function(done) {
|
|
35
|
-
cmd = common.makeCmd(aresCmd);
|
|
36
|
-
common.getExpectedResult("ares-generate")
|
|
37
|
-
.then(function(result) {
|
|
38
|
-
expectedTemplate = result.template;
|
|
39
|
-
done();
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
afterAll(function(done) {
|
|
44
|
-
common.removeOutDir(sampleAppPath); // can be in afterAll
|
|
45
|
-
common.removeOutDir(sampleServicePath); // can be in afterAll
|
|
46
|
-
common.removeOutDir(pkgInfoPath);
|
|
47
|
-
common.removeOutDir(pkgDirPath);
|
|
48
|
-
done();
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
describe(aresCmd + ' -v', function() {
|
|
52
|
-
it('Print help message with verbose log', function(done) {
|
|
53
|
-
exec(cmd + ' -v', function(error, stdout, stderr) {
|
|
54
|
-
if (stderr && stderr.length > 0) {
|
|
55
|
-
common.detectNodeMessage(stderr);
|
|
56
|
-
expect(stderr).toContain("verb argv");
|
|
57
|
-
}
|
|
58
|
-
expect(stdout).toContain("SYNOPSIS");
|
|
59
|
-
expect(error).toBeNull();
|
|
60
|
-
done();
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
describe(aresCmd, function() {
|
|
66
|
-
beforeEach(function(done) {
|
|
67
|
-
common.removeOutDir(sampleAppPath);
|
|
68
|
-
done();
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it('Generate a sample app for packaging', function(done) {
|
|
72
|
-
const generateCmd = common.makeCmd('ares-generate');
|
|
73
|
-
exec(generateCmd + ` -t ${expectedTemplate.webapp} -p "id=com.webos.sample.app" -p "version=1.0.0" ${sampleAppPath}`, function(error, stdout, stderr) {
|
|
74
|
-
if (stderr && stderr.length > 0) {
|
|
75
|
-
common.detectNodeMessage(stderr);
|
|
76
|
-
}
|
|
77
|
-
expect(stdout).toContain("Generating");
|
|
78
|
-
expect(error).toBeNull();
|
|
79
|
-
done();
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
describe(aresCmd, function() {
|
|
85
|
-
beforeEach(function(done) {
|
|
86
|
-
common.removeOutDir(sampleServicePath);
|
|
87
|
-
done();
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
it('Generate two sample services for packaging', function(done) {
|
|
91
|
-
const serviceid = ["com.webos.sample.app.service", "com.webos.sample.service1", "com.webos.sample.service2"];
|
|
92
|
-
serviceid.forEach(function(svcId) {
|
|
93
|
-
const svcPath = path.join(sampleServicePath, svcId);
|
|
94
|
-
sampleServicePaths.push(path.join(sampleServicePath, svcId));
|
|
95
|
-
const generateCmd = common.makeCmd('ares-generate');
|
|
96
|
-
exec(generateCmd + ` -t ${expectedTemplate.jsservice} -s ${svcId} ${svcPath}`, function(error, stdout, stderr) {
|
|
97
|
-
if (stderr && stderr.length > 0) {
|
|
98
|
-
common.detectNodeMessage(stderr);
|
|
99
|
-
}
|
|
100
|
-
expect(stdout).toContain("Generating");
|
|
101
|
-
done();
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
describe(aresCmd, function() {
|
|
108
|
-
beforeEach(function(done) {
|
|
109
|
-
common.removeOutDir(outputPath);
|
|
110
|
-
done();
|
|
111
|
-
});
|
|
112
|
-
afterEach(function(done) {
|
|
113
|
-
common.removeOutDir(outputPath);
|
|
114
|
-
done();
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it('Package web app with -o(--outdir)', function(done) {
|
|
118
|
-
exec(cmd + ` ${sampleAppPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
119
|
-
if (stderr && stderr.length > 0) {
|
|
120
|
-
common.detectNodeMessage(stderr);
|
|
121
|
-
}
|
|
122
|
-
expect(stdout).toContain("Create", error);
|
|
123
|
-
expect(stdout).toContain("Success", error);
|
|
124
|
-
expect(fs.existsSync(appPkgPath)).toBe(true);
|
|
125
|
-
done();
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
describe(aresCmd, function() {
|
|
131
|
-
beforeEach(function(done) {
|
|
132
|
-
common.removeOutDir(outputPath);
|
|
133
|
-
done();
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
it('Package web app & service with -o(--outdir)', function(done) {
|
|
137
|
-
exec(cmd + ` ${sampleAppPath} ${sampleServicePaths[0]} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
138
|
-
if (stderr && stderr.length > 0) {
|
|
139
|
-
common.detectNodeMessage(stderr);
|
|
140
|
-
}
|
|
141
|
-
expect(stdout).toContain(outputPath);
|
|
142
|
-
expect(stdout).toContain("Success", error);
|
|
143
|
-
expect(fs.existsSync(appPkgPath)).toBe(true);
|
|
144
|
-
done();
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
describe(aresCmd, function() {
|
|
150
|
-
beforeEach(function(done) {
|
|
151
|
-
common.removeOutDir(outputPath);
|
|
152
|
-
|
|
153
|
-
const appinfo = {
|
|
154
|
-
"id": "com.webos.sample.app",
|
|
155
|
-
"vendor": "My Company",
|
|
156
|
-
"type": "web",
|
|
157
|
-
"main": "index.html",
|
|
158
|
-
"title": "new app",
|
|
159
|
-
"icon": "icon.png"
|
|
160
|
-
};
|
|
161
|
-
fs.writeFileSync(appinfoPath, JSON.stringify(appinfo), 'utf8');
|
|
162
|
-
done();
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
it('App version does not exist', function(done) {
|
|
166
|
-
exec(cmd + ` ${sampleAppPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
167
|
-
if (stderr && stderr.length > 0) {
|
|
168
|
-
common.detectNodeMessage(stderr);
|
|
169
|
-
}
|
|
170
|
-
expect(stdout).toContain("Create", error);
|
|
171
|
-
expect(stdout).toContain("Success", error);
|
|
172
|
-
expect(fs.existsSync(appPkgPath)).toBe(true);
|
|
173
|
-
done();
|
|
174
|
-
});
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
describe(aresCmd, function() {
|
|
179
|
-
const expectedFilePath = path.join(outputPath, "com.webos.sample_1.0.0_all.ipk");
|
|
180
|
-
beforeAll(function(done) {
|
|
181
|
-
common.removeOutDir(pkgInfoPath);
|
|
182
|
-
const pkgInfo = {
|
|
183
|
-
"id": "com.webos.sample",
|
|
184
|
-
"version": "1.0.0"
|
|
185
|
-
};
|
|
186
|
-
fs.writeFileSync(pkgInfoPath, JSON.stringify(pkgInfo), 'utf8');
|
|
187
|
-
done();
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
beforeEach(function(done) {
|
|
191
|
-
common.removeOutDir(outputPath);
|
|
192
|
-
done();
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
afterAll(function(done) {
|
|
196
|
-
common.removeOutDir(outputPath);
|
|
197
|
-
common.removeOutDir(pkgInfoPath);
|
|
198
|
-
done();
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
it('Package web app with -pi option', function(done) {
|
|
202
|
-
exec(cmd + ` ${sampleAppPath} -pi com.webos.sample -o ${outputPath}`, function(error, stdout, stderr) {
|
|
203
|
-
if (stderr && stderr.length > 0) {
|
|
204
|
-
common.detectNodeMessage(stderr);
|
|
205
|
-
}
|
|
206
|
-
expect(stdout).toContain("Create", error);
|
|
207
|
-
expect(stdout).toContain("Success", error);
|
|
208
|
-
expect(fs.existsSync(expectedFilePath)).toBe(true);
|
|
209
|
-
done();
|
|
210
|
-
});
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
it('Package web app with -pf option', function(done) {
|
|
214
|
-
exec(cmd + ` ${sampleAppPath} -pf ${pkgInfoPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
215
|
-
if (stderr && stderr.length > 0) {
|
|
216
|
-
common.detectNodeMessage(stderr);
|
|
217
|
-
}
|
|
218
|
-
expect(stdout).toContain("Create", error);
|
|
219
|
-
expect(stdout).toContain("Success", error);
|
|
220
|
-
expect(fs.existsSync(expectedFilePath)).toBe(true);
|
|
221
|
-
done();
|
|
222
|
-
});
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
describe(aresCmd + ' --pkginfofile(-pf)', function() {
|
|
227
|
-
const pkgPath = path.join(outputPath, "com_1.0.0_all.ipk");
|
|
228
|
-
beforeAll(function(done) {
|
|
229
|
-
common.removeOutDir(pkgInfoPath);
|
|
230
|
-
common.removeOutDir(outputPath);
|
|
231
|
-
const pkginfo = {
|
|
232
|
-
"id":"com",
|
|
233
|
-
"version":"1.0.0"
|
|
234
|
-
};
|
|
235
|
-
fs.writeFileSync(pkgInfoPath, JSON.stringify(pkginfo), 'utf8');
|
|
236
|
-
done();
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
afterAll(function(done) {
|
|
240
|
-
common.removeOutDir(pkgInfoPath);
|
|
241
|
-
common.removeOutDir(outputPath);
|
|
242
|
-
done();
|
|
243
|
-
});
|
|
244
|
-
|
|
245
|
-
it('Package web app by packageinfo.json and -o(--outdir)', function(done) {
|
|
246
|
-
exec(cmd + ` ${sampleAppPath} -pf ${pkgInfoPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
247
|
-
if (stderr && stderr.length > 0) {
|
|
248
|
-
common.detectNodeMessage(stderr);
|
|
249
|
-
}
|
|
250
|
-
expect(stdout).toContain(outputPath);
|
|
251
|
-
expect(stdout).toContain("Success", error);
|
|
252
|
-
expect(fs.existsSync(pkgPath)).toBe(true);
|
|
253
|
-
done();
|
|
254
|
-
});
|
|
255
|
-
});
|
|
256
|
-
|
|
257
|
-
it('Check to exist app field in packageinfo.json', function(done) {
|
|
258
|
-
exec(cmd + ` -I ${pkgPath}`, function(error, stdout, stderr) {
|
|
259
|
-
if (stderr && stderr.length > 0) {
|
|
260
|
-
common.detectNodeMessage(stderr);
|
|
261
|
-
}
|
|
262
|
-
expect(stdout).toContain('"app": "com.webos.sample.app"');
|
|
263
|
-
done();
|
|
264
|
-
});
|
|
265
|
-
});
|
|
266
|
-
});
|
|
267
|
-
|
|
268
|
-
describe(aresCmd, function() {
|
|
269
|
-
beforeEach(function(done) {
|
|
270
|
-
common.removeOutDir(outputPath);
|
|
271
|
-
done();
|
|
272
|
-
});
|
|
273
|
-
|
|
274
|
-
it('Package ose native app with -o(--outdir)', function(done) {
|
|
275
|
-
const nativeAppPath = path.join(nativeDirPath, "ose/pkg_arm");
|
|
276
|
-
const expectIpkName = "com.ose.target.native_1.0.0_arm.ipk";
|
|
277
|
-
const expectIpkPath = path.join(outputPath, expectIpkName);
|
|
278
|
-
|
|
279
|
-
exec(cmd + ` ${nativeAppPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
280
|
-
if (stderr && stderr.length > 0) {
|
|
281
|
-
common.detectNodeMessage(stderr);
|
|
282
|
-
}
|
|
283
|
-
expect(stdout).toContain("Create", error);
|
|
284
|
-
expect(stdout).toContain("Success", error);
|
|
285
|
-
expect(stdout).toContain(expectIpkName, error);
|
|
286
|
-
expect(fs.existsSync(expectIpkPath)).toBe(true, error);
|
|
287
|
-
done();
|
|
288
|
-
});
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
// emulator
|
|
292
|
-
it('Package ose emulator native app with -o(--outdir)', function(done) {
|
|
293
|
-
const nativeAppPath = path.join(nativeDirPath, "oseEmul/pkg_x86");
|
|
294
|
-
const expectIpkName = "com.ose.emul.native_1.0.0_x86.ipk";
|
|
295
|
-
const expectIpkPath = path.join(outputPath, expectIpkName);
|
|
296
|
-
|
|
297
|
-
exec(cmd + ` ${nativeAppPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
298
|
-
if (stderr && stderr.length > 0) {
|
|
299
|
-
common.detectNodeMessage(stderr);
|
|
300
|
-
}
|
|
301
|
-
expect(stdout).toContain("Create", error);
|
|
302
|
-
expect(stdout).toContain("Success", error);
|
|
303
|
-
expect(stdout).toContain(expectIpkName, error);
|
|
304
|
-
expect(fs.existsSync(expectIpkPath)).toBe(true, error);
|
|
305
|
-
done();
|
|
306
|
-
});
|
|
307
|
-
});
|
|
308
|
-
|
|
309
|
-
// arm64 target
|
|
310
|
-
it('Package auto native app with -o(--outdir)', function(done) {
|
|
311
|
-
const nativeAppPath = path.join(nativeDirPath, "auto/pkg_arm64");
|
|
312
|
-
const expectIpkName = "com.sample.gles2_1.0.0_aarch64.ipk";
|
|
313
|
-
const expectIpkPath = path.join(outputPath, expectIpkName);
|
|
314
|
-
|
|
315
|
-
exec(cmd + ` ${nativeAppPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
316
|
-
if (stderr && stderr.length > 0) {
|
|
317
|
-
common.detectNodeMessage(stderr);
|
|
318
|
-
}
|
|
319
|
-
expect(stdout).toContain("Create", error);
|
|
320
|
-
expect(stdout).toContain("Success", error);
|
|
321
|
-
expect(stdout).toContain(expectIpkName, error);
|
|
322
|
-
expect(fs.existsSync(expectIpkPath)).toBe(true, error);
|
|
323
|
-
done();
|
|
324
|
-
});
|
|
325
|
-
});
|
|
326
|
-
|
|
327
|
-
// rsi target
|
|
328
|
-
it('Package rsi native app with -o(--outdir)', function(done) {
|
|
329
|
-
const nativeAppPath = path.join(nativeDirPath, "rsi/pkg_x86");
|
|
330
|
-
const expectIpkName = "com.sample.gles2_1.0.0_x86_64.ipk";
|
|
331
|
-
const expectIpkPath = path.join(outputPath, expectIpkName);
|
|
332
|
-
|
|
333
|
-
exec(cmd + ` ${nativeAppPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
334
|
-
if (stderr && stderr.length > 0) {
|
|
335
|
-
common.detectNodeMessage(stderr);
|
|
336
|
-
}
|
|
337
|
-
expect(stdout).toContain("Create", error);
|
|
338
|
-
expect(stdout).toContain("Success", error);
|
|
339
|
-
expect(stdout).toContain(expectIpkName, error);
|
|
340
|
-
expect(fs.existsSync(expectIpkPath)).toBe(true, error);
|
|
341
|
-
done();
|
|
342
|
-
});
|
|
343
|
-
});
|
|
344
|
-
});
|
|
345
|
-
|
|
346
|
-
describe(aresCmd, function() {
|
|
347
|
-
beforeAll(function(done) {
|
|
348
|
-
common.removeOutDir(pkgInfoPath);
|
|
349
|
-
|
|
350
|
-
const pkginfo = {
|
|
351
|
-
"id": "com.webos.sample",
|
|
352
|
-
"version": "1.0.0"
|
|
353
|
-
};
|
|
354
|
-
fs.writeFileSync(pkgInfoPath, JSON.stringify(pkginfo), 'utf8');
|
|
355
|
-
done();
|
|
356
|
-
});
|
|
357
|
-
|
|
358
|
-
beforeEach(function(done) {
|
|
359
|
-
common.removeOutDir(outputPath);
|
|
360
|
-
done();
|
|
361
|
-
});
|
|
362
|
-
|
|
363
|
-
afterAll(function(done) {
|
|
364
|
-
common.removeOutDir(outputPath);
|
|
365
|
-
common.removeOutDir(pkgInfoPath);
|
|
366
|
-
done();
|
|
367
|
-
});
|
|
368
|
-
|
|
369
|
-
it('Package only service with -pi and -o(--outdir)', function(done) {
|
|
370
|
-
exec(cmd + ` ${sampleServicePaths[1]} ${sampleServicePaths[2]} -pi com.webos.sample -o ${outputPath}`, function(error, stdout, stderr) {
|
|
371
|
-
if (stderr && stderr.length > 0) {
|
|
372
|
-
common.detectNodeMessage(stderr);
|
|
373
|
-
}
|
|
374
|
-
expect(stdout).toContain(outputPath);
|
|
375
|
-
expect(stdout).toContain("Success", error);
|
|
376
|
-
expect(fs.existsSync(svcPkgPath)).toBe(true);
|
|
377
|
-
done();
|
|
378
|
-
});
|
|
379
|
-
});
|
|
380
|
-
|
|
381
|
-
it('Package only service with -pf and -o(--outdir)', function(done) {
|
|
382
|
-
exec(cmd + ` ${sampleServicePaths[1]} ${sampleServicePaths[2]} -pf ${pkgInfoPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
383
|
-
if (stderr && stderr.length > 0) {
|
|
384
|
-
common.detectNodeMessage(stderr);
|
|
385
|
-
}
|
|
386
|
-
expect(stdout).toContain(outputPath);
|
|
387
|
-
expect(stdout).toContain("Success", error);
|
|
388
|
-
expect(fs.existsSync(svcPkgPath)).toBe(true);
|
|
389
|
-
done();
|
|
390
|
-
});
|
|
391
|
-
});
|
|
392
|
-
|
|
393
|
-
it('Package service with -pf and -pv', function(done) {
|
|
394
|
-
const expectedTmpFile = path.join(outputPath,"com.webos.sample_1.1.1_all.ipk");
|
|
395
|
-
exec(cmd + ` ${sampleServicePaths[0]} -pf ${pkgInfoPath} -pv 1.1.1 -o ${outputPath}`, function(error, stdout, stderr) {
|
|
396
|
-
if (stderr && stderr.length > 0) {
|
|
397
|
-
common.detectNodeMessage(stderr);
|
|
398
|
-
}
|
|
399
|
-
expect(stdout).toContain(outputPath);
|
|
400
|
-
expect(stdout).toContain("Success", error);
|
|
401
|
-
expect(fs.existsSync(expectedTmpFile)).toBe(true);
|
|
402
|
-
done();
|
|
403
|
-
});
|
|
404
|
-
});
|
|
405
|
-
});
|
|
406
|
-
|
|
407
|
-
describe(aresCmd + ' --check(-c)', function() {
|
|
408
|
-
it('Check the application but do not pacakge', function(done) {
|
|
409
|
-
exec(cmd + ` -c ${sampleAppPath} ${sampleServicePaths[0]}`, function(error, stdout, stderr) {
|
|
410
|
-
if (stderr && stderr.length > 0) {
|
|
411
|
-
common.detectNodeMessage(stderr);
|
|
412
|
-
}
|
|
413
|
-
expect(stdout).toContain("no problems detected");
|
|
414
|
-
done();
|
|
415
|
-
});
|
|
416
|
-
});
|
|
417
|
-
it('Check the services but do not pacakge', function(done) {
|
|
418
|
-
exec(cmd + ` -c ${sampleServicePaths[1]} ${sampleServicePaths[2]} -pi com.webos.sample`, function(error, stdout, stderr) {
|
|
419
|
-
if (stderr && stderr.length > 0) {
|
|
420
|
-
common.detectNodeMessage(stderr);
|
|
421
|
-
}
|
|
422
|
-
expect(stdout).toContain("no problems detected");
|
|
423
|
-
done();
|
|
424
|
-
});
|
|
425
|
-
});
|
|
426
|
-
});
|
|
427
|
-
|
|
428
|
-
describe(aresCmd + ' --rom(-r)', function() {
|
|
429
|
-
beforeEach(function(done) {
|
|
430
|
-
common.removeOutDir(outputPath);
|
|
431
|
-
done();
|
|
432
|
-
});
|
|
433
|
-
|
|
434
|
-
afterEach(function(done) {
|
|
435
|
-
common.removeOutDir(outputPath);
|
|
436
|
-
done();
|
|
437
|
-
});
|
|
438
|
-
|
|
439
|
-
it('Create output a directory structure with app', function(done) {
|
|
440
|
-
exec(cmd + ` -r ${sampleAppPath} ${sampleServicePaths[0]} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
441
|
-
if (stderr && stderr.length > 0) {
|
|
442
|
-
common.detectNodeMessage(stderr);
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
const createdSvcPath = path.join(outputPath, 'usr/palm/services');
|
|
446
|
-
expect(stdout).toContain('Create output directory');
|
|
447
|
-
expect(fs.existsSync(appPathByRom)).toBe(true);
|
|
448
|
-
expect(fs.existsSync(createdSvcPath)).toBe(true);
|
|
449
|
-
done();
|
|
450
|
-
});
|
|
451
|
-
});
|
|
452
|
-
|
|
453
|
-
it('Create output a directory structure without app', function(done) {
|
|
454
|
-
exec(cmd + ` -r ${sampleServicePaths[1]} ${sampleServicePaths[2]} -pi com.webos.sample -o ${outputPath}`, function(error, stdout, stderr) {
|
|
455
|
-
if (stderr && stderr.length > 0) {
|
|
456
|
-
common.detectNodeMessage(stderr);
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
const createdSvcPath = path.join(outputPath, 'usr/palm/services');
|
|
460
|
-
expect(stdout).toContain('Create output directory');
|
|
461
|
-
expect(fs.existsSync(createdSvcPath)).toBe(true);
|
|
462
|
-
done();
|
|
463
|
-
});
|
|
464
|
-
});
|
|
465
|
-
});
|
|
466
|
-
|
|
467
|
-
describe(aresCmd + ' --encrypt(-enc)', function() {
|
|
468
|
-
beforeEach(function(done) {
|
|
469
|
-
common.removeOutDir(outputPath);
|
|
470
|
-
done();
|
|
471
|
-
});
|
|
472
|
-
|
|
473
|
-
afterEach(function(done) {
|
|
474
|
-
common.removeOutDir(outputPath);
|
|
475
|
-
done();
|
|
476
|
-
});
|
|
477
|
-
|
|
478
|
-
it('Encrypted ipk', function(done) {
|
|
479
|
-
exec(cmd + ` -enc ${sampleAppPath} ${sampleServicePaths[0]} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
480
|
-
if (stderr && stderr.length > 0) {
|
|
481
|
-
common.detectNodeMessage(stderr);
|
|
482
|
-
expect(stderr).toContain("ares-package ERR! [syscall failure]: ENOENT: no such file or directory, open", error);
|
|
483
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: Please check if the path is valid", error);
|
|
484
|
-
}
|
|
485
|
-
expect(fs.existsSync(appPkgPath)).toBe(false);
|
|
486
|
-
done();
|
|
487
|
-
});
|
|
488
|
-
});
|
|
489
|
-
});
|
|
490
|
-
|
|
491
|
-
describe(aresCmd + ' --sign(-s) & --certificate(-crt)', function() {
|
|
492
|
-
beforeEach(function(done) {
|
|
493
|
-
common.removeOutDir(outputPath);
|
|
494
|
-
done();
|
|
495
|
-
});
|
|
496
|
-
|
|
497
|
-
afterEach(function(done) {
|
|
498
|
-
common.removeOutDir(outputPath);
|
|
499
|
-
done();
|
|
500
|
-
});
|
|
501
|
-
|
|
502
|
-
it('Sign ipk', function(done) {
|
|
503
|
-
exec(cmd +` -s ${signKeyPath} -crt ${crtPath} ${sampleAppPath} ${sampleServicePaths[0]} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
504
|
-
if (stderr && stderr.length > 0) {
|
|
505
|
-
common.detectNodeMessage(stderr);
|
|
506
|
-
}
|
|
507
|
-
expect(stdout).toContain('Create signed', error);
|
|
508
|
-
expect(fs.existsSync(appPkgPath)).toBe(true);
|
|
509
|
-
done();
|
|
510
|
-
});
|
|
511
|
-
});
|
|
512
|
-
});
|
|
513
|
-
|
|
514
|
-
describe(aresCmd + ' --app-exclude(-e)', function() {
|
|
515
|
-
const tmpFilePath = path.join(sampleAppPath,"tmpFile");
|
|
516
|
-
|
|
517
|
-
beforeEach(function(done) {
|
|
518
|
-
common.removeOutDir(outputPath);
|
|
519
|
-
fs.writeFileSync(tmpFilePath, "", 'utf8');
|
|
520
|
-
done();
|
|
521
|
-
});
|
|
522
|
-
|
|
523
|
-
afterEach(function(done) {
|
|
524
|
-
common.removeOutDir(tmpFilePath);
|
|
525
|
-
common.removeOutDir(outputPath);
|
|
526
|
-
done();
|
|
527
|
-
});
|
|
528
|
-
|
|
529
|
-
it('Check the application but do not pacakge', function(done) {
|
|
530
|
-
exec(cmd + ` -e tmpFile ${sampleAppPath} -r -o ${outputPath}`, function(error, stdout, stderr) {
|
|
531
|
-
if (stderr && stderr.length > 0) {
|
|
532
|
-
common.detectNodeMessage(stderr);
|
|
533
|
-
}
|
|
534
|
-
expect(stdout).toContain("Success");
|
|
535
|
-
expect(fs.existsSync(path.join(appPathByRom, "com.webos.sample.app/tmpFile"))).toBe(false);
|
|
536
|
-
done();
|
|
537
|
-
});
|
|
538
|
-
});
|
|
539
|
-
});
|
|
540
|
-
|
|
541
|
-
describe(aresCmd, function() {
|
|
542
|
-
const pkgInfo = {
|
|
543
|
-
"id": "com",
|
|
544
|
-
"version": "2.2.2"
|
|
545
|
-
};
|
|
546
|
-
|
|
547
|
-
beforeAll(function(done) {
|
|
548
|
-
common.createOutDir(sampleResourcePath);
|
|
549
|
-
|
|
550
|
-
const rscInfoDirPath = path.join(sampleResourcePath, "resourceinfo.json"),
|
|
551
|
-
rscInfo = {
|
|
552
|
-
"id": "com.domain.app.resource",
|
|
553
|
-
"bindmountPath": "abcd"
|
|
554
|
-
};
|
|
555
|
-
fs.writeFileSync(rscInfoDirPath, JSON.stringify(rscInfo), 'utf8');
|
|
556
|
-
fs.writeFileSync(pkgInfoPath, JSON.stringify(pkgInfo), 'utf8');
|
|
557
|
-
done();
|
|
558
|
-
});
|
|
559
|
-
|
|
560
|
-
beforeEach(function(done) {
|
|
561
|
-
common.removeOutDir(outputPath);
|
|
562
|
-
done();
|
|
563
|
-
});
|
|
564
|
-
|
|
565
|
-
afterAll(function(done) {
|
|
566
|
-
common.removeOutDir(outputPath);
|
|
567
|
-
common.removeOutDir(pkgInfoPath);
|
|
568
|
-
common.removeOutDir(sampleResourcePath);
|
|
569
|
-
done();
|
|
570
|
-
});
|
|
571
|
-
|
|
572
|
-
it('Package resource with -pi and -o(--outdir)', function(done) {
|
|
573
|
-
const expectedPiPkgPath = path.join(outputPath, "com_1.0.0_all.ipk");
|
|
574
|
-
|
|
575
|
-
exec(cmd + ` ${sampleResourcePath} -pi com -o ${outputPath}`, function(error, stdout, stderr) {
|
|
576
|
-
if (stderr && stderr.length > 0) {
|
|
577
|
-
common.detectNodeMessage(stderr);
|
|
578
|
-
}
|
|
579
|
-
expect(stdout).toContain("Create", error);
|
|
580
|
-
expect(stdout).toContain("Success", error);
|
|
581
|
-
expect(fs.existsSync(expectedPiPkgPath)).toBe(true);
|
|
582
|
-
done();
|
|
583
|
-
});
|
|
584
|
-
});
|
|
585
|
-
|
|
586
|
-
it('Package resource with -pf and -o(--outdir)', function(done) {
|
|
587
|
-
const expectedPfPkgPath = path.join(outputPath, "com_2.2.2_all.ipk");
|
|
588
|
-
|
|
589
|
-
exec(cmd + ` ${sampleResourcePath} -pf ${pkgInfoPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
590
|
-
if (stderr && stderr.length > 0) {
|
|
591
|
-
common.detectNodeMessage(stderr);
|
|
592
|
-
}
|
|
593
|
-
expect(stdout).toContain("Create", error);
|
|
594
|
-
expect(stdout).toContain("Success", error);
|
|
595
|
-
expect(fs.existsSync(expectedPfPkgPath)).toBe(true);
|
|
596
|
-
done();
|
|
597
|
-
});
|
|
598
|
-
});
|
|
599
|
-
|
|
600
|
-
it('Package resource with -pf(App version does not exist in packageinfo.json) and -o(--outdir)', function(done) {
|
|
601
|
-
const expectedPfPkgPath = path.join(outputPath, "com_1.0.0_all.ipk");
|
|
602
|
-
common.removeOutDir(pkgInfoPath);
|
|
603
|
-
delete pkgInfo.version;
|
|
604
|
-
fs.writeFileSync(pkgInfoPath, JSON.stringify(pkgInfo), 'utf8');
|
|
605
|
-
|
|
606
|
-
exec(cmd + ` ${sampleResourcePath} -pf ${pkgInfoPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
607
|
-
if (stderr && stderr.length > 0) {
|
|
608
|
-
common.detectNodeMessage(stderr);
|
|
609
|
-
}
|
|
610
|
-
expect(stdout).toContain("Create", error);
|
|
611
|
-
expect(stdout).toContain("Success", error);
|
|
612
|
-
expect(fs.existsSync(expectedPfPkgPath)).toBe(true);
|
|
613
|
-
done();
|
|
614
|
-
});
|
|
615
|
-
});
|
|
616
|
-
});
|
|
617
|
-
|
|
618
|
-
describe(aresCmd + ' negative TC for app packaging', function() {
|
|
619
|
-
beforeEach(function(done) {
|
|
620
|
-
const appinfo = {
|
|
621
|
-
"version": "1.0.0",
|
|
622
|
-
"vendor": "My Company",
|
|
623
|
-
"type": "web",
|
|
624
|
-
"main": "index.html",
|
|
625
|
-
"title": "new app",
|
|
626
|
-
"icon": "icon.png"
|
|
627
|
-
};
|
|
628
|
-
fs.writeFileSync(appinfoPath, JSON.stringify(appinfo), 'utf8');
|
|
629
|
-
done();
|
|
630
|
-
});
|
|
631
|
-
|
|
632
|
-
it('Check to exist app id', function(done) {
|
|
633
|
-
exec(cmd + ` ${sampleAppPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
634
|
-
if (stderr && stderr.length > 0) {
|
|
635
|
-
common.detectNodeMessage(stderr);
|
|
636
|
-
stderr = stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
637
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: Please input required field <id>", error);
|
|
638
|
-
}
|
|
639
|
-
done();
|
|
640
|
-
});
|
|
641
|
-
});
|
|
642
|
-
});
|
|
643
|
-
|
|
644
|
-
describe(aresCmd + ' negative TC for app packaging', function() {
|
|
645
|
-
beforeEach(function(done) {
|
|
646
|
-
const appinfo = {
|
|
647
|
-
"id": "com.domain.app",
|
|
648
|
-
"version": "1.0.0",
|
|
649
|
-
"vendor": "My Company"
|
|
650
|
-
};
|
|
651
|
-
fs.writeFileSync(appinfoPath, JSON.stringify(appinfo), 'utf8');
|
|
652
|
-
done();
|
|
653
|
-
});
|
|
654
|
-
|
|
655
|
-
it('Check to exist required fields in app meta file', function(done) {
|
|
656
|
-
exec(cmd + ` ${sampleAppPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
657
|
-
if (stderr && stderr.length > 0) {
|
|
658
|
-
common.detectNodeMessage(stderr);
|
|
659
|
-
stderr = stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
660
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: Invalid file <appinfo.json> :");
|
|
661
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: main is required");
|
|
662
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: title is required");
|
|
663
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: icon is required");
|
|
664
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: type is required");
|
|
665
|
-
}
|
|
666
|
-
done();
|
|
667
|
-
});
|
|
668
|
-
});
|
|
669
|
-
});
|
|
670
|
-
|
|
671
|
-
describe(aresCmd + ' negative TC for app packaging', function() {
|
|
672
|
-
beforeEach(function(done) {
|
|
673
|
-
const appinfo = {
|
|
674
|
-
"id": "com.domain.app",
|
|
675
|
-
"version": "1.0.0",
|
|
676
|
-
"vendor": "My Company",
|
|
677
|
-
"type": "invalidType",
|
|
678
|
-
"main": "index.html",
|
|
679
|
-
"title": "new app",
|
|
680
|
-
"icon": "icon.png"
|
|
681
|
-
};
|
|
682
|
-
fs.writeFileSync(appinfoPath, JSON.stringify(appinfo), 'utf8');
|
|
683
|
-
done();
|
|
684
|
-
});
|
|
685
|
-
|
|
686
|
-
it('Check to invalid app type', function(done) {
|
|
687
|
-
exec(cmd + ` ${sampleAppPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
688
|
-
if (stderr && stderr.length > 0) {
|
|
689
|
-
common.detectNodeMessage(stderr);
|
|
690
|
-
stderr = stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
691
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: Invalid file <appinfo.json> :");
|
|
692
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: type is not one of enum values: " +
|
|
693
|
-
"web,stub,native,native_builtin,native_appshell,qml", error);
|
|
694
|
-
}
|
|
695
|
-
done();
|
|
696
|
-
});
|
|
697
|
-
});
|
|
698
|
-
});
|
|
699
|
-
|
|
700
|
-
describe(aresCmd + ' negative TC for app packaging', function() {
|
|
701
|
-
beforeAll(function(done) {
|
|
702
|
-
common.removeOutDir(pkgInfoPath);
|
|
703
|
-
common.createOutDir(pkgDirPath);
|
|
704
|
-
|
|
705
|
-
const pkgDirInfoPath = path.join(pkgDirPath, "packageinfo.json"),
|
|
706
|
-
pkgInfo = {
|
|
707
|
-
"id": "com.test",
|
|
708
|
-
"version": "1.0.0"
|
|
709
|
-
};
|
|
710
|
-
fs.writeFileSync(pkgInfoPath, JSON.stringify(pkgInfo), 'utf8');
|
|
711
|
-
fs.writeFileSync(pkgDirInfoPath, JSON.stringify(pkgInfo), 'utf8');
|
|
712
|
-
done();
|
|
713
|
-
});
|
|
714
|
-
|
|
715
|
-
beforeEach(function(done) {
|
|
716
|
-
common.removeOutDir(outputPath);
|
|
717
|
-
done();
|
|
718
|
-
});
|
|
719
|
-
|
|
720
|
-
afterAll(function(done) {
|
|
721
|
-
common.removeOutDir(outputPath);
|
|
722
|
-
common.removeOutDir(pkgInfoPath);
|
|
723
|
-
common.removeOutDir(pkgDirPath);
|
|
724
|
-
done();
|
|
725
|
-
});
|
|
726
|
-
|
|
727
|
-
it('Check to invalid app id with -pi option', function(done) {
|
|
728
|
-
exec(cmd + ` ${sampleAppPath} -pi com.test -o ${outputPath}`, function(error, stdout, stderr) {
|
|
729
|
-
if (stderr && stderr.length > 0) {
|
|
730
|
-
common.detectNodeMessage(stderr);
|
|
731
|
-
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
732
|
-
expect(stderr).toContain("ares-package ERR! Error: Invalid value <id> : com.domain.app", error);
|
|
733
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: App ID must start with package ID <com.test>", error);
|
|
734
|
-
}
|
|
735
|
-
done();
|
|
736
|
-
});
|
|
737
|
-
});
|
|
738
|
-
|
|
739
|
-
it('Check to invalid app id with -pf option', function(done) {
|
|
740
|
-
exec(cmd + ` ${sampleAppPath} -pf ${pkgInfoPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
741
|
-
if (stderr && stderr.length > 0) {
|
|
742
|
-
common.detectNodeMessage(stderr);
|
|
743
|
-
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
744
|
-
expect(stderr).toContain("ares-package ERR! Error: Invalid value <id> : com.domain.app", error);
|
|
745
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: App ID must start with package ID <com.test>", error);
|
|
746
|
-
}
|
|
747
|
-
done();
|
|
748
|
-
});
|
|
749
|
-
});
|
|
750
|
-
|
|
751
|
-
it('Check to do not support with -pi and -pf options together', function(done) {
|
|
752
|
-
exec(cmd + ` ${sampleAppPath} -pf ${pkgInfoPath} -pi com.webos.sample -o ${outputPath}`, function(error, stdout, stderr) {
|
|
753
|
-
if (stderr && stderr.length > 0) {
|
|
754
|
-
common.detectNodeMessage(stderr);
|
|
755
|
-
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
756
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: Do not use together with options <pkginfofile, pkgid>", error);
|
|
757
|
-
}
|
|
758
|
-
done();
|
|
759
|
-
});
|
|
760
|
-
});
|
|
761
|
-
|
|
762
|
-
it('Check to do not support with pkgdir', function(done) {
|
|
763
|
-
exec(cmd + ` ${sampleAppPath} ${pkgDirPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
764
|
-
if (stderr && stderr.length > 0) {
|
|
765
|
-
common.detectNodeMessage(stderr);
|
|
766
|
-
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
767
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: Cannot package the directory with package directory", error);
|
|
768
|
-
}
|
|
769
|
-
done();
|
|
770
|
-
});
|
|
771
|
-
});
|
|
772
|
-
|
|
773
|
-
it('Check to do not support with pkgdir and -pi options together', function(done) {
|
|
774
|
-
exec(cmd + ` ${sampleAppPath} ${pkgDirPath} -pi com -o ${outputPath}`, function(error, stdout, stderr) {
|
|
775
|
-
if (stderr && stderr.length > 0) {
|
|
776
|
-
common.detectNodeMessage(stderr);
|
|
777
|
-
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
778
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: Cannot package the directory with package directory", error);
|
|
779
|
-
}
|
|
780
|
-
done();
|
|
781
|
-
});
|
|
782
|
-
});
|
|
783
|
-
|
|
784
|
-
it('Check to do not support with pkgdir and -pf options together', function(done) {
|
|
785
|
-
exec(cmd + ` ${sampleAppPath} ${pkgDirPath} -pf ${pkgInfoPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
786
|
-
if (stderr && stderr.length > 0) {
|
|
787
|
-
common.detectNodeMessage(stderr);
|
|
788
|
-
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
789
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: Cannot package the directory with package directory", error);
|
|
790
|
-
}
|
|
791
|
-
done();
|
|
792
|
-
});
|
|
793
|
-
});
|
|
794
|
-
});
|
|
795
|
-
|
|
796
|
-
describe(aresCmd + ' negative TC for services packaging', function() {
|
|
797
|
-
beforeEach(function(done) {
|
|
798
|
-
common.removeOutDir(outputPath);
|
|
799
|
-
done();
|
|
800
|
-
});
|
|
801
|
-
|
|
802
|
-
it('Check to exist pi option', function(done) {
|
|
803
|
-
exec(cmd + ` ${sampleServicePaths[1]} ${sampleServicePaths[2]} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
804
|
-
if (stderr && stderr.length > 0) {
|
|
805
|
-
common.detectNodeMessage(stderr);
|
|
806
|
-
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
807
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: packageId must be provided by using either the '--pkgid' or the '--pkginfofile' option", error);
|
|
808
|
-
}
|
|
809
|
-
done();
|
|
810
|
-
});
|
|
811
|
-
});
|
|
812
|
-
});
|
|
813
|
-
|
|
814
|
-
describe(aresCmd + ' negative TC for services packaging', function() {
|
|
815
|
-
beforeEach(function(done) {
|
|
816
|
-
common.removeOutDir(outputPath);
|
|
817
|
-
|
|
818
|
-
const pkgInfo = {
|
|
819
|
-
"id": "com.webos.sample",
|
|
820
|
-
"version": "1.0.0"
|
|
821
|
-
};
|
|
822
|
-
fs.writeFileSync(pkgInfoPath, JSON.stringify(pkgInfo), 'utf8');
|
|
823
|
-
done();
|
|
824
|
-
});
|
|
825
|
-
|
|
826
|
-
afterEach(function(done) {
|
|
827
|
-
common.removeOutDir(outputPath);
|
|
828
|
-
common.removeOutDir(pkgInfoPath);
|
|
829
|
-
done();
|
|
830
|
-
});
|
|
831
|
-
|
|
832
|
-
it('Check to do not support -pi and -pf options together', function(done) {
|
|
833
|
-
exec(cmd + ` ${sampleServicePaths[1]} ${sampleServicePaths[2]} -pf ${pkgInfoPath} -pi com.webos.sample -o ${outputPath}`, function(error, stdout, stderr) {
|
|
834
|
-
if (stderr && stderr.length > 0) {
|
|
835
|
-
common.detectNodeMessage(stderr);
|
|
836
|
-
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
837
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: Do not use together with options <pkginfofile, pkgid>", error);
|
|
838
|
-
}
|
|
839
|
-
done();
|
|
840
|
-
});
|
|
841
|
-
});
|
|
842
|
-
});
|
|
843
|
-
|
|
844
|
-
describe(aresCmd + ' negative TC for services packaging', function() {
|
|
845
|
-
const tmpPath = path.join(tempDirPath, "pkg.json");
|
|
846
|
-
|
|
847
|
-
beforeEach(function(done) {
|
|
848
|
-
common.removeOutDir(outputPath);
|
|
849
|
-
|
|
850
|
-
const pkginfo = {
|
|
851
|
-
"id": "com.webos.sample",
|
|
852
|
-
"version": "1.0.0"
|
|
853
|
-
};
|
|
854
|
-
fs.writeFileSync(tmpPath, JSON.stringify(pkginfo), 'utf8');
|
|
855
|
-
done();
|
|
856
|
-
});
|
|
857
|
-
|
|
858
|
-
afterEach(function(done) {
|
|
859
|
-
common.removeOutDir(tmpPath);
|
|
860
|
-
done();
|
|
861
|
-
});
|
|
862
|
-
|
|
863
|
-
it('Check to file name of package meta file', function(done) {
|
|
864
|
-
exec(cmd + ` ${sampleServicePaths[1]} ${sampleServicePaths[2]} -pf ${tmpPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
865
|
-
if (stderr && stderr.length > 0) {
|
|
866
|
-
common.detectNodeMessage(stderr);
|
|
867
|
-
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
868
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: Invalid file <packageinfo.json>", error);
|
|
869
|
-
}
|
|
870
|
-
done();
|
|
871
|
-
});
|
|
872
|
-
});
|
|
873
|
-
});
|
|
874
|
-
|
|
875
|
-
describe(aresCmd + ' negative TC for services packaging', function() {
|
|
876
|
-
const tmpPath = path.join(tempDirPath, "pkg.json");
|
|
877
|
-
|
|
878
|
-
beforeEach(function(done) {
|
|
879
|
-
common.removeOutDir(outputPath);
|
|
880
|
-
common.removeOutDir(pkgInfoPath);
|
|
881
|
-
|
|
882
|
-
const pkginfo = {
|
|
883
|
-
"version": "1.0.0"
|
|
884
|
-
};
|
|
885
|
-
fs.writeFileSync(pkgInfoPath, JSON.stringify(pkginfo), 'utf8');
|
|
886
|
-
done();
|
|
887
|
-
});
|
|
888
|
-
|
|
889
|
-
afterEach(function(done) {
|
|
890
|
-
common.removeOutDir(tmpPath);
|
|
891
|
-
done();
|
|
892
|
-
});
|
|
893
|
-
|
|
894
|
-
it('Check to exist id fields in pkg meta file', function(done) {
|
|
895
|
-
exec(cmd + ` ${sampleServicePaths[1]} ${sampleServicePaths[2]} -pf ${pkgInfoPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
896
|
-
if (stderr && stderr.length > 0) {
|
|
897
|
-
common.detectNodeMessage(stderr);
|
|
898
|
-
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
899
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: Please input required field <id>", error);
|
|
900
|
-
}
|
|
901
|
-
done();
|
|
902
|
-
});
|
|
903
|
-
});
|
|
904
|
-
});
|
|
905
|
-
|
|
906
|
-
describe(aresCmd + ' negative TC for services packaging', function() {
|
|
907
|
-
beforeAll(function(done) {
|
|
908
|
-
common.createOutDir(pkgDirPath);
|
|
909
|
-
|
|
910
|
-
const pkgDirInfoPath = path.join(pkgDirPath, "packageinfo.json"),
|
|
911
|
-
pkgInfo = {
|
|
912
|
-
"id": "com.test"
|
|
913
|
-
};
|
|
914
|
-
fs.writeFileSync(pkgInfoPath, JSON.stringify(pkgInfo), 'utf8');
|
|
915
|
-
fs.writeFileSync(pkgDirInfoPath, JSON.stringify(pkgInfo), 'utf8');
|
|
916
|
-
done();
|
|
917
|
-
});
|
|
918
|
-
|
|
919
|
-
beforeEach(function(done) {
|
|
920
|
-
common.removeOutDir(outputPath);
|
|
921
|
-
done();
|
|
922
|
-
});
|
|
923
|
-
|
|
924
|
-
afterAll(function(done) {
|
|
925
|
-
common.removeOutDir(outputPath);
|
|
926
|
-
common.removeOutDir(pkgInfoPath);
|
|
927
|
-
common.removeOutDir(pkgDirPath);
|
|
928
|
-
done();
|
|
929
|
-
});
|
|
930
|
-
|
|
931
|
-
it('Check to invalid service id with -pi option', function(done) {
|
|
932
|
-
exec(cmd + ` ${sampleServicePaths[0]} -pi com.test -o ${outputPath}`, function(error, stdout, stderr) {
|
|
933
|
-
if (stderr && stderr.length > 0) {
|
|
934
|
-
common.detectNodeMessage(stderr);
|
|
935
|
-
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
936
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: ServiceID must start with package id <com.test>", error);
|
|
937
|
-
}
|
|
938
|
-
done();
|
|
939
|
-
});
|
|
940
|
-
});
|
|
941
|
-
|
|
942
|
-
it('Check to invalid service id with -pf option', function(done) {
|
|
943
|
-
exec(cmd + ` ${sampleServicePaths[0]} -pf ${pkgInfoPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
944
|
-
if (stderr && stderr.length > 0) {
|
|
945
|
-
common.detectNodeMessage(stderr);
|
|
946
|
-
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
947
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: ServiceID must start with package id <com.test>", error);
|
|
948
|
-
}
|
|
949
|
-
done();
|
|
950
|
-
});
|
|
951
|
-
});
|
|
952
|
-
|
|
953
|
-
it('Check to do not support with pkgdir', function(done) {
|
|
954
|
-
exec(cmd + ` ${sampleServicePaths[1]} ${pkgDirPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
955
|
-
if (stderr && stderr.length > 0) {
|
|
956
|
-
common.detectNodeMessage(stderr);
|
|
957
|
-
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
958
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: Cannot package the directory with package directory", error);
|
|
959
|
-
}
|
|
960
|
-
done();
|
|
961
|
-
});
|
|
962
|
-
});
|
|
963
|
-
|
|
964
|
-
it('Check to do not support with pkgdir and -pi options together', function(done) {
|
|
965
|
-
exec(cmd + ` ${sampleServicePaths[1]} ${pkgDirPath} -pi com -o ${outputPath}`, function(error, stdout, stderr) {
|
|
966
|
-
if (stderr && stderr.length > 0) {
|
|
967
|
-
common.detectNodeMessage(stderr);
|
|
968
|
-
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
969
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: Cannot package the directory with package directory", error);
|
|
970
|
-
}
|
|
971
|
-
done();
|
|
972
|
-
});
|
|
973
|
-
});
|
|
974
|
-
|
|
975
|
-
it('Check to do not support with pkgdir and -pf options together', function(done) {
|
|
976
|
-
exec(cmd + ` ${sampleServicePaths[1]} ${pkgDirPath} -pf ${pkgInfoPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
977
|
-
if (stderr && stderr.length > 0) {
|
|
978
|
-
common.detectNodeMessage(stderr);
|
|
979
|
-
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
980
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: Cannot package the directory with package directory", error);
|
|
981
|
-
}
|
|
982
|
-
done();
|
|
983
|
-
});
|
|
984
|
-
});
|
|
985
|
-
});
|
|
986
|
-
|
|
987
|
-
describe(aresCmd + ' negative TC for resource packaging', function() {
|
|
988
|
-
const pkgInfo = {
|
|
989
|
-
"id": "com.test",
|
|
990
|
-
"version": "2.2.2"
|
|
991
|
-
};
|
|
992
|
-
|
|
993
|
-
beforeAll(function(done) {
|
|
994
|
-
common.removeOutDir(pkgInfoPath);
|
|
995
|
-
common.createOutDir(pkgDirPath);
|
|
996
|
-
common.createOutDir(sampleResourcePath);
|
|
997
|
-
|
|
998
|
-
const pkgDirInfoPath = path.join(pkgDirPath, "packageinfo.json"),
|
|
999
|
-
rscInfoDirPath = path.join(sampleResourcePath, "resourceinfo.json"),
|
|
1000
|
-
pkgDirInfo = {
|
|
1001
|
-
"id": "com.domain"
|
|
1002
|
-
},
|
|
1003
|
-
rscInfo = {
|
|
1004
|
-
"id": "com.domain.app.resource",
|
|
1005
|
-
"bindmountPath": "abcd"
|
|
1006
|
-
};
|
|
1007
|
-
fs.writeFileSync(pkgInfoPath, JSON.stringify(pkgInfo), 'utf8');
|
|
1008
|
-
fs.writeFileSync(pkgDirInfoPath, JSON.stringify(pkgDirInfo), 'utf8');
|
|
1009
|
-
fs.writeFileSync(rscInfoDirPath, JSON.stringify(rscInfo), 'utf8');
|
|
1010
|
-
done();
|
|
1011
|
-
});
|
|
1012
|
-
|
|
1013
|
-
beforeEach(function(done) {
|
|
1014
|
-
common.removeOutDir(outputPath);
|
|
1015
|
-
done();
|
|
1016
|
-
});
|
|
1017
|
-
|
|
1018
|
-
afterAll(function(done) {
|
|
1019
|
-
common.removeOutDir(outputPath);
|
|
1020
|
-
common.removeOutDir(pkgInfoPath);
|
|
1021
|
-
common.removeOutDir(pkgDirPath);
|
|
1022
|
-
common.removeOutDir(sampleResourcePath);
|
|
1023
|
-
done();
|
|
1024
|
-
});
|
|
1025
|
-
|
|
1026
|
-
it('Check to exist pi option', function(done) {
|
|
1027
|
-
exec(cmd + ` ${sampleResourcePath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
1028
|
-
if (stderr && stderr.length > 0) {
|
|
1029
|
-
common.detectNodeMessage(stderr);
|
|
1030
|
-
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
1031
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: packageId must be provided by using either the '--pkgid' or the '--pkginfofile' option", error);
|
|
1032
|
-
}
|
|
1033
|
-
done();
|
|
1034
|
-
});
|
|
1035
|
-
});
|
|
1036
|
-
|
|
1037
|
-
it('Check to invalid resource id with -pi option', function(done) {
|
|
1038
|
-
exec(cmd + ` ${sampleResourcePath} -pi com.test -o ${outputPath}`, function(error, stdout, stderr) {
|
|
1039
|
-
if (stderr && stderr.length > 0) {
|
|
1040
|
-
common.detectNodeMessage(stderr);
|
|
1041
|
-
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
1042
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: Resource ID must start with package ID <com.test>", error);
|
|
1043
|
-
}
|
|
1044
|
-
done();
|
|
1045
|
-
});
|
|
1046
|
-
});
|
|
1047
|
-
|
|
1048
|
-
it('Check to invalid resource id with -pf option', function(done) {
|
|
1049
|
-
exec(cmd + ` ${sampleResourcePath} -pf ${pkgInfoPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
1050
|
-
if (stderr && stderr.length > 0) {
|
|
1051
|
-
common.detectNodeMessage(stderr);
|
|
1052
|
-
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
1053
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: Resource ID must start with package ID <com.test>", error);
|
|
1054
|
-
}
|
|
1055
|
-
done();
|
|
1056
|
-
});
|
|
1057
|
-
});
|
|
1058
|
-
|
|
1059
|
-
it('Check to do not support with -pi and -pf options together', function(done) {
|
|
1060
|
-
exec(cmd + ` ${sampleResourcePath} -pi com -pf ${pkgInfoPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
1061
|
-
if (stderr && stderr.length > 0) {
|
|
1062
|
-
common.detectNodeMessage(stderr);
|
|
1063
|
-
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
1064
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: Do not use together with options <pkginfofile, pkgid>", error);
|
|
1065
|
-
}
|
|
1066
|
-
done();
|
|
1067
|
-
});
|
|
1068
|
-
});
|
|
1069
|
-
|
|
1070
|
-
it('Check to do not support with pkgdir', function(done) {
|
|
1071
|
-
exec(cmd + ` ${sampleResourcePath} ${pkgDirPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
1072
|
-
if (stderr && stderr.length > 0) {
|
|
1073
|
-
common.detectNodeMessage(stderr);
|
|
1074
|
-
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
1075
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: Cannot package the directory with package directory", error);
|
|
1076
|
-
}
|
|
1077
|
-
done();
|
|
1078
|
-
});
|
|
1079
|
-
});
|
|
1080
|
-
|
|
1081
|
-
it('Check to do not support with pkgdir and -pi options together', function(done) {
|
|
1082
|
-
exec(cmd + ` ${sampleResourcePath} ${pkgDirPath} -pi com -o ${outputPath}`, function(error, stdout, stderr) {
|
|
1083
|
-
if (stderr && stderr.length > 0) {
|
|
1084
|
-
common.detectNodeMessage(stderr);
|
|
1085
|
-
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
1086
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: Cannot package the directory with package directory", error);
|
|
1087
|
-
}
|
|
1088
|
-
done();
|
|
1089
|
-
});
|
|
1090
|
-
});
|
|
1091
|
-
|
|
1092
|
-
it('Check to do not support with pkgdir and -pf options together', function(done) {
|
|
1093
|
-
exec(cmd + ` ${sampleResourcePath} ${pkgDirPath} -pf ${pkgInfoPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
1094
|
-
if (stderr && stderr.length > 0) {
|
|
1095
|
-
common.detectNodeMessage(stderr);
|
|
1096
|
-
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
1097
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: Cannot package the directory with package directory", error);
|
|
1098
|
-
}
|
|
1099
|
-
done();
|
|
1100
|
-
});
|
|
1101
|
-
});
|
|
1102
|
-
|
|
1103
|
-
it('Check to cannot package with app', function(done) {
|
|
1104
|
-
exec(cmd + ` ${sampleAppPath} ${sampleResourcePath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
1105
|
-
if (stderr && stderr.length > 0) {
|
|
1106
|
-
common.detectNodeMessage(stderr);
|
|
1107
|
-
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
1108
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: Cannot package the app or service directory with resource directory", error);
|
|
1109
|
-
}
|
|
1110
|
-
done();
|
|
1111
|
-
});
|
|
1112
|
-
});
|
|
1113
|
-
|
|
1114
|
-
it('Check to cannot package with service', function(done) {
|
|
1115
|
-
exec(cmd + ` ${sampleServicePaths[0]} ${sampleResourcePath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
1116
|
-
if (stderr && stderr.length > 0) {
|
|
1117
|
-
common.detectNodeMessage(stderr);
|
|
1118
|
-
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
1119
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: Cannot package the app or service directory with resource directory", error);
|
|
1120
|
-
}
|
|
1121
|
-
done();
|
|
1122
|
-
});
|
|
1123
|
-
});
|
|
1124
|
-
|
|
1125
|
-
it('Check to cannot package with app and service', function(done) {
|
|
1126
|
-
exec(cmd + ` ${sampleAppPath} ${sampleServicePaths[0]} ${sampleResourcePath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
1127
|
-
if (stderr && stderr.length > 0) {
|
|
1128
|
-
common.detectNodeMessage(stderr);
|
|
1129
|
-
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
1130
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: Cannot package the app or service directory with resource directory", error);
|
|
1131
|
-
}
|
|
1132
|
-
done();
|
|
1133
|
-
});
|
|
1134
|
-
});
|
|
1135
|
-
|
|
1136
|
-
it('Check to exist id fields in pkg meta file', function(done) {
|
|
1137
|
-
common.removeOutDir(pkgInfoPath);
|
|
1138
|
-
delete pkgInfo.id;
|
|
1139
|
-
fs.writeFileSync(pkgInfoPath, JSON.stringify(pkgInfo), 'utf8');
|
|
1140
|
-
|
|
1141
|
-
exec(cmd + ` ${sampleResourcePath} -pf ${pkgInfoPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
1142
|
-
if (stderr && stderr.length > 0) {
|
|
1143
|
-
common.detectNodeMessage(stderr);
|
|
1144
|
-
stderr = stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
1145
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: Please input required field <id>", error);
|
|
1146
|
-
}
|
|
1147
|
-
done();
|
|
1148
|
-
});
|
|
1149
|
-
});
|
|
1150
|
-
});
|
|
1151
|
-
|
|
1152
|
-
describe(aresCmd + " info/info-detail options", function() {
|
|
1153
|
-
it('Info of web app and service package', function(done) {
|
|
1154
|
-
const webIpk = path.join(ipkBasePath, "com.web.app_1.0.0_all.ipk");
|
|
1155
|
-
|
|
1156
|
-
exec(cmd + ` -I ${webIpk}`, function(error, stdout, stderr) {
|
|
1157
|
-
if (stderr && stderr.length > 0) {
|
|
1158
|
-
common.detectNodeMessage(stderr);
|
|
1159
|
-
}
|
|
1160
|
-
expect(stdout).toContain("< packageinfo.json >");
|
|
1161
|
-
expect(stdout).toContain("< appinfo.json >");
|
|
1162
|
-
expect(stdout).toContain("< services.json >");
|
|
1163
|
-
expect(stdout).toContain("< package.json >");
|
|
1164
|
-
done();
|
|
1165
|
-
});
|
|
1166
|
-
});
|
|
1167
|
-
|
|
1168
|
-
it('Info of external native app and service package', function(done) {
|
|
1169
|
-
const externalAppIpk = path.join(ipkBasePath, "com.sample.echo_0.0.1_all.ipk");
|
|
1170
|
-
|
|
1171
|
-
exec(cmd + ` -i ${externalAppIpk}`, function(error, stdout, stderr) {
|
|
1172
|
-
if (stderr && stderr.length > 0) {
|
|
1173
|
-
common.detectNodeMessage(stderr);
|
|
1174
|
-
}
|
|
1175
|
-
expect(stdout).toContain("< Package Information >");
|
|
1176
|
-
expect(stdout).toContain("< Application Information >");
|
|
1177
|
-
expect(stdout).toContain("< Service Information >");
|
|
1178
|
-
done();
|
|
1179
|
-
});
|
|
1180
|
-
});
|
|
1181
|
-
|
|
1182
|
-
it('nagetive TC for not support file extension', function(done) {
|
|
1183
|
-
exec(cmd + ` -i aaa`, function(error, stdout, stderr) {
|
|
1184
|
-
if (stderr && stderr.length > 0) {
|
|
1185
|
-
common.detectNodeMessage(stderr);
|
|
1186
|
-
}
|
|
1187
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: Only .ipk file is supported. Please check the file extension <aaa>");
|
|
1188
|
-
done();
|
|
1189
|
-
});
|
|
1190
|
-
});
|
|
1191
|
-
|
|
1192
|
-
it('nagetive TC for not exist ipk file', function(done) {
|
|
1193
|
-
exec(cmd + ` -i aaa.ipk`, function(error, stdout, stderr) {
|
|
1194
|
-
if (stderr && stderr.length > 0) {
|
|
1195
|
-
common.detectNodeMessage(stderr);
|
|
1196
|
-
}
|
|
1197
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: The specified path does not exist <aaa.ipk>");
|
|
1198
|
-
done();
|
|
1199
|
-
});
|
|
1200
|
-
});
|
|
1201
|
-
|
|
1202
|
-
it('nagetive TC for not exist parameter', function(done) {
|
|
1203
|
-
exec(cmd + ` -i`, function(error, stdout, stderr) {
|
|
1204
|
-
if (stderr && stderr.length > 0) {
|
|
1205
|
-
common.detectNodeMessage(stderr);
|
|
1206
|
-
}
|
|
1207
|
-
expect(stderr).toContain("ares-package ERR! [Tips]: Please specify a value <info>");
|
|
1208
|
-
done();
|
|
1209
|
-
});
|
|
1210
|
-
});
|
|
1211
|
-
});
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2020-2024 LG Electronics Inc.
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const path = require('path'),
|
|
8
|
+
fs = require('fs'),
|
|
9
|
+
exec = require('child_process').exec,
|
|
10
|
+
common = require('./common-spec');
|
|
11
|
+
|
|
12
|
+
const tempDirPath = path.join(__dirname, "..", "tempFiles"),
|
|
13
|
+
sampleAppPath = path.join(tempDirPath, "sampleApp"),
|
|
14
|
+
sampleServicePath = path.join(tempDirPath, "sampleService"),
|
|
15
|
+
sampleResourcePath = path.join(tempDirPath, "sampleResource"),
|
|
16
|
+
nativeDirPath = path.join(tempDirPath, "nativeApp"),
|
|
17
|
+
pkgInfoPath = path.join(tempDirPath, "packageinfo.json"),
|
|
18
|
+
outputPath = path.join(tempDirPath, "output"),
|
|
19
|
+
appPathByRom = path.join(outputPath, "usr/palm/applications"),
|
|
20
|
+
appPkgPath = path.join(outputPath, "com.webos.sample.app_1.0.0_all.ipk"),
|
|
21
|
+
svcPkgPath = path.join(outputPath, "com.webos.sample_1.0.0_all.ipk"),
|
|
22
|
+
appinfoPath = path.join(sampleAppPath, "appinfo.json"),
|
|
23
|
+
signKeyPath = path.join(tempDirPath, "sign/signPriv.key"),
|
|
24
|
+
crtPath = path.join(tempDirPath,"sign/sign.crt"),
|
|
25
|
+
ipkBasePath = path.join(tempDirPath, "ipks"),
|
|
26
|
+
pkgDirPath = path.join(tempDirPath, "pkgDir");
|
|
27
|
+
|
|
28
|
+
const aresCmd = 'ares-package',
|
|
29
|
+
sampleServicePaths = [];
|
|
30
|
+
|
|
31
|
+
let cmd,
|
|
32
|
+
expectedTemplate;
|
|
33
|
+
|
|
34
|
+
beforeAll(function(done) {
|
|
35
|
+
cmd = common.makeCmd(aresCmd);
|
|
36
|
+
common.getExpectedResult("ares-generate")
|
|
37
|
+
.then(function(result) {
|
|
38
|
+
expectedTemplate = result.template;
|
|
39
|
+
done();
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
afterAll(function(done) {
|
|
44
|
+
common.removeOutDir(sampleAppPath); // can be in afterAll
|
|
45
|
+
common.removeOutDir(sampleServicePath); // can be in afterAll
|
|
46
|
+
common.removeOutDir(pkgInfoPath);
|
|
47
|
+
common.removeOutDir(pkgDirPath);
|
|
48
|
+
done();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
describe(aresCmd + ' -v', function() {
|
|
52
|
+
it('Print help message with verbose log', function(done) {
|
|
53
|
+
exec(cmd + ' -v', function(error, stdout, stderr) {
|
|
54
|
+
if (stderr && stderr.length > 0) {
|
|
55
|
+
common.detectNodeMessage(stderr);
|
|
56
|
+
expect(stderr).toContain("verb argv");
|
|
57
|
+
}
|
|
58
|
+
expect(stdout).toContain("SYNOPSIS");
|
|
59
|
+
expect(error).toBeNull();
|
|
60
|
+
done();
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
describe(aresCmd, function() {
|
|
66
|
+
beforeEach(function(done) {
|
|
67
|
+
common.removeOutDir(sampleAppPath);
|
|
68
|
+
done();
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('Generate a sample app for packaging', function(done) {
|
|
72
|
+
const generateCmd = common.makeCmd('ares-generate');
|
|
73
|
+
exec(generateCmd + ` -t ${expectedTemplate.webapp} -p "id=com.webos.sample.app" -p "version=1.0.0" ${sampleAppPath}`, function(error, stdout, stderr) {
|
|
74
|
+
if (stderr && stderr.length > 0) {
|
|
75
|
+
common.detectNodeMessage(stderr);
|
|
76
|
+
}
|
|
77
|
+
expect(stdout).toContain("Generating");
|
|
78
|
+
expect(error).toBeNull();
|
|
79
|
+
done();
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
describe(aresCmd, function() {
|
|
85
|
+
beforeEach(function(done) {
|
|
86
|
+
common.removeOutDir(sampleServicePath);
|
|
87
|
+
done();
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('Generate two sample services for packaging', function(done) {
|
|
91
|
+
const serviceid = ["com.webos.sample.app.service", "com.webos.sample.service1", "com.webos.sample.service2"];
|
|
92
|
+
serviceid.forEach(function(svcId) {
|
|
93
|
+
const svcPath = path.join(sampleServicePath, svcId);
|
|
94
|
+
sampleServicePaths.push(path.join(sampleServicePath, svcId));
|
|
95
|
+
const generateCmd = common.makeCmd('ares-generate');
|
|
96
|
+
exec(generateCmd + ` -t ${expectedTemplate.jsservice} -s ${svcId} ${svcPath}`, function(error, stdout, stderr) {
|
|
97
|
+
if (stderr && stderr.length > 0) {
|
|
98
|
+
common.detectNodeMessage(stderr);
|
|
99
|
+
}
|
|
100
|
+
expect(stdout).toContain("Generating");
|
|
101
|
+
done();
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
describe(aresCmd, function() {
|
|
108
|
+
beforeEach(function(done) {
|
|
109
|
+
common.removeOutDir(outputPath);
|
|
110
|
+
done();
|
|
111
|
+
});
|
|
112
|
+
afterEach(function(done) {
|
|
113
|
+
common.removeOutDir(outputPath);
|
|
114
|
+
done();
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('Package web app with -o(--outdir)', function(done) {
|
|
118
|
+
exec(cmd + ` ${sampleAppPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
119
|
+
if (stderr && stderr.length > 0) {
|
|
120
|
+
common.detectNodeMessage(stderr);
|
|
121
|
+
}
|
|
122
|
+
expect(stdout).toContain("Create", error);
|
|
123
|
+
expect(stdout).toContain("Success", error);
|
|
124
|
+
expect(fs.existsSync(appPkgPath)).toBe(true);
|
|
125
|
+
done();
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
describe(aresCmd, function() {
|
|
131
|
+
beforeEach(function(done) {
|
|
132
|
+
common.removeOutDir(outputPath);
|
|
133
|
+
done();
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
it('Package web app & service with -o(--outdir)', function(done) {
|
|
137
|
+
exec(cmd + ` ${sampleAppPath} ${sampleServicePaths[0]} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
138
|
+
if (stderr && stderr.length > 0) {
|
|
139
|
+
common.detectNodeMessage(stderr);
|
|
140
|
+
}
|
|
141
|
+
expect(stdout).toContain(outputPath);
|
|
142
|
+
expect(stdout).toContain("Success", error);
|
|
143
|
+
expect(fs.existsSync(appPkgPath)).toBe(true);
|
|
144
|
+
done();
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
describe(aresCmd, function() {
|
|
150
|
+
beforeEach(function(done) {
|
|
151
|
+
common.removeOutDir(outputPath);
|
|
152
|
+
|
|
153
|
+
const appinfo = {
|
|
154
|
+
"id": "com.webos.sample.app",
|
|
155
|
+
"vendor": "My Company",
|
|
156
|
+
"type": "web",
|
|
157
|
+
"main": "index.html",
|
|
158
|
+
"title": "new app",
|
|
159
|
+
"icon": "icon.png"
|
|
160
|
+
};
|
|
161
|
+
fs.writeFileSync(appinfoPath, JSON.stringify(appinfo), 'utf8');
|
|
162
|
+
done();
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
it('App version does not exist', function(done) {
|
|
166
|
+
exec(cmd + ` ${sampleAppPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
167
|
+
if (stderr && stderr.length > 0) {
|
|
168
|
+
common.detectNodeMessage(stderr);
|
|
169
|
+
}
|
|
170
|
+
expect(stdout).toContain("Create", error);
|
|
171
|
+
expect(stdout).toContain("Success", error);
|
|
172
|
+
expect(fs.existsSync(appPkgPath)).toBe(true);
|
|
173
|
+
done();
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
describe(aresCmd, function() {
|
|
179
|
+
const expectedFilePath = path.join(outputPath, "com.webos.sample_1.0.0_all.ipk");
|
|
180
|
+
beforeAll(function(done) {
|
|
181
|
+
common.removeOutDir(pkgInfoPath);
|
|
182
|
+
const pkgInfo = {
|
|
183
|
+
"id": "com.webos.sample",
|
|
184
|
+
"version": "1.0.0"
|
|
185
|
+
};
|
|
186
|
+
fs.writeFileSync(pkgInfoPath, JSON.stringify(pkgInfo), 'utf8');
|
|
187
|
+
done();
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
beforeEach(function(done) {
|
|
191
|
+
common.removeOutDir(outputPath);
|
|
192
|
+
done();
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
afterAll(function(done) {
|
|
196
|
+
common.removeOutDir(outputPath);
|
|
197
|
+
common.removeOutDir(pkgInfoPath);
|
|
198
|
+
done();
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
it('Package web app with -pi option', function(done) {
|
|
202
|
+
exec(cmd + ` ${sampleAppPath} -pi com.webos.sample -o ${outputPath}`, function(error, stdout, stderr) {
|
|
203
|
+
if (stderr && stderr.length > 0) {
|
|
204
|
+
common.detectNodeMessage(stderr);
|
|
205
|
+
}
|
|
206
|
+
expect(stdout).toContain("Create", error);
|
|
207
|
+
expect(stdout).toContain("Success", error);
|
|
208
|
+
expect(fs.existsSync(expectedFilePath)).toBe(true);
|
|
209
|
+
done();
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
it('Package web app with -pf option', function(done) {
|
|
214
|
+
exec(cmd + ` ${sampleAppPath} -pf ${pkgInfoPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
215
|
+
if (stderr && stderr.length > 0) {
|
|
216
|
+
common.detectNodeMessage(stderr);
|
|
217
|
+
}
|
|
218
|
+
expect(stdout).toContain("Create", error);
|
|
219
|
+
expect(stdout).toContain("Success", error);
|
|
220
|
+
expect(fs.existsSync(expectedFilePath)).toBe(true);
|
|
221
|
+
done();
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
describe(aresCmd + ' --pkginfofile(-pf)', function() {
|
|
227
|
+
const pkgPath = path.join(outputPath, "com_1.0.0_all.ipk");
|
|
228
|
+
beforeAll(function(done) {
|
|
229
|
+
common.removeOutDir(pkgInfoPath);
|
|
230
|
+
common.removeOutDir(outputPath);
|
|
231
|
+
const pkginfo = {
|
|
232
|
+
"id":"com",
|
|
233
|
+
"version":"1.0.0"
|
|
234
|
+
};
|
|
235
|
+
fs.writeFileSync(pkgInfoPath, JSON.stringify(pkginfo), 'utf8');
|
|
236
|
+
done();
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
afterAll(function(done) {
|
|
240
|
+
common.removeOutDir(pkgInfoPath);
|
|
241
|
+
common.removeOutDir(outputPath);
|
|
242
|
+
done();
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
it('Package web app by packageinfo.json and -o(--outdir)', function(done) {
|
|
246
|
+
exec(cmd + ` ${sampleAppPath} -pf ${pkgInfoPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
247
|
+
if (stderr && stderr.length > 0) {
|
|
248
|
+
common.detectNodeMessage(stderr);
|
|
249
|
+
}
|
|
250
|
+
expect(stdout).toContain(outputPath);
|
|
251
|
+
expect(stdout).toContain("Success", error);
|
|
252
|
+
expect(fs.existsSync(pkgPath)).toBe(true);
|
|
253
|
+
done();
|
|
254
|
+
});
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
it('Check to exist app field in packageinfo.json', function(done) {
|
|
258
|
+
exec(cmd + ` -I ${pkgPath}`, function(error, stdout, stderr) {
|
|
259
|
+
if (stderr && stderr.length > 0) {
|
|
260
|
+
common.detectNodeMessage(stderr);
|
|
261
|
+
}
|
|
262
|
+
expect(stdout).toContain('"app": "com.webos.sample.app"');
|
|
263
|
+
done();
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
describe(aresCmd, function() {
|
|
269
|
+
beforeEach(function(done) {
|
|
270
|
+
common.removeOutDir(outputPath);
|
|
271
|
+
done();
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
it('Package ose native app with -o(--outdir)', function(done) {
|
|
275
|
+
const nativeAppPath = path.join(nativeDirPath, "ose/pkg_arm");
|
|
276
|
+
const expectIpkName = "com.ose.target.native_1.0.0_arm.ipk";
|
|
277
|
+
const expectIpkPath = path.join(outputPath, expectIpkName);
|
|
278
|
+
|
|
279
|
+
exec(cmd + ` ${nativeAppPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
280
|
+
if (stderr && stderr.length > 0) {
|
|
281
|
+
common.detectNodeMessage(stderr);
|
|
282
|
+
}
|
|
283
|
+
expect(stdout).toContain("Create", error);
|
|
284
|
+
expect(stdout).toContain("Success", error);
|
|
285
|
+
expect(stdout).toContain(expectIpkName, error);
|
|
286
|
+
expect(fs.existsSync(expectIpkPath)).toBe(true, error);
|
|
287
|
+
done();
|
|
288
|
+
});
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
// emulator
|
|
292
|
+
it('Package ose emulator native app with -o(--outdir)', function(done) {
|
|
293
|
+
const nativeAppPath = path.join(nativeDirPath, "oseEmul/pkg_x86");
|
|
294
|
+
const expectIpkName = "com.ose.emul.native_1.0.0_x86.ipk";
|
|
295
|
+
const expectIpkPath = path.join(outputPath, expectIpkName);
|
|
296
|
+
|
|
297
|
+
exec(cmd + ` ${nativeAppPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
298
|
+
if (stderr && stderr.length > 0) {
|
|
299
|
+
common.detectNodeMessage(stderr);
|
|
300
|
+
}
|
|
301
|
+
expect(stdout).toContain("Create", error);
|
|
302
|
+
expect(stdout).toContain("Success", error);
|
|
303
|
+
expect(stdout).toContain(expectIpkName, error);
|
|
304
|
+
expect(fs.existsSync(expectIpkPath)).toBe(true, error);
|
|
305
|
+
done();
|
|
306
|
+
});
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
// arm64 target
|
|
310
|
+
it('Package auto native app with -o(--outdir)', function(done) {
|
|
311
|
+
const nativeAppPath = path.join(nativeDirPath, "auto/pkg_arm64");
|
|
312
|
+
const expectIpkName = "com.sample.gles2_1.0.0_aarch64.ipk";
|
|
313
|
+
const expectIpkPath = path.join(outputPath, expectIpkName);
|
|
314
|
+
|
|
315
|
+
exec(cmd + ` ${nativeAppPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
316
|
+
if (stderr && stderr.length > 0) {
|
|
317
|
+
common.detectNodeMessage(stderr);
|
|
318
|
+
}
|
|
319
|
+
expect(stdout).toContain("Create", error);
|
|
320
|
+
expect(stdout).toContain("Success", error);
|
|
321
|
+
expect(stdout).toContain(expectIpkName, error);
|
|
322
|
+
expect(fs.existsSync(expectIpkPath)).toBe(true, error);
|
|
323
|
+
done();
|
|
324
|
+
});
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
// rsi target
|
|
328
|
+
it('Package rsi native app with -o(--outdir)', function(done) {
|
|
329
|
+
const nativeAppPath = path.join(nativeDirPath, "rsi/pkg_x86");
|
|
330
|
+
const expectIpkName = "com.sample.gles2_1.0.0_x86_64.ipk";
|
|
331
|
+
const expectIpkPath = path.join(outputPath, expectIpkName);
|
|
332
|
+
|
|
333
|
+
exec(cmd + ` ${nativeAppPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
334
|
+
if (stderr && stderr.length > 0) {
|
|
335
|
+
common.detectNodeMessage(stderr);
|
|
336
|
+
}
|
|
337
|
+
expect(stdout).toContain("Create", error);
|
|
338
|
+
expect(stdout).toContain("Success", error);
|
|
339
|
+
expect(stdout).toContain(expectIpkName, error);
|
|
340
|
+
expect(fs.existsSync(expectIpkPath)).toBe(true, error);
|
|
341
|
+
done();
|
|
342
|
+
});
|
|
343
|
+
});
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
describe(aresCmd, function() {
|
|
347
|
+
beforeAll(function(done) {
|
|
348
|
+
common.removeOutDir(pkgInfoPath);
|
|
349
|
+
|
|
350
|
+
const pkginfo = {
|
|
351
|
+
"id": "com.webos.sample",
|
|
352
|
+
"version": "1.0.0"
|
|
353
|
+
};
|
|
354
|
+
fs.writeFileSync(pkgInfoPath, JSON.stringify(pkginfo), 'utf8');
|
|
355
|
+
done();
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
beforeEach(function(done) {
|
|
359
|
+
common.removeOutDir(outputPath);
|
|
360
|
+
done();
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
afterAll(function(done) {
|
|
364
|
+
common.removeOutDir(outputPath);
|
|
365
|
+
common.removeOutDir(pkgInfoPath);
|
|
366
|
+
done();
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
it('Package only service with -pi and -o(--outdir)', function(done) {
|
|
370
|
+
exec(cmd + ` ${sampleServicePaths[1]} ${sampleServicePaths[2]} -pi com.webos.sample -o ${outputPath}`, function(error, stdout, stderr) {
|
|
371
|
+
if (stderr && stderr.length > 0) {
|
|
372
|
+
common.detectNodeMessage(stderr);
|
|
373
|
+
}
|
|
374
|
+
expect(stdout).toContain(outputPath);
|
|
375
|
+
expect(stdout).toContain("Success", error);
|
|
376
|
+
expect(fs.existsSync(svcPkgPath)).toBe(true);
|
|
377
|
+
done();
|
|
378
|
+
});
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
it('Package only service with -pf and -o(--outdir)', function(done) {
|
|
382
|
+
exec(cmd + ` ${sampleServicePaths[1]} ${sampleServicePaths[2]} -pf ${pkgInfoPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
383
|
+
if (stderr && stderr.length > 0) {
|
|
384
|
+
common.detectNodeMessage(stderr);
|
|
385
|
+
}
|
|
386
|
+
expect(stdout).toContain(outputPath);
|
|
387
|
+
expect(stdout).toContain("Success", error);
|
|
388
|
+
expect(fs.existsSync(svcPkgPath)).toBe(true);
|
|
389
|
+
done();
|
|
390
|
+
});
|
|
391
|
+
});
|
|
392
|
+
|
|
393
|
+
it('Package service with -pf and -pv', function(done) {
|
|
394
|
+
const expectedTmpFile = path.join(outputPath,"com.webos.sample_1.1.1_all.ipk");
|
|
395
|
+
exec(cmd + ` ${sampleServicePaths[0]} -pf ${pkgInfoPath} -pv 1.1.1 -o ${outputPath}`, function(error, stdout, stderr) {
|
|
396
|
+
if (stderr && stderr.length > 0) {
|
|
397
|
+
common.detectNodeMessage(stderr);
|
|
398
|
+
}
|
|
399
|
+
expect(stdout).toContain(outputPath);
|
|
400
|
+
expect(stdout).toContain("Success", error);
|
|
401
|
+
expect(fs.existsSync(expectedTmpFile)).toBe(true);
|
|
402
|
+
done();
|
|
403
|
+
});
|
|
404
|
+
});
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
describe(aresCmd + ' --check(-c)', function() {
|
|
408
|
+
it('Check the application but do not pacakge', function(done) {
|
|
409
|
+
exec(cmd + ` -c ${sampleAppPath} ${sampleServicePaths[0]}`, function(error, stdout, stderr) {
|
|
410
|
+
if (stderr && stderr.length > 0) {
|
|
411
|
+
common.detectNodeMessage(stderr);
|
|
412
|
+
}
|
|
413
|
+
expect(stdout).toContain("no problems detected");
|
|
414
|
+
done();
|
|
415
|
+
});
|
|
416
|
+
});
|
|
417
|
+
it('Check the services but do not pacakge', function(done) {
|
|
418
|
+
exec(cmd + ` -c ${sampleServicePaths[1]} ${sampleServicePaths[2]} -pi com.webos.sample`, function(error, stdout, stderr) {
|
|
419
|
+
if (stderr && stderr.length > 0) {
|
|
420
|
+
common.detectNodeMessage(stderr);
|
|
421
|
+
}
|
|
422
|
+
expect(stdout).toContain("no problems detected");
|
|
423
|
+
done();
|
|
424
|
+
});
|
|
425
|
+
});
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
describe(aresCmd + ' --rom(-r)', function() {
|
|
429
|
+
beforeEach(function(done) {
|
|
430
|
+
common.removeOutDir(outputPath);
|
|
431
|
+
done();
|
|
432
|
+
});
|
|
433
|
+
|
|
434
|
+
afterEach(function(done) {
|
|
435
|
+
common.removeOutDir(outputPath);
|
|
436
|
+
done();
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
it('Create output a directory structure with app', function(done) {
|
|
440
|
+
exec(cmd + ` -r ${sampleAppPath} ${sampleServicePaths[0]} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
441
|
+
if (stderr && stderr.length > 0) {
|
|
442
|
+
common.detectNodeMessage(stderr);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
const createdSvcPath = path.join(outputPath, 'usr/palm/services');
|
|
446
|
+
expect(stdout).toContain('Create output directory');
|
|
447
|
+
expect(fs.existsSync(appPathByRom)).toBe(true);
|
|
448
|
+
expect(fs.existsSync(createdSvcPath)).toBe(true);
|
|
449
|
+
done();
|
|
450
|
+
});
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
it('Create output a directory structure without app', function(done) {
|
|
454
|
+
exec(cmd + ` -r ${sampleServicePaths[1]} ${sampleServicePaths[2]} -pi com.webos.sample -o ${outputPath}`, function(error, stdout, stderr) {
|
|
455
|
+
if (stderr && stderr.length > 0) {
|
|
456
|
+
common.detectNodeMessage(stderr);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
const createdSvcPath = path.join(outputPath, 'usr/palm/services');
|
|
460
|
+
expect(stdout).toContain('Create output directory');
|
|
461
|
+
expect(fs.existsSync(createdSvcPath)).toBe(true);
|
|
462
|
+
done();
|
|
463
|
+
});
|
|
464
|
+
});
|
|
465
|
+
});
|
|
466
|
+
|
|
467
|
+
describe(aresCmd + ' --encrypt(-enc)', function() {
|
|
468
|
+
beforeEach(function(done) {
|
|
469
|
+
common.removeOutDir(outputPath);
|
|
470
|
+
done();
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
afterEach(function(done) {
|
|
474
|
+
common.removeOutDir(outputPath);
|
|
475
|
+
done();
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
it('Encrypted ipk', function(done) {
|
|
479
|
+
exec(cmd + ` -enc ${sampleAppPath} ${sampleServicePaths[0]} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
480
|
+
if (stderr && stderr.length > 0) {
|
|
481
|
+
common.detectNodeMessage(stderr);
|
|
482
|
+
expect(stderr).toContain("ares-package ERR! [syscall failure]: ENOENT: no such file or directory, open", error);
|
|
483
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: Please check if the path is valid", error);
|
|
484
|
+
}
|
|
485
|
+
expect(fs.existsSync(appPkgPath)).toBe(false);
|
|
486
|
+
done();
|
|
487
|
+
});
|
|
488
|
+
});
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
describe(aresCmd + ' --sign(-s) & --certificate(-crt)', function() {
|
|
492
|
+
beforeEach(function(done) {
|
|
493
|
+
common.removeOutDir(outputPath);
|
|
494
|
+
done();
|
|
495
|
+
});
|
|
496
|
+
|
|
497
|
+
afterEach(function(done) {
|
|
498
|
+
common.removeOutDir(outputPath);
|
|
499
|
+
done();
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
it('Sign ipk', function(done) {
|
|
503
|
+
exec(cmd +` -s ${signKeyPath} -crt ${crtPath} ${sampleAppPath} ${sampleServicePaths[0]} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
504
|
+
if (stderr && stderr.length > 0) {
|
|
505
|
+
common.detectNodeMessage(stderr);
|
|
506
|
+
}
|
|
507
|
+
expect(stdout).toContain('Create signed', error);
|
|
508
|
+
expect(fs.existsSync(appPkgPath)).toBe(true);
|
|
509
|
+
done();
|
|
510
|
+
});
|
|
511
|
+
});
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
describe(aresCmd + ' --app-exclude(-e)', function() {
|
|
515
|
+
const tmpFilePath = path.join(sampleAppPath,"tmpFile");
|
|
516
|
+
|
|
517
|
+
beforeEach(function(done) {
|
|
518
|
+
common.removeOutDir(outputPath);
|
|
519
|
+
fs.writeFileSync(tmpFilePath, "", 'utf8');
|
|
520
|
+
done();
|
|
521
|
+
});
|
|
522
|
+
|
|
523
|
+
afterEach(function(done) {
|
|
524
|
+
common.removeOutDir(tmpFilePath);
|
|
525
|
+
common.removeOutDir(outputPath);
|
|
526
|
+
done();
|
|
527
|
+
});
|
|
528
|
+
|
|
529
|
+
it('Check the application but do not pacakge', function(done) {
|
|
530
|
+
exec(cmd + ` -e tmpFile ${sampleAppPath} -r -o ${outputPath}`, function(error, stdout, stderr) {
|
|
531
|
+
if (stderr && stderr.length > 0) {
|
|
532
|
+
common.detectNodeMessage(stderr);
|
|
533
|
+
}
|
|
534
|
+
expect(stdout).toContain("Success");
|
|
535
|
+
expect(fs.existsSync(path.join(appPathByRom, "com.webos.sample.app/tmpFile"))).toBe(false);
|
|
536
|
+
done();
|
|
537
|
+
});
|
|
538
|
+
});
|
|
539
|
+
});
|
|
540
|
+
|
|
541
|
+
describe(aresCmd, function() {
|
|
542
|
+
const pkgInfo = {
|
|
543
|
+
"id": "com",
|
|
544
|
+
"version": "2.2.2"
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
beforeAll(function(done) {
|
|
548
|
+
common.createOutDir(sampleResourcePath);
|
|
549
|
+
|
|
550
|
+
const rscInfoDirPath = path.join(sampleResourcePath, "resourceinfo.json"),
|
|
551
|
+
rscInfo = {
|
|
552
|
+
"id": "com.domain.app.resource",
|
|
553
|
+
"bindmountPath": "abcd"
|
|
554
|
+
};
|
|
555
|
+
fs.writeFileSync(rscInfoDirPath, JSON.stringify(rscInfo), 'utf8');
|
|
556
|
+
fs.writeFileSync(pkgInfoPath, JSON.stringify(pkgInfo), 'utf8');
|
|
557
|
+
done();
|
|
558
|
+
});
|
|
559
|
+
|
|
560
|
+
beforeEach(function(done) {
|
|
561
|
+
common.removeOutDir(outputPath);
|
|
562
|
+
done();
|
|
563
|
+
});
|
|
564
|
+
|
|
565
|
+
afterAll(function(done) {
|
|
566
|
+
common.removeOutDir(outputPath);
|
|
567
|
+
common.removeOutDir(pkgInfoPath);
|
|
568
|
+
common.removeOutDir(sampleResourcePath);
|
|
569
|
+
done();
|
|
570
|
+
});
|
|
571
|
+
|
|
572
|
+
it('Package resource with -pi and -o(--outdir)', function(done) {
|
|
573
|
+
const expectedPiPkgPath = path.join(outputPath, "com_1.0.0_all.ipk");
|
|
574
|
+
|
|
575
|
+
exec(cmd + ` ${sampleResourcePath} -pi com -o ${outputPath}`, function(error, stdout, stderr) {
|
|
576
|
+
if (stderr && stderr.length > 0) {
|
|
577
|
+
common.detectNodeMessage(stderr);
|
|
578
|
+
}
|
|
579
|
+
expect(stdout).toContain("Create", error);
|
|
580
|
+
expect(stdout).toContain("Success", error);
|
|
581
|
+
expect(fs.existsSync(expectedPiPkgPath)).toBe(true);
|
|
582
|
+
done();
|
|
583
|
+
});
|
|
584
|
+
});
|
|
585
|
+
|
|
586
|
+
it('Package resource with -pf and -o(--outdir)', function(done) {
|
|
587
|
+
const expectedPfPkgPath = path.join(outputPath, "com_2.2.2_all.ipk");
|
|
588
|
+
|
|
589
|
+
exec(cmd + ` ${sampleResourcePath} -pf ${pkgInfoPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
590
|
+
if (stderr && stderr.length > 0) {
|
|
591
|
+
common.detectNodeMessage(stderr);
|
|
592
|
+
}
|
|
593
|
+
expect(stdout).toContain("Create", error);
|
|
594
|
+
expect(stdout).toContain("Success", error);
|
|
595
|
+
expect(fs.existsSync(expectedPfPkgPath)).toBe(true);
|
|
596
|
+
done();
|
|
597
|
+
});
|
|
598
|
+
});
|
|
599
|
+
|
|
600
|
+
it('Package resource with -pf(App version does not exist in packageinfo.json) and -o(--outdir)', function(done) {
|
|
601
|
+
const expectedPfPkgPath = path.join(outputPath, "com_1.0.0_all.ipk");
|
|
602
|
+
common.removeOutDir(pkgInfoPath);
|
|
603
|
+
delete pkgInfo.version;
|
|
604
|
+
fs.writeFileSync(pkgInfoPath, JSON.stringify(pkgInfo), 'utf8');
|
|
605
|
+
|
|
606
|
+
exec(cmd + ` ${sampleResourcePath} -pf ${pkgInfoPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
607
|
+
if (stderr && stderr.length > 0) {
|
|
608
|
+
common.detectNodeMessage(stderr);
|
|
609
|
+
}
|
|
610
|
+
expect(stdout).toContain("Create", error);
|
|
611
|
+
expect(stdout).toContain("Success", error);
|
|
612
|
+
expect(fs.existsSync(expectedPfPkgPath)).toBe(true);
|
|
613
|
+
done();
|
|
614
|
+
});
|
|
615
|
+
});
|
|
616
|
+
});
|
|
617
|
+
|
|
618
|
+
describe(aresCmd + ' negative TC for app packaging', function() {
|
|
619
|
+
beforeEach(function(done) {
|
|
620
|
+
const appinfo = {
|
|
621
|
+
"version": "1.0.0",
|
|
622
|
+
"vendor": "My Company",
|
|
623
|
+
"type": "web",
|
|
624
|
+
"main": "index.html",
|
|
625
|
+
"title": "new app",
|
|
626
|
+
"icon": "icon.png"
|
|
627
|
+
};
|
|
628
|
+
fs.writeFileSync(appinfoPath, JSON.stringify(appinfo), 'utf8');
|
|
629
|
+
done();
|
|
630
|
+
});
|
|
631
|
+
|
|
632
|
+
it('Check to exist app id', function(done) {
|
|
633
|
+
exec(cmd + ` ${sampleAppPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
634
|
+
if (stderr && stderr.length > 0) {
|
|
635
|
+
common.detectNodeMessage(stderr);
|
|
636
|
+
stderr = stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
637
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: Please input required field <id>", error);
|
|
638
|
+
}
|
|
639
|
+
done();
|
|
640
|
+
});
|
|
641
|
+
});
|
|
642
|
+
});
|
|
643
|
+
|
|
644
|
+
describe(aresCmd + ' negative TC for app packaging', function() {
|
|
645
|
+
beforeEach(function(done) {
|
|
646
|
+
const appinfo = {
|
|
647
|
+
"id": "com.domain.app",
|
|
648
|
+
"version": "1.0.0",
|
|
649
|
+
"vendor": "My Company"
|
|
650
|
+
};
|
|
651
|
+
fs.writeFileSync(appinfoPath, JSON.stringify(appinfo), 'utf8');
|
|
652
|
+
done();
|
|
653
|
+
});
|
|
654
|
+
|
|
655
|
+
it('Check to exist required fields in app meta file', function(done) {
|
|
656
|
+
exec(cmd + ` ${sampleAppPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
657
|
+
if (stderr && stderr.length > 0) {
|
|
658
|
+
common.detectNodeMessage(stderr);
|
|
659
|
+
stderr = stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
660
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: Invalid file <appinfo.json> :");
|
|
661
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: main is required");
|
|
662
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: title is required");
|
|
663
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: icon is required");
|
|
664
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: type is required");
|
|
665
|
+
}
|
|
666
|
+
done();
|
|
667
|
+
});
|
|
668
|
+
});
|
|
669
|
+
});
|
|
670
|
+
|
|
671
|
+
describe(aresCmd + ' negative TC for app packaging', function() {
|
|
672
|
+
beforeEach(function(done) {
|
|
673
|
+
const appinfo = {
|
|
674
|
+
"id": "com.domain.app",
|
|
675
|
+
"version": "1.0.0",
|
|
676
|
+
"vendor": "My Company",
|
|
677
|
+
"type": "invalidType",
|
|
678
|
+
"main": "index.html",
|
|
679
|
+
"title": "new app",
|
|
680
|
+
"icon": "icon.png"
|
|
681
|
+
};
|
|
682
|
+
fs.writeFileSync(appinfoPath, JSON.stringify(appinfo), 'utf8');
|
|
683
|
+
done();
|
|
684
|
+
});
|
|
685
|
+
|
|
686
|
+
it('Check to invalid app type', function(done) {
|
|
687
|
+
exec(cmd + ` ${sampleAppPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
688
|
+
if (stderr && stderr.length > 0) {
|
|
689
|
+
common.detectNodeMessage(stderr);
|
|
690
|
+
stderr = stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
691
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: Invalid file <appinfo.json> :");
|
|
692
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: type is not one of enum values: " +
|
|
693
|
+
"web,stub,native,native_builtin,native_appshell,qml", error);
|
|
694
|
+
}
|
|
695
|
+
done();
|
|
696
|
+
});
|
|
697
|
+
});
|
|
698
|
+
});
|
|
699
|
+
|
|
700
|
+
describe(aresCmd + ' negative TC for app packaging', function() {
|
|
701
|
+
beforeAll(function(done) {
|
|
702
|
+
common.removeOutDir(pkgInfoPath);
|
|
703
|
+
common.createOutDir(pkgDirPath);
|
|
704
|
+
|
|
705
|
+
const pkgDirInfoPath = path.join(pkgDirPath, "packageinfo.json"),
|
|
706
|
+
pkgInfo = {
|
|
707
|
+
"id": "com.test",
|
|
708
|
+
"version": "1.0.0"
|
|
709
|
+
};
|
|
710
|
+
fs.writeFileSync(pkgInfoPath, JSON.stringify(pkgInfo), 'utf8');
|
|
711
|
+
fs.writeFileSync(pkgDirInfoPath, JSON.stringify(pkgInfo), 'utf8');
|
|
712
|
+
done();
|
|
713
|
+
});
|
|
714
|
+
|
|
715
|
+
beforeEach(function(done) {
|
|
716
|
+
common.removeOutDir(outputPath);
|
|
717
|
+
done();
|
|
718
|
+
});
|
|
719
|
+
|
|
720
|
+
afterAll(function(done) {
|
|
721
|
+
common.removeOutDir(outputPath);
|
|
722
|
+
common.removeOutDir(pkgInfoPath);
|
|
723
|
+
common.removeOutDir(pkgDirPath);
|
|
724
|
+
done();
|
|
725
|
+
});
|
|
726
|
+
|
|
727
|
+
it('Check to invalid app id with -pi option', function(done) {
|
|
728
|
+
exec(cmd + ` ${sampleAppPath} -pi com.test -o ${outputPath}`, function(error, stdout, stderr) {
|
|
729
|
+
if (stderr && stderr.length > 0) {
|
|
730
|
+
common.detectNodeMessage(stderr);
|
|
731
|
+
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
732
|
+
expect(stderr).toContain("ares-package ERR! Error: Invalid value <id> : com.domain.app", error);
|
|
733
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: App ID must start with package ID <com.test>", error);
|
|
734
|
+
}
|
|
735
|
+
done();
|
|
736
|
+
});
|
|
737
|
+
});
|
|
738
|
+
|
|
739
|
+
it('Check to invalid app id with -pf option', function(done) {
|
|
740
|
+
exec(cmd + ` ${sampleAppPath} -pf ${pkgInfoPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
741
|
+
if (stderr && stderr.length > 0) {
|
|
742
|
+
common.detectNodeMessage(stderr);
|
|
743
|
+
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
744
|
+
expect(stderr).toContain("ares-package ERR! Error: Invalid value <id> : com.domain.app", error);
|
|
745
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: App ID must start with package ID <com.test>", error);
|
|
746
|
+
}
|
|
747
|
+
done();
|
|
748
|
+
});
|
|
749
|
+
});
|
|
750
|
+
|
|
751
|
+
it('Check to do not support with -pi and -pf options together', function(done) {
|
|
752
|
+
exec(cmd + ` ${sampleAppPath} -pf ${pkgInfoPath} -pi com.webos.sample -o ${outputPath}`, function(error, stdout, stderr) {
|
|
753
|
+
if (stderr && stderr.length > 0) {
|
|
754
|
+
common.detectNodeMessage(stderr);
|
|
755
|
+
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
756
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: Do not use together with options <pkginfofile, pkgid>", error);
|
|
757
|
+
}
|
|
758
|
+
done();
|
|
759
|
+
});
|
|
760
|
+
});
|
|
761
|
+
|
|
762
|
+
it('Check to do not support with pkgdir', function(done) {
|
|
763
|
+
exec(cmd + ` ${sampleAppPath} ${pkgDirPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
764
|
+
if (stderr && stderr.length > 0) {
|
|
765
|
+
common.detectNodeMessage(stderr);
|
|
766
|
+
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
767
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: Cannot package the directory with package directory", error);
|
|
768
|
+
}
|
|
769
|
+
done();
|
|
770
|
+
});
|
|
771
|
+
});
|
|
772
|
+
|
|
773
|
+
it('Check to do not support with pkgdir and -pi options together', function(done) {
|
|
774
|
+
exec(cmd + ` ${sampleAppPath} ${pkgDirPath} -pi com -o ${outputPath}`, function(error, stdout, stderr) {
|
|
775
|
+
if (stderr && stderr.length > 0) {
|
|
776
|
+
common.detectNodeMessage(stderr);
|
|
777
|
+
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
778
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: Cannot package the directory with package directory", error);
|
|
779
|
+
}
|
|
780
|
+
done();
|
|
781
|
+
});
|
|
782
|
+
});
|
|
783
|
+
|
|
784
|
+
it('Check to do not support with pkgdir and -pf options together', function(done) {
|
|
785
|
+
exec(cmd + ` ${sampleAppPath} ${pkgDirPath} -pf ${pkgInfoPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
786
|
+
if (stderr && stderr.length > 0) {
|
|
787
|
+
common.detectNodeMessage(stderr);
|
|
788
|
+
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
789
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: Cannot package the directory with package directory", error);
|
|
790
|
+
}
|
|
791
|
+
done();
|
|
792
|
+
});
|
|
793
|
+
});
|
|
794
|
+
});
|
|
795
|
+
|
|
796
|
+
describe(aresCmd + ' negative TC for services packaging', function() {
|
|
797
|
+
beforeEach(function(done) {
|
|
798
|
+
common.removeOutDir(outputPath);
|
|
799
|
+
done();
|
|
800
|
+
});
|
|
801
|
+
|
|
802
|
+
it('Check to exist pi option', function(done) {
|
|
803
|
+
exec(cmd + ` ${sampleServicePaths[1]} ${sampleServicePaths[2]} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
804
|
+
if (stderr && stderr.length > 0) {
|
|
805
|
+
common.detectNodeMessage(stderr);
|
|
806
|
+
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
807
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: packageId must be provided by using either the '--pkgid' or the '--pkginfofile' option", error);
|
|
808
|
+
}
|
|
809
|
+
done();
|
|
810
|
+
});
|
|
811
|
+
});
|
|
812
|
+
});
|
|
813
|
+
|
|
814
|
+
describe(aresCmd + ' negative TC for services packaging', function() {
|
|
815
|
+
beforeEach(function(done) {
|
|
816
|
+
common.removeOutDir(outputPath);
|
|
817
|
+
|
|
818
|
+
const pkgInfo = {
|
|
819
|
+
"id": "com.webos.sample",
|
|
820
|
+
"version": "1.0.0"
|
|
821
|
+
};
|
|
822
|
+
fs.writeFileSync(pkgInfoPath, JSON.stringify(pkgInfo), 'utf8');
|
|
823
|
+
done();
|
|
824
|
+
});
|
|
825
|
+
|
|
826
|
+
afterEach(function(done) {
|
|
827
|
+
common.removeOutDir(outputPath);
|
|
828
|
+
common.removeOutDir(pkgInfoPath);
|
|
829
|
+
done();
|
|
830
|
+
});
|
|
831
|
+
|
|
832
|
+
it('Check to do not support -pi and -pf options together', function(done) {
|
|
833
|
+
exec(cmd + ` ${sampleServicePaths[1]} ${sampleServicePaths[2]} -pf ${pkgInfoPath} -pi com.webos.sample -o ${outputPath}`, function(error, stdout, stderr) {
|
|
834
|
+
if (stderr && stderr.length > 0) {
|
|
835
|
+
common.detectNodeMessage(stderr);
|
|
836
|
+
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
837
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: Do not use together with options <pkginfofile, pkgid>", error);
|
|
838
|
+
}
|
|
839
|
+
done();
|
|
840
|
+
});
|
|
841
|
+
});
|
|
842
|
+
});
|
|
843
|
+
|
|
844
|
+
describe(aresCmd + ' negative TC for services packaging', function() {
|
|
845
|
+
const tmpPath = path.join(tempDirPath, "pkg.json");
|
|
846
|
+
|
|
847
|
+
beforeEach(function(done) {
|
|
848
|
+
common.removeOutDir(outputPath);
|
|
849
|
+
|
|
850
|
+
const pkginfo = {
|
|
851
|
+
"id": "com.webos.sample",
|
|
852
|
+
"version": "1.0.0"
|
|
853
|
+
};
|
|
854
|
+
fs.writeFileSync(tmpPath, JSON.stringify(pkginfo), 'utf8');
|
|
855
|
+
done();
|
|
856
|
+
});
|
|
857
|
+
|
|
858
|
+
afterEach(function(done) {
|
|
859
|
+
common.removeOutDir(tmpPath);
|
|
860
|
+
done();
|
|
861
|
+
});
|
|
862
|
+
|
|
863
|
+
it('Check to file name of package meta file', function(done) {
|
|
864
|
+
exec(cmd + ` ${sampleServicePaths[1]} ${sampleServicePaths[2]} -pf ${tmpPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
865
|
+
if (stderr && stderr.length > 0) {
|
|
866
|
+
common.detectNodeMessage(stderr);
|
|
867
|
+
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
868
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: Invalid file <packageinfo.json>", error);
|
|
869
|
+
}
|
|
870
|
+
done();
|
|
871
|
+
});
|
|
872
|
+
});
|
|
873
|
+
});
|
|
874
|
+
|
|
875
|
+
describe(aresCmd + ' negative TC for services packaging', function() {
|
|
876
|
+
const tmpPath = path.join(tempDirPath, "pkg.json");
|
|
877
|
+
|
|
878
|
+
beforeEach(function(done) {
|
|
879
|
+
common.removeOutDir(outputPath);
|
|
880
|
+
common.removeOutDir(pkgInfoPath);
|
|
881
|
+
|
|
882
|
+
const pkginfo = {
|
|
883
|
+
"version": "1.0.0"
|
|
884
|
+
};
|
|
885
|
+
fs.writeFileSync(pkgInfoPath, JSON.stringify(pkginfo), 'utf8');
|
|
886
|
+
done();
|
|
887
|
+
});
|
|
888
|
+
|
|
889
|
+
afterEach(function(done) {
|
|
890
|
+
common.removeOutDir(tmpPath);
|
|
891
|
+
done();
|
|
892
|
+
});
|
|
893
|
+
|
|
894
|
+
it('Check to exist id fields in pkg meta file', function(done) {
|
|
895
|
+
exec(cmd + ` ${sampleServicePaths[1]} ${sampleServicePaths[2]} -pf ${pkgInfoPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
896
|
+
if (stderr && stderr.length > 0) {
|
|
897
|
+
common.detectNodeMessage(stderr);
|
|
898
|
+
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
899
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: Please input required field <id>", error);
|
|
900
|
+
}
|
|
901
|
+
done();
|
|
902
|
+
});
|
|
903
|
+
});
|
|
904
|
+
});
|
|
905
|
+
|
|
906
|
+
describe(aresCmd + ' negative TC for services packaging', function() {
|
|
907
|
+
beforeAll(function(done) {
|
|
908
|
+
common.createOutDir(pkgDirPath);
|
|
909
|
+
|
|
910
|
+
const pkgDirInfoPath = path.join(pkgDirPath, "packageinfo.json"),
|
|
911
|
+
pkgInfo = {
|
|
912
|
+
"id": "com.test"
|
|
913
|
+
};
|
|
914
|
+
fs.writeFileSync(pkgInfoPath, JSON.stringify(pkgInfo), 'utf8');
|
|
915
|
+
fs.writeFileSync(pkgDirInfoPath, JSON.stringify(pkgInfo), 'utf8');
|
|
916
|
+
done();
|
|
917
|
+
});
|
|
918
|
+
|
|
919
|
+
beforeEach(function(done) {
|
|
920
|
+
common.removeOutDir(outputPath);
|
|
921
|
+
done();
|
|
922
|
+
});
|
|
923
|
+
|
|
924
|
+
afterAll(function(done) {
|
|
925
|
+
common.removeOutDir(outputPath);
|
|
926
|
+
common.removeOutDir(pkgInfoPath);
|
|
927
|
+
common.removeOutDir(pkgDirPath);
|
|
928
|
+
done();
|
|
929
|
+
});
|
|
930
|
+
|
|
931
|
+
it('Check to invalid service id with -pi option', function(done) {
|
|
932
|
+
exec(cmd + ` ${sampleServicePaths[0]} -pi com.test -o ${outputPath}`, function(error, stdout, stderr) {
|
|
933
|
+
if (stderr && stderr.length > 0) {
|
|
934
|
+
common.detectNodeMessage(stderr);
|
|
935
|
+
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
936
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: ServiceID must start with package id <com.test>", error);
|
|
937
|
+
}
|
|
938
|
+
done();
|
|
939
|
+
});
|
|
940
|
+
});
|
|
941
|
+
|
|
942
|
+
it('Check to invalid service id with -pf option', function(done) {
|
|
943
|
+
exec(cmd + ` ${sampleServicePaths[0]} -pf ${pkgInfoPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
944
|
+
if (stderr && stderr.length > 0) {
|
|
945
|
+
common.detectNodeMessage(stderr);
|
|
946
|
+
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
947
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: ServiceID must start with package id <com.test>", error);
|
|
948
|
+
}
|
|
949
|
+
done();
|
|
950
|
+
});
|
|
951
|
+
});
|
|
952
|
+
|
|
953
|
+
it('Check to do not support with pkgdir', function(done) {
|
|
954
|
+
exec(cmd + ` ${sampleServicePaths[1]} ${pkgDirPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
955
|
+
if (stderr && stderr.length > 0) {
|
|
956
|
+
common.detectNodeMessage(stderr);
|
|
957
|
+
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
958
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: Cannot package the directory with package directory", error);
|
|
959
|
+
}
|
|
960
|
+
done();
|
|
961
|
+
});
|
|
962
|
+
});
|
|
963
|
+
|
|
964
|
+
it('Check to do not support with pkgdir and -pi options together', function(done) {
|
|
965
|
+
exec(cmd + ` ${sampleServicePaths[1]} ${pkgDirPath} -pi com -o ${outputPath}`, function(error, stdout, stderr) {
|
|
966
|
+
if (stderr && stderr.length > 0) {
|
|
967
|
+
common.detectNodeMessage(stderr);
|
|
968
|
+
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
969
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: Cannot package the directory with package directory", error);
|
|
970
|
+
}
|
|
971
|
+
done();
|
|
972
|
+
});
|
|
973
|
+
});
|
|
974
|
+
|
|
975
|
+
it('Check to do not support with pkgdir and -pf options together', function(done) {
|
|
976
|
+
exec(cmd + ` ${sampleServicePaths[1]} ${pkgDirPath} -pf ${pkgInfoPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
977
|
+
if (stderr && stderr.length > 0) {
|
|
978
|
+
common.detectNodeMessage(stderr);
|
|
979
|
+
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
980
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: Cannot package the directory with package directory", error);
|
|
981
|
+
}
|
|
982
|
+
done();
|
|
983
|
+
});
|
|
984
|
+
});
|
|
985
|
+
});
|
|
986
|
+
|
|
987
|
+
describe(aresCmd + ' negative TC for resource packaging', function() {
|
|
988
|
+
const pkgInfo = {
|
|
989
|
+
"id": "com.test",
|
|
990
|
+
"version": "2.2.2"
|
|
991
|
+
};
|
|
992
|
+
|
|
993
|
+
beforeAll(function(done) {
|
|
994
|
+
common.removeOutDir(pkgInfoPath);
|
|
995
|
+
common.createOutDir(pkgDirPath);
|
|
996
|
+
common.createOutDir(sampleResourcePath);
|
|
997
|
+
|
|
998
|
+
const pkgDirInfoPath = path.join(pkgDirPath, "packageinfo.json"),
|
|
999
|
+
rscInfoDirPath = path.join(sampleResourcePath, "resourceinfo.json"),
|
|
1000
|
+
pkgDirInfo = {
|
|
1001
|
+
"id": "com.domain"
|
|
1002
|
+
},
|
|
1003
|
+
rscInfo = {
|
|
1004
|
+
"id": "com.domain.app.resource",
|
|
1005
|
+
"bindmountPath": "abcd"
|
|
1006
|
+
};
|
|
1007
|
+
fs.writeFileSync(pkgInfoPath, JSON.stringify(pkgInfo), 'utf8');
|
|
1008
|
+
fs.writeFileSync(pkgDirInfoPath, JSON.stringify(pkgDirInfo), 'utf8');
|
|
1009
|
+
fs.writeFileSync(rscInfoDirPath, JSON.stringify(rscInfo), 'utf8');
|
|
1010
|
+
done();
|
|
1011
|
+
});
|
|
1012
|
+
|
|
1013
|
+
beforeEach(function(done) {
|
|
1014
|
+
common.removeOutDir(outputPath);
|
|
1015
|
+
done();
|
|
1016
|
+
});
|
|
1017
|
+
|
|
1018
|
+
afterAll(function(done) {
|
|
1019
|
+
common.removeOutDir(outputPath);
|
|
1020
|
+
common.removeOutDir(pkgInfoPath);
|
|
1021
|
+
common.removeOutDir(pkgDirPath);
|
|
1022
|
+
common.removeOutDir(sampleResourcePath);
|
|
1023
|
+
done();
|
|
1024
|
+
});
|
|
1025
|
+
|
|
1026
|
+
it('Check to exist pi option', function(done) {
|
|
1027
|
+
exec(cmd + ` ${sampleResourcePath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
1028
|
+
if (stderr && stderr.length > 0) {
|
|
1029
|
+
common.detectNodeMessage(stderr);
|
|
1030
|
+
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
1031
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: packageId must be provided by using either the '--pkgid' or the '--pkginfofile' option", error);
|
|
1032
|
+
}
|
|
1033
|
+
done();
|
|
1034
|
+
});
|
|
1035
|
+
});
|
|
1036
|
+
|
|
1037
|
+
it('Check to invalid resource id with -pi option', function(done) {
|
|
1038
|
+
exec(cmd + ` ${sampleResourcePath} -pi com.test -o ${outputPath}`, function(error, stdout, stderr) {
|
|
1039
|
+
if (stderr && stderr.length > 0) {
|
|
1040
|
+
common.detectNodeMessage(stderr);
|
|
1041
|
+
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
1042
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: Resource ID must start with package ID <com.test>", error);
|
|
1043
|
+
}
|
|
1044
|
+
done();
|
|
1045
|
+
});
|
|
1046
|
+
});
|
|
1047
|
+
|
|
1048
|
+
it('Check to invalid resource id with -pf option', function(done) {
|
|
1049
|
+
exec(cmd + ` ${sampleResourcePath} -pf ${pkgInfoPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
1050
|
+
if (stderr && stderr.length > 0) {
|
|
1051
|
+
common.detectNodeMessage(stderr);
|
|
1052
|
+
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
1053
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: Resource ID must start with package ID <com.test>", error);
|
|
1054
|
+
}
|
|
1055
|
+
done();
|
|
1056
|
+
});
|
|
1057
|
+
});
|
|
1058
|
+
|
|
1059
|
+
it('Check to do not support with -pi and -pf options together', function(done) {
|
|
1060
|
+
exec(cmd + ` ${sampleResourcePath} -pi com -pf ${pkgInfoPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
1061
|
+
if (stderr && stderr.length > 0) {
|
|
1062
|
+
common.detectNodeMessage(stderr);
|
|
1063
|
+
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
1064
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: Do not use together with options <pkginfofile, pkgid>", error);
|
|
1065
|
+
}
|
|
1066
|
+
done();
|
|
1067
|
+
});
|
|
1068
|
+
});
|
|
1069
|
+
|
|
1070
|
+
it('Check to do not support with pkgdir', function(done) {
|
|
1071
|
+
exec(cmd + ` ${sampleResourcePath} ${pkgDirPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
1072
|
+
if (stderr && stderr.length > 0) {
|
|
1073
|
+
common.detectNodeMessage(stderr);
|
|
1074
|
+
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
1075
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: Cannot package the directory with package directory", error);
|
|
1076
|
+
}
|
|
1077
|
+
done();
|
|
1078
|
+
});
|
|
1079
|
+
});
|
|
1080
|
+
|
|
1081
|
+
it('Check to do not support with pkgdir and -pi options together', function(done) {
|
|
1082
|
+
exec(cmd + ` ${sampleResourcePath} ${pkgDirPath} -pi com -o ${outputPath}`, function(error, stdout, stderr) {
|
|
1083
|
+
if (stderr && stderr.length > 0) {
|
|
1084
|
+
common.detectNodeMessage(stderr);
|
|
1085
|
+
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
1086
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: Cannot package the directory with package directory", error);
|
|
1087
|
+
}
|
|
1088
|
+
done();
|
|
1089
|
+
});
|
|
1090
|
+
});
|
|
1091
|
+
|
|
1092
|
+
it('Check to do not support with pkgdir and -pf options together', function(done) {
|
|
1093
|
+
exec(cmd + ` ${sampleResourcePath} ${pkgDirPath} -pf ${pkgInfoPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
1094
|
+
if (stderr && stderr.length > 0) {
|
|
1095
|
+
common.detectNodeMessage(stderr);
|
|
1096
|
+
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
1097
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: Cannot package the directory with package directory", error);
|
|
1098
|
+
}
|
|
1099
|
+
done();
|
|
1100
|
+
});
|
|
1101
|
+
});
|
|
1102
|
+
|
|
1103
|
+
it('Check to cannot package with app', function(done) {
|
|
1104
|
+
exec(cmd + ` ${sampleAppPath} ${sampleResourcePath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
1105
|
+
if (stderr && stderr.length > 0) {
|
|
1106
|
+
common.detectNodeMessage(stderr);
|
|
1107
|
+
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
1108
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: Cannot package the app or service directory with resource directory", error);
|
|
1109
|
+
}
|
|
1110
|
+
done();
|
|
1111
|
+
});
|
|
1112
|
+
});
|
|
1113
|
+
|
|
1114
|
+
it('Check to cannot package with service', function(done) {
|
|
1115
|
+
exec(cmd + ` ${sampleServicePaths[0]} ${sampleResourcePath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
1116
|
+
if (stderr && stderr.length > 0) {
|
|
1117
|
+
common.detectNodeMessage(stderr);
|
|
1118
|
+
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
1119
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: Cannot package the app or service directory with resource directory", error);
|
|
1120
|
+
}
|
|
1121
|
+
done();
|
|
1122
|
+
});
|
|
1123
|
+
});
|
|
1124
|
+
|
|
1125
|
+
it('Check to cannot package with app and service', function(done) {
|
|
1126
|
+
exec(cmd + ` ${sampleAppPath} ${sampleServicePaths[0]} ${sampleResourcePath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
1127
|
+
if (stderr && stderr.length > 0) {
|
|
1128
|
+
common.detectNodeMessage(stderr);
|
|
1129
|
+
stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
1130
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: Cannot package the app or service directory with resource directory", error);
|
|
1131
|
+
}
|
|
1132
|
+
done();
|
|
1133
|
+
});
|
|
1134
|
+
});
|
|
1135
|
+
|
|
1136
|
+
it('Check to exist id fields in pkg meta file', function(done) {
|
|
1137
|
+
common.removeOutDir(pkgInfoPath);
|
|
1138
|
+
delete pkgInfo.id;
|
|
1139
|
+
fs.writeFileSync(pkgInfoPath, JSON.stringify(pkgInfo), 'utf8');
|
|
1140
|
+
|
|
1141
|
+
exec(cmd + ` ${sampleResourcePath} -pf ${pkgInfoPath} -o ${outputPath}`, function(error, stdout, stderr) {
|
|
1142
|
+
if (stderr && stderr.length > 0) {
|
|
1143
|
+
common.detectNodeMessage(stderr);
|
|
1144
|
+
stderr = stderr.trim().replace(/\s+['\n']/g, '\n');
|
|
1145
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: Please input required field <id>", error);
|
|
1146
|
+
}
|
|
1147
|
+
done();
|
|
1148
|
+
});
|
|
1149
|
+
});
|
|
1150
|
+
});
|
|
1151
|
+
|
|
1152
|
+
describe(aresCmd + " info/info-detail options", function() {
|
|
1153
|
+
it('Info of web app and service package', function(done) {
|
|
1154
|
+
const webIpk = path.join(ipkBasePath, "com.web.app_1.0.0_all.ipk");
|
|
1155
|
+
|
|
1156
|
+
exec(cmd + ` -I ${webIpk}`, function(error, stdout, stderr) {
|
|
1157
|
+
if (stderr && stderr.length > 0) {
|
|
1158
|
+
common.detectNodeMessage(stderr);
|
|
1159
|
+
}
|
|
1160
|
+
expect(stdout).toContain("< packageinfo.json >");
|
|
1161
|
+
expect(stdout).toContain("< appinfo.json >");
|
|
1162
|
+
expect(stdout).toContain("< services.json >");
|
|
1163
|
+
expect(stdout).toContain("< package.json >");
|
|
1164
|
+
done();
|
|
1165
|
+
});
|
|
1166
|
+
});
|
|
1167
|
+
|
|
1168
|
+
it('Info of external native app and service package', function(done) {
|
|
1169
|
+
const externalAppIpk = path.join(ipkBasePath, "com.sample.echo_0.0.1_all.ipk");
|
|
1170
|
+
|
|
1171
|
+
exec(cmd + ` -i ${externalAppIpk}`, function(error, stdout, stderr) {
|
|
1172
|
+
if (stderr && stderr.length > 0) {
|
|
1173
|
+
common.detectNodeMessage(stderr);
|
|
1174
|
+
}
|
|
1175
|
+
expect(stdout).toContain("< Package Information >");
|
|
1176
|
+
expect(stdout).toContain("< Application Information >");
|
|
1177
|
+
expect(stdout).toContain("< Service Information >");
|
|
1178
|
+
done();
|
|
1179
|
+
});
|
|
1180
|
+
});
|
|
1181
|
+
|
|
1182
|
+
it('nagetive TC for not support file extension', function(done) {
|
|
1183
|
+
exec(cmd + ` -i aaa`, function(error, stdout, stderr) {
|
|
1184
|
+
if (stderr && stderr.length > 0) {
|
|
1185
|
+
common.detectNodeMessage(stderr);
|
|
1186
|
+
}
|
|
1187
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: Only .ipk file is supported. Please check the file extension <aaa>");
|
|
1188
|
+
done();
|
|
1189
|
+
});
|
|
1190
|
+
});
|
|
1191
|
+
|
|
1192
|
+
it('nagetive TC for not exist ipk file', function(done) {
|
|
1193
|
+
exec(cmd + ` -i aaa.ipk`, function(error, stdout, stderr) {
|
|
1194
|
+
if (stderr && stderr.length > 0) {
|
|
1195
|
+
common.detectNodeMessage(stderr);
|
|
1196
|
+
}
|
|
1197
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: The specified path does not exist <aaa.ipk>");
|
|
1198
|
+
done();
|
|
1199
|
+
});
|
|
1200
|
+
});
|
|
1201
|
+
|
|
1202
|
+
it('nagetive TC for not exist parameter', function(done) {
|
|
1203
|
+
exec(cmd + ` -i`, function(error, stdout, stderr) {
|
|
1204
|
+
if (stderr && stderr.length > 0) {
|
|
1205
|
+
common.detectNodeMessage(stderr);
|
|
1206
|
+
}
|
|
1207
|
+
expect(stderr).toContain("ares-package ERR! [Tips]: Please specify a value <info>");
|
|
1208
|
+
done();
|
|
1209
|
+
});
|
|
1210
|
+
});
|
|
1211
|
+
});
|