Viresh Kumar
91778ed009
i2c: Remove unused mem field
...
Removed the unused `mem` field.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2021-11-08 09:30:22 +05:30
Jiang Liu
f7c632020b
Merge pull request #53 from vireshk/i2c/fix-funcs-helper
...
I2c/fix funcs helper
2021-11-02 18:46:17 +08:00
Viresh Kumar
53283d78d7
Merge branch 'main' into i2c/fix-funcs-helper
2021-11-02 10:21:26 +05:30
dependabot[bot]
9cb776f199
build(deps): bump rust-vmm-ci from 7931077 to b037be3
...
Bumps [rust-vmm-ci](https://github.com/rust-vmm/rust-vmm-ci ) from `7931077` to `b037be3`.
- [Release notes](https://github.com/rust-vmm/rust-vmm-ci/releases )
- [Commits](7931077cdc...b037be3396 )
---
updated-dependencies:
- dependency-name: rust-vmm-ci
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-11-01 10:45:12 +02:00
Viresh Kumar
ef52e69bff
[i2c] Remove the "func" argument from funcs()
...
The funcs() implementation is buggy as it doesn't take "func" by
reference and it only defaults to SMBUS and hence the I2C protocol is
never chosen as a function.
Since the value of "func" is never required to be set by the caller, it
shouldn't be passed as argument in the first place. Make the function
return Result<u64> instead.
The test test_funcs() was failing before this change and passes after
it.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2021-10-28 11:32:17 +05:30
Viresh Kumar
e28f3af61b
[i2c] Add a test to check the working of funcs()
...
The funcs() implementation is buggy as it doesn't take "func" by
reference and it only defaults to SMBUS and hence the I2C protocol is
never chosen as a function.
This test fails currently.
Suggested-by: Andreea Florescu <fandree@amazon.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2021-10-27 14:18:14 +05:30
Jiang Liu
91d84b481e
Merge pull request #48 from vireshk/i2c/errors
...
I2c/errors
2021-10-27 16:03:39 +08:00
Viresh Kumar
79a84972f5
[i2c] Update coverage score and Cargo.lock
...
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2021-10-27 12:38:09 +05:30
Viresh Kumar
16a028f35d
[i2c] Avoid using expect()
...
Be consistent with the use of expect() and unwrap() and use only one of
them, if required. Also add a comment on why usage of unwrap() is safe
in main().
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2021-10-27 12:36:57 +05:30
Viresh Kumar
d021564ba3
[i2c] Improve tests by matching error number
...
Improve tests by matching the expected error number.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2021-10-26 16:28:38 +05:30
Viresh Kumar
ca5e7e02dd
[i2c] Unify Error types
...
The crate uses lots of ways to report errors, unify them and use a
separate Error enum type for each file. This will also help us improve
the test code later on.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2021-10-26 16:28:38 +05:30
Viresh Kumar
e62e27aead
[i2c] Use log crate helpers instead of println!()
...
Use info! and warn! instead of println!.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2021-10-26 15:07:17 +05:30
Viresh Kumar
60d29f98f4
Merge pull request #52 from andreeaflorescu/testing_i2c
...
update I2cAdapter to allow setting a mock device
2021-10-26 13:07:01 +05:30
Andreea Florescu
57b96aa3a3
update I2cAdapter to allow setting a mock device
...
Before the constructor of this function was opening the device
corresponding to the passed path. This did not allow for properly
mocking the device functionality. Now the device is passed as a
parameter instead, which allows us to tweak what the device returns for
ioctl calls, and we can thus test multiple scenarios.
Signed-off-by: Andreea Florescu <fandree@amazon.com>
2021-10-26 10:27:58 +03:00
Vincent Whitchurch
27a19cfe67
[i2c] Copy from correct result buffer
...
Copy the read data from the correct result buffer, otherwise
this results in incorrect data and/or memory overwrites in the
guest memory.
Signed-off-by: Vincent Whitchurch <vincent@whitchurch.se>
2021-10-26 08:54:58 +03:00
Viresh Kumar
6e585e9192
Merge pull request #46 from rust-vmm/dependabot/cargo/proc-macro2-1.0.30
...
build(deps): bump proc-macro2 from 1.0.29 to 1.0.30
2021-10-18 12:32:30 +05:30
Viresh Kumar
aaecfda574
Merge branch 'main' into dependabot/cargo/proc-macro2-1.0.30
2021-10-18 12:16:13 +05:30
Viresh Kumar
3f22be50bd
Merge pull request #44 from rust-vmm/dependabot/cargo/clap_derive-3.0.0-beta.5
...
build(deps): bump clap_derive from 3.0.0-beta.4 to 3.0.0-beta.5
2021-10-18 12:16:04 +05:30
Viresh Kumar
f1a3d6eeb8
Merge branch 'main' into dependabot/cargo/proc-macro2-1.0.30
2021-10-18 12:13:15 +05:30
Viresh Kumar
16c88c60ce
Merge branch 'main' into dependabot/cargo/clap_derive-3.0.0-beta.5
2021-10-18 12:09:45 +05:30
Laura Loghin
38350e9f0d
Merge pull request #43 from rust-vmm/dependabot/submodules/rust-vmm-ci-7931077
...
build(deps): bump rust-vmm-ci from `68d4dbf` to `7931077`
2021-10-18 09:35:18 +03:00
dependabot[bot]
130c2d2abe
build(deps): bump proc-macro2 from 1.0.29 to 1.0.30
...
Bumps [proc-macro2](https://github.com/alexcrichton/proc-macro2 ) from 1.0.29 to 1.0.30.
- [Release notes](https://github.com/alexcrichton/proc-macro2/releases )
- [Commits](https://github.com/alexcrichton/proc-macro2/compare/1.0.29...1.0.30 )
---
updated-dependencies:
- dependency-name: proc-macro2
dependency-type: indirect
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-10-18 04:08:11 +00:00
dependabot[bot]
269dc3a1f3
build(deps): bump clap_derive from 3.0.0-beta.4 to 3.0.0-beta.5
...
Bumps [clap_derive](https://github.com/clap-rs/clap ) from 3.0.0-beta.4 to 3.0.0-beta.5.
- [Release notes](https://github.com/clap-rs/clap/releases )
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md )
- [Commits](https://github.com/clap-rs/clap/commits )
---
updated-dependencies:
- dependency-name: clap_derive
dependency-type: indirect
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-10-18 04:07:53 +00:00
dependabot[bot]
aa41d51b52
build(deps): bump rust-vmm-ci from 68d4dbf to 7931077
...
Bumps [rust-vmm-ci](https://github.com/rust-vmm/rust-vmm-ci ) from `68d4dbf` to `7931077`.
- [Release notes](https://github.com/rust-vmm/rust-vmm-ci/releases )
- [Commits](68d4dbf85c...7931077cdc )
---
updated-dependencies:
- dependency-name: rust-vmm-ci
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-10-18 04:07:12 +00:00
Viresh Kumar
987e513b63
Merge pull request #37 from rust-vmm/dependabot/submodules/rust-vmm-ci-68d4dbf
...
build(deps): bump rust-vmm-ci from `7f22582` to `68d4dbf`
2021-10-13 22:28:05 +05:30
Viresh Kumar
be0f094f03
Merge branch 'main' into dependabot/submodules/rust-vmm-ci-68d4dbf
2021-10-13 20:18:46 +05:30
Viresh Kumar
395e37bd51
Merge pull request #35 from rust-vmm/dependabot/cargo/vhost-0.2
...
build(deps): update vhost requirement from 0.1 to 0.2
2021-10-13 20:18:24 +05:30
Andreea Florescu
9fc24f7ea2
Merge branch 'main' into dependabot/cargo/vhost-0.2
2021-10-13 17:15:02 +03:00
Andreea Florescu
027c02bc11
Merge branch 'main' into dependabot/submodules/rust-vmm-ci-68d4dbf
2021-10-13 17:14:34 +03:00
dependabot[bot]
5b31a96a9c
build(deps): bump quote from 1.0.9 to 1.0.10
...
Bumps [quote](https://github.com/dtolnay/quote ) from 1.0.9 to 1.0.10.
- [Release notes](https://github.com/dtolnay/quote/releases )
- [Commits](https://github.com/dtolnay/quote/compare/1.0.9...1.0.10 )
---
updated-dependencies:
- dependency-name: quote
dependency-type: indirect
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-10-13 17:14:22 +03:00
Viresh Kumar
ed3315afc5
[i2c] Fix build errors
...
Update version of vhost-user-backend and vmm-sys-util to fix the build
errors.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2021-10-11 12:07:01 +05:30
Viresh Kumar
b7b5d3e6e0
Merge branch 'main' into dependabot/cargo/vhost-0.2
2021-10-11 11:38:19 +05:30
Viresh Kumar
d5a83471d0
Merge branch 'main' into dependabot/submodules/rust-vmm-ci-68d4dbf
2021-10-11 11:37:31 +05:30
Viresh Kumar
7ef1841c92
Merge pull request #38 from rust-vmm/dependabot/cargo/libc-0.2.103
...
build(deps): bump libc from 0.2.102 to 0.2.103
2021-10-11 11:37:17 +05:30
dependabot[bot]
880b448b78
build(deps): bump rust-vmm-ci from 7f22582 to 68d4dbf
...
Bumps [rust-vmm-ci](https://github.com/rust-vmm/rust-vmm-ci ) from `7f22582` to `68d4dbf`.
- [Release notes](https://github.com/rust-vmm/rust-vmm-ci/releases )
- [Commits](7f22582590...68d4dbf85c )
---
updated-dependencies:
- dependency-name: rust-vmm-ci
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-10-11 06:00:13 +00:00
Viresh Kumar
6bab5b5eba
Merge branch 'main' into dependabot/cargo/libc-0.2.103
2021-10-11 11:29:53 +05:30
Viresh Kumar
96b1cbe557
Merge pull request #39 from rust-vmm/dependabot/cargo/syn-1.0.80
...
build(deps): bump syn from 1.0.76 to 1.0.80
2021-10-11 11:29:34 +05:30
dependabot[bot]
1f9fdcc1a1
build(deps): bump syn from 1.0.76 to 1.0.80
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.76 to 1.0.80.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.76...1.0.80 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: indirect
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-10-11 04:06:25 +00:00
dependabot[bot]
3e9efe05cd
build(deps): bump libc from 0.2.102 to 0.2.103
...
Bumps [libc](https://github.com/rust-lang/libc ) from 0.2.102 to 0.2.103.
- [Release notes](https://github.com/rust-lang/libc/releases )
- [Commits](https://github.com/rust-lang/libc/compare/0.2.102...0.2.103 )
---
updated-dependencies:
- dependency-name: libc
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-10-11 04:06:19 +00:00
Viresh Kumar
8028571d0a
[i2c] Update coverage score
...
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2021-10-08 14:29:15 +03:00
Viresh Kumar
5cf0b83820
[i2c] Socket count should be greater than 0
...
Fail early if socket_count is set to 0.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2021-10-08 14:29:15 +03:00
Viresh Kumar
726a056254
[i2c] Cleanup tests around socket_count argument
...
The socket count argument is optional and defaults to 1, but the tests
written for it were more C like and weren't so clean. Use Option to
improve upon that.
While at it, fix socket names as well. Socket name is name of a socket
and shouldn't be used as test-name. Fix the TODOs as well.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2021-10-08 14:29:15 +03:00
dependabot[bot]
e588360079
build(deps): bump rust-vmm-ci from ae7db2d to 7f22582
...
Bumps [rust-vmm-ci](https://github.com/rust-vmm/rust-vmm-ci ) from `ae7db2d` to `7f22582`.
- [Release notes](https://github.com/rust-vmm/rust-vmm-ci/releases )
- [Commits](ae7db2d98a...7f22582590 )
---
updated-dependencies:
- dependency-name: rust-vmm-ci
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-10-08 09:24:21 +03:00
Viresh Kumar
219419af2e
Merge branch 'main' into dependabot/cargo/vhost-0.2
2021-10-07 15:28:28 +05:30
Viresh Kumar
a2e55a91e9
Merge pull request #28 from rust-vmm/refactor_for_testing
...
[i2c] Refactoring for improved testing & separation of concerns
2021-10-07 15:28:01 +05:30
Viresh Kumar
bf59120d50
[i2c] update coverage score
...
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2021-10-06 16:57:06 +05:30
Viresh Kumar
88d62dd2ab
[i2c] Shuffle code around
...
This moves the code around to keep structures together with their
implementations, and also keep all configuration stuff to main.c itself.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2021-10-06 16:57:06 +05:30
Viresh Kumar
c9e88b69ab
[i2c] Remove read_func()
...
It still doesn't look correct to keep a separate routine for this, which
can be called by others.
Merge it with new() itself.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2021-10-06 16:57:06 +05:30
dependabot[bot]
c27d308f56
build(deps): update vhost requirement from 0.1 to 0.2
...
Updates the requirements on [vhost](https://github.com/rust-vmm/vhost ) to permit the latest version.
- [Release notes](https://github.com/rust-vmm/vhost/releases )
- [Changelog](https://github.com/rust-vmm/vhost/blob/main/CHANGELOG.md )
- [Commits](https://github.com/rust-vmm/vhost/compare/v0.1.0...v0.2.0 )
---
updated-dependencies:
- dependency-name: vhost
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-09-27 04:05:35 +00:00
Andreea Florescu
32b9d1a2a2
[i2c] update coverage score
...
Coverage is now increased by ~9%. Further tests should be relatively
straightforward to write by using the mock structure `DummyDevice`.
Signed-off-by: Andreea Florescu <fandree@amazon.com>
2021-09-23 18:31:39 +03:00