mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
Collecting the iOS log
This commit is contained in:
@ -37,7 +37,7 @@ module.exports = {
|
|||||||
emulatorProcessIdentifier: args.emulatorProcessIdentifier,
|
emulatorProcessIdentifier: args.emulatorProcessIdentifier,
|
||||||
modulesPath: args.modulesPath || "./bin/dist/tns-core-modules-" + modulesPackageConfig.version + ".tgz",
|
modulesPath: args.modulesPath || "./bin/dist/tns-core-modules-" + modulesPackageConfig.version + ".tgz",
|
||||||
emuAvdName: args.emuAvdName,
|
emuAvdName: args.emuAvdName,
|
||||||
outfile: args.outFile || "./TestRunResult.txt",
|
outFile: args.outFile || "./TestRunResult.txt",
|
||||||
frameworkArgument: args.runtimePath ? " --frameworkPath=" + args.runtimePath : "",
|
frameworkArgument: args.runtimePath ? " --frameworkPath=" + args.runtimePath : "",
|
||||||
showEmu: args.showEmu || false,
|
showEmu: args.showEmu || false,
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ module.exports = {
|
|||||||
deployedAppName:"org.nativescript.TestsApp",
|
deployedAppName:"org.nativescript.TestsApp",
|
||||||
mainActivityName:"com.tns.NativeScriptActivity",
|
mainActivityName:"com.tns.NativeScriptActivity",
|
||||||
pathToCompiledTests: "bin/dist/apps/tests",
|
pathToCompiledTests: "bin/dist/apps/tests",
|
||||||
|
simulatorSysLog: pathModule.join(process.env.HOME, "Library/Logs/CoreSimulator", args.emuAvdName, "/system.log"),
|
||||||
platform: args.platform
|
platform: args.platform
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,6 +70,12 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
tempExtractedModules: {
|
tempExtractedModules: {
|
||||||
src: pathModule.join(localCfg.applicationDir, "node_modules", "package")
|
src: pathModule.join(localCfg.applicationDir, "node_modules", "package")
|
||||||
|
},
|
||||||
|
simulatorLog: {
|
||||||
|
src: localCfg.simulatorSysLog,
|
||||||
|
options: {
|
||||||
|
force: true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mkdir: {
|
mkdir: {
|
||||||
@ -134,6 +140,10 @@ module.exports = {
|
|||||||
return newContent;
|
return newContent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
simulatorLog: {
|
||||||
|
src: localCfg.simulatorSysLog,
|
||||||
|
dest: localCfg.outFile
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
exec: {
|
exec: {
|
||||||
@ -163,6 +173,9 @@ module.exports = {
|
|||||||
cmd: "adb install " + localCfg.pathToApk,
|
cmd: "adb install " + localCfg.pathToApk,
|
||||||
cwd: localCfg.applicationDir
|
cwd: localCfg.applicationDir
|
||||||
},
|
},
|
||||||
|
startAndroidEmulator: {
|
||||||
|
cmd: "emulator -avd " + localCfg.emuAvdName + " -no-audio " + (args.showEmu ? "" : "-no-window") + "&"
|
||||||
|
},
|
||||||
startAndroidApp: {
|
startAndroidApp: {
|
||||||
cmd: "adb shell am start -n " + localCfg.deployedAppName + "/" + localCfg.mainActivityName
|
cmd: "adb shell am start -n " + localCfg.deployedAppName + "/" + localCfg.mainActivityName
|
||||||
},
|
},
|
||||||
@ -186,17 +199,22 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
shell: {
|
shell: {
|
||||||
collectAndroidLog: {
|
collectAndroidLog: {
|
||||||
command: "./expect.exp " + localCfg.outfile,
|
command: "./expect.exp " + "'adb logcat' " + localCfg.outFile,
|
||||||
options: {
|
options: {
|
||||||
execOptions: {
|
execOptions: {
|
||||||
maxBuffer: Infinity
|
maxBuffer: Infinity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
startAndroidEmulator: {
|
waitiOSLogCompletion: {
|
||||||
command: "emulator -avd " + localCfg.emuAvdName + " -no-audio " + (args.showEmu ? "" : "-no-window") + "&"
|
command: "./expect.exp " + "'tail -f " + localCfg.simulatorSysLog + "' " + localCfg.outFile,
|
||||||
|
options: {
|
||||||
|
execOptions: {
|
||||||
|
maxBuffer: Infinity
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
startiOSEmulator: {
|
startiOSSimulator: {
|
||||||
command: "xcrun instruments -w " + localCfg.emuAvdName,
|
command: "xcrun instruments -w " + localCfg.emuAvdName,
|
||||||
options: {
|
options: {
|
||||||
failOnError: false
|
failOnError: false
|
||||||
@ -225,38 +243,57 @@ module.exports = {
|
|||||||
return templatedTaskName.replace(/\{platform\}/, localCfg.platform);
|
return templatedTaskName.replace(/\{platform\}/, localCfg.platform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
grunt.registerTask("startEmulatorAndroid", [
|
||||||
|
getPlatformSpecificTask("exec:startAndroidEmulator"),
|
||||||
|
]);
|
||||||
|
|
||||||
|
grunt.registerTask("startEmulatoriOS", [
|
||||||
|
getPlatformSpecificTask("shell:startiOSSimulator"),
|
||||||
|
]);
|
||||||
|
|
||||||
|
grunt.registerTask("collectLogAndroid", [
|
||||||
|
"shell:collectAndroidLog"
|
||||||
|
]);
|
||||||
|
|
||||||
|
grunt.registerTask("collectLogiOS", [
|
||||||
|
"shell:waitiOSLogCompletion",
|
||||||
|
"copy:simulatorLog"
|
||||||
|
]);
|
||||||
|
|
||||||
grunt.registerTask("doPostPlatformAddAndroid", [
|
grunt.registerTask("doPostPlatformAddAndroid", [
|
||||||
"exec:restartAdb"
|
"exec:restartAdb"
|
||||||
]);
|
]);
|
||||||
|
|
||||||
grunt.registerTask("doPostPlatformAddiOS", [
|
grunt.registerTask("doPostPlatformAddiOS", [
|
||||||
|
"clean:simulatorLog"
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
//xcrun instruments -s
|
//xcrun instruments -s
|
||||||
grunt.registerTask("testsapp", [
|
grunt.registerTask("testsapp", [
|
||||||
// "clean:workingDir",
|
"clean:workingDir",
|
||||||
// "mkdir:workingDir",
|
"mkdir:workingDir",
|
||||||
// getPlatformSpecificTask("exec:kill{platform}Emulator"),
|
getPlatformSpecificTask("exec:kill{platform}Emulator"),
|
||||||
// getPlatformSpecificTask("shell:start{platform}Emulator"),
|
getPlatformSpecificTask("startEmulator{platform}"),
|
||||||
//
|
|
||||||
// "exec:createApp",
|
"exec:createApp",
|
||||||
// "clean:originalAppDir",
|
"clean:originalAppDir",
|
||||||
// "copy:testsAppToRunDir",
|
"copy:testsAppToRunDir",
|
||||||
// "clean:modules",
|
"clean:modules",
|
||||||
// "untar:modules",
|
"untar:modules",
|
||||||
// "copy:modulesToDir",
|
"copy:modulesToDir",
|
||||||
// "clean:tempExtractedModules",
|
"clean:tempExtractedModules",
|
||||||
//
|
|
||||||
// "exec:addPlatform",
|
"exec:addPlatform",
|
||||||
// getPlatformSpecificTask("copy:add{platform}Permissions"),
|
getPlatformSpecificTask("copy:add{platform}Permissions"),
|
||||||
// "shell:buildApp",
|
"shell:buildApp",
|
||||||
// getPlatformSpecificTask("doPostPlatformAdd{platform}"),
|
getPlatformSpecificTask("doPostPlatformAdd{platform}"),
|
||||||
|
|
||||||
getPlatformSpecificTask("exec:uninstallExisting{platform}App"),
|
getPlatformSpecificTask("exec:uninstallExisting{platform}App"),
|
||||||
getPlatformSpecificTask("exec:installNew{platform}App"),
|
getPlatformSpecificTask("exec:installNew{platform}App"),
|
||||||
getPlatformSpecificTask("exec:start{platform}App"),
|
getPlatformSpecificTask("exec:start{platform}App"),
|
||||||
// getPlatformSpecificTask("shell:collect{platform}Log"),
|
getPlatformSpecificTask("collectLog{platform}"),
|
||||||
//
|
|
||||||
// getPlatformSpecificTask("exec:kill{platform}Emulator"),
|
// getPlatformSpecificTask("exec:kill{platform}Emulator"),
|
||||||
// "clean:workingDir"
|
// "clean:workingDir"
|
||||||
]);
|
]);
|
||||||
|
@ -8,10 +8,13 @@
|
|||||||
#expect "TypeScript compilation complete"
|
#expect "TypeScript compilation complete"
|
||||||
#send \003
|
#send \003
|
||||||
|
|
||||||
set outfile [lindex $argv 0];
|
|
||||||
|
set cmd [lindex $argv 0];
|
||||||
|
set outfile [lindex $argv 1];
|
||||||
|
|
||||||
set timeout 600
|
set timeout 600
|
||||||
#spawn (adb logcat | tee ./__TESTRESULT__.txt)
|
#spawn (adb logcat | tee ./__TESTRESULT__.txt)
|
||||||
log_file -noappend $outfile
|
log_file -noappend $outfile
|
||||||
spawn adb logcat
|
eval spawn $cmd
|
||||||
expect "=== ALL TESTS COMPLETE ==="
|
expect "=== ALL TESTS COMPLETE ==="
|
||||||
send \003
|
send \003
|
||||||
|
Reference in New Issue
Block a user