Skip to content

Commit fe39e34

Browse files
authored
[converter] Remove use of browserstack (tensorflow#2734)
* Remove use of browserstack
1 parent 4393140 commit fe39e34

File tree

4 files changed

+74
-18
lines changed

4 files changed

+74
-18
lines changed

tfjs-converter/cloudbuild.yml

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,46 @@ steps:
66
id: 'yarn-common'
77
args: ['install']
88

9-
# Install converter dependencies
9+
# Install converter dependencies.
1010
- name: 'node:10'
1111
dir: 'tfjs-converter'
1212
entrypoint: 'yarn'
1313
id: 'yarn'
1414
args: ['install']
1515
waitFor: ['yarn-common']
1616

17-
# Run browser tests.
17+
# Run lint.
1818
- name: 'node:10'
1919
dir: 'tfjs-converter'
2020
entrypoint: 'yarn'
21-
id: 'test-browser'
22-
args: ['test-ci']
21+
id: 'lint'
22+
args: ['lint']
23+
waitFor: ['yarn']
24+
25+
# Generate json file.
26+
- name: 'node:10'
27+
dir: 'tfjs-converter'
28+
entrypoint: 'yarn'
29+
id: 'gen-json'
30+
args: ['gen-json', '--test']
2331
waitFor: ['yarn']
24-
env: ['BROWSERSTACK_USERNAME=deeplearnjs1', 'NIGHTLY=$_NIGHTLY']
25-
secretEnv: ['BROWSERSTACK_KEY']
32+
33+
# Build the project.
34+
- name: 'node:10'
35+
dir: 'tfjs-converter'
36+
entrypoint: 'yarn'
37+
id: 'build'
38+
args: ['build']
39+
waitFor: ['gen-json']
40+
41+
# Run javascript tests.
42+
- name: 'node:10'
43+
dir: 'tfjs-converter'
44+
entrypoint: 'yarn'
45+
id: 'test-js'
46+
args: ['test-ci']
47+
waitFor: ['build']
48+
env: ['NIGHTLY=$_NIGHTLY']
2649

2750
# Run python tests.
2851
- name: 'gcr.io/google-appengine/python'
@@ -50,10 +73,6 @@ steps:
5073
args: ['test-snippets']
5174
waitFor: ['yarn']
5275

53-
secrets:
54-
- kmsKeyName: projects/learnjs-174218/locations/global/keyRings/tfjs/cryptoKeys/enc
55-
secretEnv:
56-
BROWSERSTACK_KEY: CiQAkwyoIW0LcnxymzotLwaH4udVTQFBEN4AEA5CA+a3+yflL2ASPQAD8BdZnGARf78MhH5T9rQqyz9HNODwVjVIj64CTkFlUCGrP1B2HX9LXHWHLmtKutEGTeFFX9XhuBzNExA=
5776
timeout: 1800s
5877
logsBucket: 'gs://tfjs-build-logs'
5978
substitutions:

tfjs-converter/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,9 @@
5858
"build-npm": "./scripts/build-npm.sh",
5959
"link-local": "yalc link",
6060
"publish-local": "yarn build-npm && yalc push",
61-
"test": "yarn gen-json --test && karma start",
62-
"test-ci": "yarn gen-json --test && yarn build && yarn lint && yarn run-browserstack",
61+
"test": "yarn gen-json --test && ts-node run_tests.ts",
62+
"test-ci": "ts-node run_tests.ts",
6363
"test-snippets": "ts-node ./scripts/test_snippets.ts",
64-
"run-browserstack": "karma start --singleRun --browsers='bs_firefox_mac,bs_chrome_mac' --reporters='dots,karma-typescript,BrowserStack'",
6564
"lint": "tslint -p . -t verbose",
6665
"make-version": "sh -c ./scripts/make-version",
6766
"gen-doc": "ts-node ./scripts/gen_doc.ts",

tfjs-converter/run_tests.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* @license
3+
* Copyright 2020 Google Inc. All Rights Reserved.
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
* =============================================================================
16+
*/
17+
18+
// tslint:disable-next-line:no-imports-from-dist
19+
import * as jasmine_util from '@tensorflow/tfjs-core/dist/jasmine_util';
20+
21+
// tslint:disable-next-line:no-require-imports
22+
const jasmineCtor = require('jasmine');
23+
// tslint:disable-next-line:no-require-imports
24+
25+
Error.stackTraceLimit = Infinity;
26+
27+
process.on('unhandledRejection', e => {
28+
throw e;
29+
});
30+
31+
jasmine_util.setTestEnvs(
32+
[{name: 'test-converter', backendName: 'cpu', flags: {}}]);
33+
34+
const unitTests = 'src/**/*_test.ts';
35+
36+
const runner = new jasmineCtor();
37+
runner.loadConfig({spec_files: [unitTests], random: false});
38+
runner.execute();

tfjs-converter/src/operations/executors/dynamic_executor_test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ describe('dynamic', () => {
5555
const input3 = [tfc.tensor1d([1])];
5656
const input4 = [tfc.tensor1d([1])];
5757
const input5 = [tfc.tensor1d([1])];
58-
spyOn(tfc.image, 'nonMaxSuppressionAsync').and.callThrough();
58+
spyOn(tfc.image, 'nonMaxSuppressionAsync');
5959
const result =
6060
executeOp(node, {input1, input2, input3, input4, input5}, context);
6161
expect(tfc.image.nonMaxSuppressionAsync)
@@ -88,7 +88,7 @@ describe('dynamic', () => {
8888
const input3 = [tfc.tensor1d([1])];
8989
const input4 = [tfc.tensor1d([1])];
9090
const input5 = [tfc.tensor1d([1])];
91-
spyOn(tfc.image, 'nonMaxSuppressionAsync').and.callThrough();
91+
spyOn(tfc.image, 'nonMaxSuppressionAsync');
9292
const result =
9393
executeOp(node, {input1, input2, input3, input4, input5}, context);
9494
expect(tfc.image.nonMaxSuppressionAsync)
@@ -125,7 +125,7 @@ describe('dynamic', () => {
125125
const input4 = [tfc.tensor1d([1])];
126126
const input5 = [tfc.tensor1d([1])];
127127
const input6 = [tfc.tensor1d([1])];
128-
spyOn(tfc.image, 'nonMaxSuppressionWithScoreAsync').and.callThrough();
128+
spyOn(tfc.image, 'nonMaxSuppressionWithScoreAsync').and.returnValue({});
129129
const result = executeOp(
130130
node, {input1, input2, input3, input4, input5, input6}, context);
131131
expect(tfc.image.nonMaxSuppressionWithScoreAsync)
@@ -153,7 +153,7 @@ describe('dynamic', () => {
153153
node.op = 'Where';
154154
node.inputParams = {'condition': createTensorAttr(0)};
155155
const input1 = [tfc.scalar(1)];
156-
spyOn(tfc, 'whereAsync').and.callThrough();
156+
spyOn(tfc, 'whereAsync');
157157

158158
const result = executeOp(node, {input1}, context);
159159
expect((tfc.whereAsync as jasmine.Spy).calls.mostRecent().args[0].dtype)
@@ -180,7 +180,7 @@ describe('dynamic', () => {
180180
node.inputParams = {'x': createTensorAttr(0), 'y': createTensorAttr(1)};
181181
const input1 = [tfc.scalar(1)];
182182
const input2 = [tfc.scalar(1)];
183-
spyOn(tfc, 'setdiff1dAsync').and.callThrough();
183+
spyOn(tfc, 'setdiff1dAsync');
184184

185185
const result = executeOp(node, {input1, input2}, context);
186186
expect(tfc.setdiff1dAsync).toHaveBeenCalledWith(input1[0], input2[0]);

0 commit comments

Comments
 (0)