1

My Project runs C++ test cases on Android devices. An exectuable gets generated and along with that, couple of shared object files also gets copied over to the device and the executable is then run. Till now, all those data were being copied over to /data/local/tmp folder. After the test cases are run, the content from /data/local/tmp is deleted using adb shell command. With Pixel 2 devices, I am able to copy the exe and shared object files to the tmp folder, but unable to delete them once the test cases are completed. I tried using /data/local/temp folder, but I am unable to push files to that folder. Tried using /sdcard but it does not allow the exe files to be executed. I am clueless as to which specific directory I should be using to run my native test cases on Pixel 2 devices. Does anyone has any pointers? Please help.

learn_develop
  • 1,735
  • 4
  • 15
  • 33

1 Answers1

1

if you create files from adb, uid:gid is set to 2000:2000 and permissions of /data/local/tmp is 0771, this means you always can remove your own files. There is no other location for this, you must have messed with permissions

adb shell
touch /data/local/tmp/my-file
ls -an /data/local/tmp
rm /data/local/tmp/my-file
alecxs
  • 701
  • 8
  • 17
  • We have several Pixel 2 devices connected to CI servers and this issue seems to happen on all the Pixel 2 devices, along with the one I own. Other devices, it seems to work fine. – learn_develop Apr 23 '19 at 05:10
  • is it related to adb install? what is output of above test? – alecxs Apr 23 '19 at 07:28
  • The above command seems to work fine. My command that seems to fail is `adb_shell ${SERIAL_NUMBER} "rm -rf /data/local/tmp"`. I think I should create a new folder there and push all the files and it should work. I will try that out and post updates here. – learn_develop Apr 23 '19 at 12:25
  • you can use `find /data/local/tmp -mindepth 1 -delete` but you can not delete the folder itself – alecxs Apr 23 '19 at 14:23