How to run VtsHalWifiSupplicantV1_0Target test case - android

When I ran "run vts -m VtsHalWifiSupplicantV1_0Target", I get 0 result from it.
vts-tf > run vts -m VtsHalWifiSupplicantV1_0Target
...
10-15 09:56:06 I/ResultReporter: Invocation finished in 48s. PASSED: 0, FAILED: 0, MODULES: 2 of 2
Do I need to write some code to run the vts test case?
I expected to get something passed or failed. How can I get results?
Thanks in advance.

There are at least two reasons why a VTS test run would have that result.
The HAL Testability Checker decided to skip the test. This could be because the HAL you want to test is not running on the target or you try to run an x86 test on an x64 platform.
vts-tradefed will call the test binary with the --gtest_list_tests option in order to get the amount of tests. If this call fails vts-tradefed will assume you have zero test cases.
In any case you can get more information by checking the host logs.
zcat $ANDROID_HOST_OUT/vts/android-vts/logs/latest/inv_*/host_log*.txt.gz | less

Related

Re-run failed android tests

Is there a way to run only the failed set of tests on Android using Gradle?
At the moment, I run my tests as follows.
./gradle connectedDebugAndroidTest
There are tests that occasionally fail due to environment issues which are difficult to control and what I would like to do is be able to only run those failed tests and merge the result with the previous test results.
So for example, if I have 100 tests and 90 succeed, I would like to re-run the failing 10 tests. If those 10 pass the second time around, I would like to merge those results with the original test run.
It looks like this has been discussed several times for Gradle but there doesn't seem to be a solution yet.
https://github.com/gradle/gradle/issues/4068
https://github.com/gradle/gradle/issues/4450
https://github.com/gradle/gradle/issues/1283
Thanks!
The reason they don't have a way to only rerun failed tests is because it screws up the way Gradle currently works. This happens because on the first run, Gradle knows 90 tests passed. If you update the code, and then rerun only the 10 failed tests (using this new option you want them to add), then Gradle would think that all the tests have passed. However, this isn't the case because the tests which previously passed might've broken from the update which fixed the failing tests.
Despite this, the problem has been solved. Gradle reruns failed tests first, and provides a --fail-fast flag for the test task. This effectively does what you want (i.e., only reruns failed tests).
If you want to automatically rerun failed tests as part of the same build in which they failed, and succeed the build if they succeed on retry, you can use the Test Retry Gradle plugin. This will rerun each failed test a certain number of times, with the option of failing the build if too many failures have occurred overall.
plugins {
id 'org.gradle.test-retry' version '1.2.0'
}
test {
retry {
maxRetries = 3
maxFailures = 20 // Optional attribute
}
}

CircleCi doesn't see my test

Why Circleci doesn't see my test?
I have test called MyAppTest.java. But when I run build on circleci it only shows the following results:
Your build ran 2 tests in testDebugUnitTest, testReleaseUnitTest with 0 failures
Slowest test: com.myapp.android.ExampleUnitTest addition_isCorrect (took 0.00 seconds).
Why it doesn't show result for MyAppTest?
The reason for this that configuration of my config.yml file was only for Unit tests. In the end I've found proper configuration for Instrumentation tests, but still faced error of not enough memory.

How to run only a test suite with the connectedAndroidTest command

I am having problems with timeouts running my UI tests in circle ci since the command connectedAndroidTest is taking more than 10 minutes to run.
So I am trying to split them into test suits and run each suite at a time.
I found how to create suites for my android tests here: https://developer.android.com/reference/junit/framework/TestSuite.html
But I can't find how to run them with the connectedAndroidTest command.
I have not found any way to execute the TestSuite, but I found two other options to solve my timeout problems with the circle ci tests:
Run tests by package:
./gradlew app:connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.package=<package>
Run tests by type:
./gradlew connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.size=<small|medium|large>
You need to add #SmallTest, #MediumTest, #LargeTest to your test classes or methods to split them into the groups and avoid hitting a timeout.
Another option that I found was to change the timeout of the command:
- ./gradlew app:connectedCheck -PdisablePreDex:
timeout: 1800
To add to #jonathanrz answer:
Run tests by class:
./gradlew app:connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.class= com.example.app.MyTestClass
Run tests by method:
./gradlew app:connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.class= com.example.app.MyTestClass#myTestMethod
Btw: You can add further arguments to your tests by adding:
-Pandroid.testInstrumentationRunnerArguments.foo="My\ Extra\ Info
Just note how you have to escape spaces here if they exist

executing static program from android init.rc

I want to start a custom program in the init process. I compiled this program statically that run fine from my booted up android stock ROM.
From the android init.rc docs I read that the exec command is what I need.
BTW all I can see in dmesg is that my program exit with code -1 (I can't return that).
init.rc snippet:
on post-fs-data
write /dev/kmsg "launching test"
exec /data/test
All I see in dmesg is this:
<4>[ 6.336816] launching test
<6>[ 6.336902] init: command 'write' r=0
<6>[ 6.337115] init: command 'exec' r=-1
Here you are the executable source code: http://pastebin.com/Hym1APWx
UPDATE
I tried to statically compile and run this program:
int main(){return 0; }
But the result is always command 'exec' r=-1. Maybe user uselen are right, maybe I cannot run executables from /data in the early-boot phase.
As christian said, it looks like exec isn't even implemented. I'm beginning to think that a lot of features documented for init.rc aren't implemented. Here's a way you can get your program to launch however.
Instead of running this as an "exec" command, set this up as a service instead.
In your init.rc, or another file included by it:
service my_service /data/test
class main
oneshot
If it's in class main, and not disabled, it should run after /data is mounted.
I had the same issue today. In my case the solution was simple: The exec function wasn't implemented yet and contained just a return -1. You should take a look at builtin.c and search for do_exec(). This code is executed when init.rc contains an exec statement.

cts execution stopped half-way

I am trying to execute 2.2 test suite, until this point it stopped with the following error:
......
android.content.res.cts.ResourcesTest#testGetAssets...(pass)
android.content.res.cts.ResourcesTest#testGetSystem...(pass)
android.content.res.cts.ResourcesTest#testGetLayout...(pass)
android.content.res.cts.ResourcesTest#testGetBoolean...(pass)
android.content.res.cts.ResourcesTest#testgetFraction...(pass)
android.content.res.cts.ResourcesTest#testParseBundleExtras...(pass)
CTS_INFO >>> Max ADB operations
reached. Restarting ADB...
CTS_INFO >>> Restarting device ...
04:09:28 E/DeviceMonitor: Sending jdwp
tracking request failed!
Device(BABABEEFBABABEEF) disconnected
Test stopped.
I check the result testResult.xml it shows a number of tests not yet executed:
Tests Passed 652
Tests Failed 10 Tests
Timed out 64
Tests Not Executed 23114
What is the reason the test stopped half way like this?
Try setting maxTestCount to 0 in your host_config.xml, as suggested in this post.

Categories

Resources