TheSoftwareDesignLab/MutAPK

No APK file geneated with the test apk

Closed this issue · 3 comments

jwlin commented

Hi, I am trying this tool, but can not generate mutants even with the included test app.

I moved ./test/apk/com.evancharlton.mileage_3110.apk to ./apk, and ./test/parameter.json to ./, and used parameter.json as follows:

{
    "apkPath": "./apk/com.evancharlton.mileage_3110.apk",
    "appName": "com.evancharlton.mileage",
    "mutantsFolder": "./mutants", 
    "operatorsDir": "./",
    "multithreadExec": "true",
    "ignoreDeadCode": "true",
    "extraPath": "./extra",
    "selectionStrategy": "amountMutants",
    "selectionParameters":{
        "amountMutants":"34",
        "perOperator":"false",
        "confidenceLevel":"85",
        "marginError":"10",
        "baseAPKPath":"./"
    }   
}

After executing java -jar target/MutAPK-2.0.0.jar ./parameters.json, mutant folders were generated at both the top level and under ./mutant, as follows:

junwei@pop-os:~/MutAPK$ tree -L 1
.
├── apk
├── commands.txt
├── dependency-reduced-pom.xml
├── docs
├── extra
├── LICENSE
├── mutants
├── mutantscom.evancharlton.mileage-mutant1
├── mutantscom.evancharlton.mileage-mutant10
├── mutantscom.evancharlton.mileage-mutant11
├── mutantscom.evancharlton.mileage-mutant12
├── mutantscom.evancharlton.mileage-mutant13
├── mutantscom.evancharlton.mileage-mutant14
├── mutantscom.evancharlton.mileage-mutant15
├── mutantscom.evancharlton.mileage-mutant16
├── mutantscom.evancharlton.mileage-mutant17
├── mutantscom.evancharlton.mileage-mutant18
├── mutantscom.evancharlton.mileage-mutant19
├── mutantscom.evancharlton.mileage-mutant2
├── mutantscom.evancharlton.mileage-mutant20
├── mutantscom.evancharlton.mileage-mutant21
├── mutantscom.evancharlton.mileage-mutant23
├── mutantscom.evancharlton.mileage-mutant24
├── mutantscom.evancharlton.mileage-mutant25
├── mutantscom.evancharlton.mileage-mutant26
├── mutantscom.evancharlton.mileage-mutant27
├── mutantscom.evancharlton.mileage-mutant28
├── mutantscom.evancharlton.mileage-mutant29
├── mutantscom.evancharlton.mileage-mutant3
├── mutantscom.evancharlton.mileage-mutant30
├── mutantscom.evancharlton.mileage-mutant31
├── mutantscom.evancharlton.mileage-mutant32
├── mutantscom.evancharlton.mileage-mutant33
├── mutantscom.evancharlton.mileage-mutant34
├── mutantscom.evancharlton.mileage-mutant4
├── mutantscom.evancharlton.mileage-mutant5
├── mutantscom.evancharlton.mileage-mutant6
├── mutantscom.evancharlton.mileage-mutant7
├── mutantscom.evancharlton.mileage-mutant8
├── mutantscom.evancharlton.mileage-mutant9
├── operators.properties
├── parameters.json
├── pom.xml
├── README.md
├── src
├── target
├── temp
└── test

junwei@pop-os:~/MutAPK$ tree -L 1 mutants

mutants
├── com.evancharlton.mileage-locations.json
├── com.evancharlton.mileage-mutant1
├── com.evancharlton.mileage-mutant10
├── com.evancharlton.mileage-mutant11
├── com.evancharlton.mileage-mutant12
├── com.evancharlton.mileage-mutant13
├── com.evancharlton.mileage-mutant14
├── com.evancharlton.mileage-mutant15
├── com.evancharlton.mileage-mutant16
├── com.evancharlton.mileage-mutant17
├── com.evancharlton.mileage-mutant18
├── com.evancharlton.mileage-mutant19
├── com.evancharlton.mileage-mutant2
├── com.evancharlton.mileage-mutant20
├── com.evancharlton.mileage-mutant21
├── com.evancharlton.mileage-mutant22
├── com.evancharlton.mileage-mutant23
├── com.evancharlton.mileage-mutant24
├── com.evancharlton.mileage-mutant25
├── com.evancharlton.mileage-mutant26
├── com.evancharlton.mileage-mutant27
├── com.evancharlton.mileage-mutant28
├── com.evancharlton.mileage-mutant29
├── com.evancharlton.mileage-mutant3
├── com.evancharlton.mileage-mutant30
├── com.evancharlton.mileage-mutant31
├── com.evancharlton.mileage-mutant32
├── com.evancharlton.mileage-mutant33
├── com.evancharlton.mileage-mutant34
├── com.evancharlton.mileage-mutant4
├── com.evancharlton.mileage-mutant5
├── com.evancharlton.mileage-mutant6
├── com.evancharlton.mileage-mutant7
├── com.evancharlton.mileage-mutant8
├── com.evancharlton.mileage-mutant9
├── com.evancharlton.mileage-mutants.log
└── com.evancharlton.mileage-times.csv

