Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android instrumentation test fails with error when running cp command with --sparse option #9452

Closed
anuchandy opened this issue Oct 1, 2019 · 3 comments

Comments

@anuchandy
Copy link

Description of the problem / feature request:

I'm trying to run instrumentation test with following command:

sudo bazel test //contoso-common/src/androidTest/java/com/contoso/common:contoso_common_lib_instrumentation_test  --config=local_device --incompatible_disable_deprecated_attr_params=false --incompatible_new_actions_api=false --host_force_python=PY2 --incompatible_use_python_toolchains

This fails with error:

I0930 22:54:57.709556 4641457600 emulated_device.py:568] Copying system image to /tmp/tmpoT_o1Eandroid-emulator-launch/images/session/system.img
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
       cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
Traceback (most recent call last):
  File "/private/var/tmp/_bazel_root/d8eefdf365bbaca7dd3d4815f054878e/sandbox/darwin-sandbox/332/execroot/__main__/bazel-out/host/bin/external/android_test_support/tools/android/emulator/unified_launcher_head.runfiles/android_test_support/tools/android/emulator/unified_launcher.py", line 1129, in <module>
    app.run(main)
  File "/private/var/tmp/_bazel_root/d8eefdf365bbaca7dd3d4815f054878e/sandbox/darwin-sandbox/332/execroot/__main__/bazel-out/host/bin/external/android_test_support/tools/android/emulator/unified_launcher_head.runfiles/absl_py/absl/app.py", line 262, in run
    _run_main(main, argv)
  File "/private/var/tmp/_bazel_root/d8eefdf365bbaca7dd3d4815f054878e/sandbox/darwin-sandbox/332/execroot/__main__/bazel-out/host/bin/external/android_test_support/tools/android/emulator/unified_launcher_head.runfiles/absl_py/absl/app.py", line 227, in _run_main
    sys.exit(main(argv))
  File "/private/var/tmp/_bazel_root/d8eefdf365bbaca7dd3d4815f054878e/sandbox/darwin-sandbox/332/execroot/__main__/bazel-out/host/bin/external/android_test_support/tools/android/emulator/unified_launcher_head.runfiles/android_test_support/tools/android/emulator/unified_launcher.py", line 1099, in main
    EntryPoint(reporter)
  File "/private/var/tmp/_bazel_root/d8eefdf365bbaca7dd3d4815f054878e/sandbox/darwin-sandbox/332/execroot/__main__/bazel-out/host/bin/external/android_test_support/tools/android/emulator/unified_launcher_head.runfiles/android_test_support/tools/android/emulator/unified_launcher.py", line 920, in EntryPoint
    mini_boot)
  File "/private/var/tmp/_bazel_root/d8eefdf365bbaca7dd3d4815f054878e/sandbox/darwin-sandbox/332/execroot/__main__/bazel-out/host/bin/external/android_test_support/tools/android/emulator/unified_launcher_head.runfiles/android_test_support/tools/android/emulator/unified_launcher.py", line 367, in _FirstBootAtBuildTimeOnly
    modified_ramdisk_path=modified_ramdisk_path)
  File "/private/var/tmp/_bazel_root/d8eefdf365bbaca7dd3d4815f054878e/sandbox/darwin-sandbox/332/execroot/__main__/bazel-out/host/bin/external/android_test_support/tools/android/emulator/unified_launcher_head.runfiles/android_test_support/tools/android/emulator/emulated_device.py", line 1260, in StartDevice
    **images_dict)
  File "/private/var/tmp/_bazel_root/d8eefdf365bbaca7dd3d4815f054878e/sandbox/darwin-sandbox/332/execroot/__main__/bazel-out/host/bin/external/android_test_support/tools/android/emulator/unified_launcher_head.runfiles/android_test_support/tools/android/emulator/emulated_device.py", line 570, in _StageDataFiles
    self._SparseCp(self._InitSystemFile(), self._SystemFile())
  File "/private/var/tmp/_bazel_root/d8eefdf365bbaca7dd3d4815f054878e/sandbox/darwin-sandbox/332/execroot/__main__/bazel-out/host/bin/external/android_test_support/tools/android/emulator/unified_launcher_head.runfiles/android_test_support/tools/android/emulator/emulated_device.py", line 514, in _SparseCp
    ['cp', '--sparse=always', '--dereference', src, dst])
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cp', '--sparse=always', '--dereference', '/tmp/tmpoT_o1Eandroid-emulator-launch/images/init/system.img', '/tmp/tmpoT_o1Eandroid-emulator-launch/images/session/system.img']' returned non-zero exit status 64
----------------

I'm using Mac and the cp command does not have --sparse option.

What operating system are you running Bazel on?

macOS Mojave

What's the output of bazel info release?

release 0.29.1

@jin
Copy link
Member

jin commented Oct 1, 2019

android_instrumentation_test isn't supported on macOS.

Closing as dupe of #7069

@jinchizhou
Copy link

@jin what exactly isn't working in android_instrumentation_test? We're deciding if it is a better idea to use your composer_instrumentation_test or fix android_instrumentation_test.

@jin
Copy link
Member

jin commented Jul 19, 2020

Mostly the test runner (dexdump is compiled for linux only, with no plans to make it multiplatform), and the emulator infrastructure (unified_launcher).

For now, please consider alternatives like my experimental rules or you'd have to roll your own.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants