aboutsummaryrefslogtreecommitdiff
path: root/python/python_test.go
Commit message (Collapse)AuthorAgeFilesLines
* Precompile python sourcesCole Faust2023-01-271-8/+19
| | | | | | | | | | | This signifigantly improves the startup time of soong-built python binaries. For example, running `m apexer && time out/host/linux-x86/bin/apexer` gives 0.734s before this cl, and 0.094s after. Fixes: 259718110 Test: Presubmits Change-Id: Ib19e83e2c60c39a849525be117279c318de3afa7
* Refactor python rulesCole Faust2023-01-251-9/+3
| | | | | | | | | | | | The goal of this cl is to simplify the python rules, mostly by removing the "decorator" pattern that they currently use, and instead making separate module types for libraries, binaries, and tests that inherit from each other. Bug: 259718110 Test: Verified ninja files are unchanged (they only change in the list of soong sources because I added/deleted files) Change-Id: I1e836e2cc4782c7818f91db7df7895de3b8db7ca
* Add flag to not add top-level modules to PYTHONPATHCole Faust2022-09-231-2/+0
| | | | | | | | | | | | | | stub_template_host.txt added all the top-level modules to the PYTHONPATH, which isn't correct, and caused absl.logging to override the built-in logging module. Removing this also makes it more consistent with python binaries built with embedded_launcher: true. embedded_launcher: true binaries don't add the top-level modules. Fixes: 245583294 Test: m py_dont_add_top_level_dirs_test && out/host/linux-x86/testcases/py_dont_add_top_level_dirs_test/x86_64/py_dont_add_top_level_dirs_test Change-Id: Id3069565d2b2c4b2bda0ff5301e757a7b4201751
* Remove usages of FixtureFactory from misc packagesPaul Duffin2021-03-221-9/+6
| | | | | | | | | These packages have already been migrated to use per test build directory so have no need for a FixtureFactory. Bug: 183235980 Test: m nothing Change-Id: I667d1d992caaf0f615de91f89efdae11c44986c2
* Convert python package to fixturesPaul Duffin2021-03-171-111/+34
| | | | | | Bug: 182885307 Test: m nothing Change-Id: I78506a10f0e6ba8ad4952e8305f47ffd5a33b359
* Fix hole in python testing code that ignored a broken testPaul Duffin2021-03-171-3/+15
| | | | | | | | | | | | | | | | The test running code would only check errors if there were any reported. That ignored the "module with duplicate runfile path" test which was not reporting the expected error. This change corrects that mistake, and then fixes the test which had started to fail. It is possible that the failing test highlights a bug in the python code but if so that will need to be fixed in a follow up bug. Bug: 183046274 Test: m nothing Change-Id: I961b15a452725e7b15ba9d21b4a4a672ba3d004a
* Add comments/refactor for python.goLiz Kammer2020-12-011-2/+2
| | | | | | Test: all soong tests Test: m nothing Change-Id: Ib3b95d7c2831b97026e76a39af515fd51c6cb2c7
* Pass Config to NewTestContext instead of ctx.RegisterColin Cross2020-11-121-2/+2
| | | | | | | | | | | Prepare for using Config when adding singletons by passing Config to NewTestContext and NewContext instead of to ctx.Register. This will enable a followup change to store SingletonMakeVarsProviders registered on the Context in the Config, which is necessary to run multiple tests in parallel without data races. Test: all soong tests Change-Id: Id229629a4e42ff4487d317241673837726c075fc
* Consolidate python version properties in mutatorLiz Kammer2020-11-021-2/+3
| | | | | | Test: m Bug: 165114590 Change-Id: Iaf874f7098317a52827b113167e3dc1ed044e907
* Revert "Make lots of tests run in parallel"Colin Cross2020-10-091-1/+0
| | | | | | | | | | This reverts commit 323dc60712491c71ccdc5363c42df61f0a192487. Reason for revert: Possible cause of test instability Bug: 170513220 Test: soong tests Change-Id: Iee168e9fbb4210569e6cffcc23e60d111403abb8
* Make lots of tests run in parallelColin Cross2020-10-061-0/+1
| | | | | | | | | | Putting t.Parallel() in each test makes them run in parallel. Additional t.Parallel() could be added to each subtest, although that requires making a local copy of the loop variable for table driven tests. Test: m checkbuild Change-Id: I5d9869ead441093f4d7c5757f2447385333a95a4
* Add `data_native_bins` property to java_test_hostLiz Kammer2020-07-271-4/+2
| | | | | | | | | | | | | When multiple os/arch variants are supported, java_test_host could not find a matching arch due to java having arch:common, whereas native binaries support a specific architecture. This change adds the property `data_native_bins` in order to support binaries with the appropriate os/arch variants. Test: m FirmwareDtboVerification with data_native_bins Test: forrest Bug: 153848038 Change-Id: I45adebff0fde2811d5ef5620c697b97b768c951f
* Move filesystem into ConfigColin Cross2019-12-181-22/+30
| | | | | | | | | | | | The filesystem object was available through ModuleContext.Fs(), but gives too much access to the filesystem without enforicing correct dependencies. In order to support sandboxing the soong_build process move the filesystem into the Config. The next change will make it private. Bug: 146437378 Test: all Soong tests Change-Id: I5d3ae9108f120fd335b21efd612aefa078378813
* Make TestContext.RegisterModuleType take an android.ModuleFactoryColin Cross2019-11-251-6/+3
| | | | | | | | Avoid having to pass ModuleFactoryAdaptor to every call to RegisterModuleType in a test by wrapping RegisterModuleType. Test: all soong tests Change-Id: If8847d16487de0479cc3020b728256922b3cadba
* Fix embedded_launcher can't find filesNan Zhang2018-06-041-9/+9
| | | | | | | | | | | The problem came from Python libraries doesn't know the information that we enabled embedded_launcher (only Python binary knows about that). And we can't simply remove runfiles dir for Python libraries since host Python mode need this. Bug: b/80441699 Test: m perf_profo_flames Change-Id: I73ffc4d7504f95a708ae7cca47bc6c15a673aa31
* Add Python protobuf support.Nan Zhang2018-03-221-5/+5
| | | | | | | | Python protobuf std libs will be wrapped in final binary/test par file. Bug: b/70568913 Test: manually create real examples. Change-Id: I7376ec9175f3e03d1adbd20858a7f74e826387ad
* Extract failIfErrored() to android/testing.goLogan Chien2018-03-151-11/+2
| | | | | | Bug: 74506774 Test: lunch aosp_walleye-userdebug && make # runs unit tests Change-Id: I1c09412d5988dca2cc1c5f041893b313ab1c163a
* Remove timestamp based filelist file for tracking Python dependenciesNan Zhang2018-03-091-42/+26
| | | | | | | | | | | Each Python module will generate a zip file containing source & data files. The Python binary will collect all its dependencies and use merge_zips to merge each zip file to create a final .par file. Test: m -j checkbuild && real examples: Bug: b/70568913 Change-Id: I9ff232d461d33e1c06026e7dcb5b124bf02c3ce5
* Let tests override environmentColin Cross2017-10-101-1/+1
| | | | | | | | Pass an environment to TestConfig that will be used for all Config.Getenv calls. Test: none Change-Id: I683cd9c9e0db61c9bfd2adb27fca78f558f225c4
* Add support for python_defaults modulesNan Zhang2017-09-051-5/+35
| | | | | Test: python_test.go Change-Id: I2077414a5b06da5e660a1b48bfdb2eb926fb702f
* <Hermetic> Replace Soong Python bootstrap process with embeddedNan Zhang2017-09-051-16/+12
| | | | | | | | | | | | | | | | | | | | launcher. For Python2, we bundle embedded launcher as bootstrapper within every .par file. This feature is only enabled for linux_x86_64 for now. We provide a user flag: hermetic_enabled within bp file. By default, Pyhon2 still use classic bootstrapping way to construct .par file and relys on host interpreter. Once embedded_launcher is enabled, launcher will be used to bootstrap .par file and execute user program. For Python3, the launcher will be ready soon, and for now it still relys on classic bootstrapping. Test: Real example is used to test. Bug: b/63018041 Change-Id: I28deba413d8ad3af407595e46f77d663e79a3705
* Add integration testing infrastructureColin Cross2017-07-141-23/+8
| | | | | | | | | | | | | | | | | | | | | Fix mutator registration for tests to allow different tests in the same package to register different mutators. Allow tests to track the resulting ModuleBuildParams objects to use in assertions, and provide helpers for getting them. For example: config := android.TestConfig(buildDir) ctx := android.NewTestContext() ctx.RegisterModuleType(...) ctx.MockFileSystem(...) ctx.ParseBlueprintsFile("Android.bp") ctx.PrepareBuildActions(config) ctx.Register() // Get the Inputs value passed to the javac rule for the foo module inputs := ctx.ModuleForTests("foo".Rule("javac").Inputs Test: java_test.go Change-Id: I10c82967f5f3586d2c176f169906b571ed82fc73
* Refactor factoriesColin Cross2017-06-301-2/+4
| | | | | | | | | Change module factories from returning a blueprint.Module and a list of property structs to returning an android.Module, which holds the list of property structs. Test: build.ninja identical except for Factory: comment lines Change-Id: Ica1d823f009db812c518f271a386fbff39c9766f
* Fix the issue that /tmp/soong_python_test* isn't being removed.Nan Zhang2017-06-121-3/+3
| | | | | | Bug: 62499851 Test: go test Change-Id: I84bd66cd1410dd9fc6add3ba5626d8ec4fe702d7
* Add python_test_host module.Nan Zhang2017-05-171-1/+1
| | | | | | bug: 31676493 Test: created py_test modules in real folder. and ran 'mma'. Change-Id: I22aa2fad74b11e4a31ea7a4c4a4f0ea64cd3fc94
* Supported python build in host side.Nan Zhang2017-05-051-0/+456
The base module handles all the common functionalites, such as version compatibilty check, version variations split, source file format check, source/data file duplicate check. The library/binary module focuses on how to generate binary build actions, such as setting up stub script, zipping, filling in __init__.py in runfiles dir tree. Bug: b/31676493 Test: go test under python package Change-Id: I06608369f350f7195873d459e1c8d1bdb811e77e