And no apk was found in these folders (all generation attempts failed).
Here is the execution log: https://drive.google.com/file/d/1dVWUQlVL33WJ_YnEJBvw6s1NLD723OmZ/view?usp=sharing
I am using Ubuntu 20.04 with openJDK 8

Any hint to make this tool work is appreciated.

Hi @jwlin,

To be honest i have never seen this behaviour, I am creating right now a virtual machine to try to replicate it.

Can you please run the following command from the root folder:
java -jar ./extra/apktool.jar b ./mutants/com.evancharlton.mileage-mutant1 -o ./mutants/com.evancharlton.mileage-mutant1/output.apk

Meanwhile, a few options:

  1. Could you try to run again the tool but adding a / at the end of the mutants path ... "mutantsFolder": "./mutants/",
  2. Can you please try copying the MutAPK-2.0.0.jar to the root of the folder, to be at the same level of the other configuration files.
  3. Another oprtion would be to copy the jar to the test folder and try to use the files just as found in the test folder
jwlin commented

Thank you @caev03, it works after I add a slash to mutantsFolder, as "mutantsFolder": "./mutants/"

Another question I have is that when I run the tool, it threw an error message like this:
(I set "multithreadExec": "false" to observe the execution)

...
Creating folder for mutant 22
Copying app information into mutant 22 folder
Mutant: 22 - Type: INVALID_ACTIVITY_PATH
java.io.FileNotFoundException: ./mutants/com.evancharlton.mileage-mutant1/src/AndroidManifest.xml (No such file or directory)
	at java.io.FileInputStream.open0(Native Method)
	at java.io.FileInputStream.open(FileInputStream.java:195)
	at java.io.FileInputStream.<init>(FileInputStream.java:138)
	at java.io.FileInputStream.<init>(FileInputStream.java:93)
	at java.io.FileReader.<init>(FileReader.java:58)
	at edu.uniandes.tsdl.mutapk.helper.FileHelper.readLines(FileHelper.java:17)
	at edu.uniandes.tsdl.mutapk.operators.activity.InvalidActivityName.performMutation(InvalidActivityName.java:20)
	at edu.uniandes.tsdl.mutapk.processors.MutationsProcessor.process(MutationsProcessor.java:85)
	at edu.uniandes.tsdl.mutapk.MutAPK.runMutAPK(MutAPK.java:260)
	at edu.uniandes.tsdl.mutapk.MutAPK.main(MutAPK.java:84)
./mutants/com.evancharlton.mileage-mutant1/src/AndroidManifest.xml (No such file or directory)
Creating folder for mutant 22
Copying app information into mutant 22 folder
Mutant: 22 - Type: INVALID_ACTIVITY_PATH
Mutant 22 has survived the mutation process. Now its source code has been modified.
22 HashCode: 817900947
Building mutant 22...
Signing mutant 22...
SUCCESS: The 22 mutant APK has been generated.
...

But it seems not affecting the successful generation of mutant 22, and I can still see the generated apk.

I do not know if you still want to know the answer to the part of the message you edited, but actually when we were testing MutAPK we found that around 0.04% of the mutants would not be created due to compilation problems. However, from the way i see your results, maybe those mutants that were marked as compiled and do not have APK is either because it were redundants or equivalents.

We have an article on the new version of MutAPK with this new features ... https://dl.acm.org/doi/abs/10.1145/3368089.3417942