File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed
Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -22,12 +22,22 @@ import { getLogger } from 'log4js';
2222const logger = getLogger ( ) ;
2323
2424export const NEWLINE = / \r \n | \n / ;
25+ const MEMDUMPER = '/data/local/tmp/memdumper' ;
2526
2627export class Hdc {
2728 private connectkey : string | undefined ;
2829
2930 constructor ( connectkey : string | undefined = undefined ) {
3031 this . connectkey = connectkey ;
32+ this . initDeviceEnv ( ) ;
33+ }
34+
35+ private initDeviceEnv ( ) : void {
36+ if ( ! this . hasFile ( MEMDUMPER ) ) {
37+ let memdumpFile = path . join ( __dirname , '..' , '..' , 'res/memdumper/memdumper' ) ;
38+ this . sendFile ( memdumpFile , MEMDUMPER ) ;
39+ this . excuteShellCommand ( `chmod +x ${ MEMDUMPER } ` ) ;
40+ }
3141 }
3242
3343 sendFile ( local : string , remote : string ) : number {
@@ -217,7 +227,7 @@ export class Hdc {
217227 idxMap . set ( map . file , idx ) ;
218228 let out = this . excuteShellCommand (
219229 ...[
220- '/data/local/tmp/memdumper' ,
230+ MEMDUMPER ,
221231 '-s' ,
222232 map . start ,
223233 '-n' ,
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2024 Huawei Device Co., Ltd.
3+ * Licensed under the Apache License, Version 2.0 (the "License");
4+ * you may not use this file except in compliance with the License.
5+ * You may obtain a copy of the License at
6+ *
7+ * http://www.apache.org/licenses/LICENSE-2.0
8+ *
9+ * Unless required by applicable law or agreed to in writing, software
10+ * distributed under the License is distributed on an "AS IS" BASIS,
11+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ * See the License for the specific language governing permissions and
13+ * limitations under the License.
14+ */
15+
16+ import { describe , it , expect } from 'vitest' ;
17+ import { GlobMatch } from '../../src/utils/glob_match' ;
18+
19+ describe ( 'GlobMatch Test' , ( ) => {
20+ it ( 'test()' , async ( ) => {
21+ let match = new GlobMatch ( [ 'com.huawei.*' , 'com.ohos.*' ] ) ;
22+ expect ( match . match ( 'com.huawei.ouc' ) ) . eq ( true ) ;
23+ expect ( match . match ( 'com.ohos.ouc' ) ) . eq ( true ) ;
24+ expect ( match . match ( 'com.qq.ouc' ) ) . eq ( false ) ;
25+ } ) ;
26+ } ) ;
You can’t perform that action at this time.
0 commit comments