1
0
Fork 0
mirror of https://github.com/containers/youki synced 2024-05-11 10:06:15 +02:00

Compare commits

...

4 Commits

Author SHA1 Message Date
Om Prakaash 6ddb12bcc0
Merge 44e7b59fc3 into cd9bfd8d79 2024-04-24 09:13:32 -07:00
dependabot[bot] cd9bfd8d79
Bump wasmtime and wasi-common from 19.0.2 to 20.0.0 (#2771)
* Bump wasi-common from 19.0.2 to 20.0.0

Bumps [wasi-common](https://github.com/bytecodealliance/wasmtime) from 19.0.2 to 20.0.0.
- [Release notes](https://github.com/bytecodealliance/wasmtime/releases)
- [Changelog](https://github.com/bytecodealliance/wasmtime/blob/main/docs/WASI-some-possible-changes.md)
- [Commits](https://github.com/bytecodealliance/wasmtime/compare/v19.0.2...v20.0.0)

---
updated-dependencies:
- dependency-name: wasi-common
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump wasmtime from 19.0.2 to 20.0.0

Bumps [wasmtime](https://github.com/bytecodealliance/wasmtime) from 19.0.2 to 20.0.0.
- [Release notes](https://github.com/bytecodealliance/wasmtime/releases)
- [Changelog](https://github.com/bytecodealliance/wasmtime/blob/main/docs/WASI-some-possible-changes.md)
- [Commits](https://github.com/bytecodealliance/wasmtime/compare/v19.0.2...v20.0.0)

---
updated-dependencies:
- dependency-name: wasmtime
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Yashodhan Joshi <yjdoc2@gmail.com>
2024-04-24 05:36:17 +00:00
omprakaash 44e7b59fc3 Add validate_linux_resource_memory test helper
Signed-off-by: omprakaash <omsuseela@gmail.com>
2024-02-25 23:36:54 +00:00
omprakaash fe60f1115a Add test for cgroups_relative_memory
Signed-off-by: omprakaash <omsuseela@gmail.com>
2024-02-16 19:49:49 +00:00
9 changed files with 325 additions and 148 deletions

262
Cargo.lock generated
View File

@ -185,7 +185,7 @@ dependencies = [
"cfg-if",
"libc",
"miniz_oxide",
"object",
"object 0.32.2",
"rustc-demangle",
]
@ -610,11 +610,11 @@ dependencies = [
[[package]]
name = "cranelift-bforest"
version = "0.106.2"
version = "0.107.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b57d4f3ffc28bbd6ef1ca7b50b20126717232f97487efe027d135d9d87eb29c"
checksum = "79b27922a6879b5b5361d0a084cb0b1941bf109a98540addcb932da13b68bed4"
dependencies = [
"cranelift-entity 0.106.2",
"cranelift-entity 0.107.0",
]
[[package]]
@ -640,17 +640,17 @@ dependencies = [
[[package]]
name = "cranelift-codegen"
version = "0.106.2"
version = "0.107.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d1f7d0ac7fd53f2c29db3ff9a063f6ff5a8be2abaa8f6942aceb6e1521e70df7"
checksum = "304c455b28bf56372729acb356afbb55d622f2b0f2f7837aa5e57c138acaac4d"
dependencies = [
"bumpalo",
"cranelift-bforest 0.106.2",
"cranelift-codegen-meta 0.106.2",
"cranelift-codegen-shared 0.106.2",
"cranelift-bforest 0.107.0",
"cranelift-codegen-meta 0.107.0",
"cranelift-codegen-shared 0.107.0",
"cranelift-control",
"cranelift-entity 0.106.2",
"cranelift-isle 0.106.2",
"cranelift-entity 0.107.0",
"cranelift-isle 0.107.0",
"gimli 0.28.1",
"hashbrown 0.14.3",
"log",
@ -670,11 +670,11 @@ dependencies = [
[[package]]
name = "cranelift-codegen-meta"
version = "0.106.2"
version = "0.107.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b40bf21460a600178956cb7fd900a7408c6587fbb988a8063f7215361801a1da"
checksum = "1653c56b99591d07f67c5ca7f9f25888948af3f4b97186bff838d687d666f613"
dependencies = [
"cranelift-codegen-shared 0.106.2",
"cranelift-codegen-shared 0.107.0",
]
[[package]]
@ -685,15 +685,15 @@ checksum = "278e52e29c53fcf32431ef08406c295699a70306d05a0715c5b1bf50e33a9ab7"
[[package]]
name = "cranelift-codegen-shared"
version = "0.106.2"
version = "0.107.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d792ecc1243b7ebec4a7f77d9ed428ef27456eeb1f8c780587a6f5c38841be19"
checksum = "f5b6a9cf6b6eb820ee3f973a0db313c05dc12d370f37b4fe9630286e1672573f"
[[package]]
name = "cranelift-control"
version = "0.106.2"
version = "0.107.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cea2808043df964b73ad7582e09afbbe06a31f3fb9db834d53e74b4e16facaeb"
checksum = "d9d06e6bf30075fb6bed9e034ec046475093392eea1aff90eb5c44c4a033d19a"
dependencies = [
"arbitrary",
]
@ -720,9 +720,9 @@ checksum = "9a59bcbca89c3f1b70b93ab3cbba5e5e0cbf3e63dadb23c7525cb142e21a9d4c"
[[package]]
name = "cranelift-entity"
version = "0.106.2"
version = "0.107.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1930946836da6f514da87625cd1a0331f3908e0de454628c24a0b97b130c4d4"
checksum = "29be04f931b73cdb9694874a295027471817f26f26d2f0ebe5454153176b6e3a"
dependencies = [
"serde",
"serde_derive",
@ -742,11 +742,11 @@ dependencies = [
[[package]]
name = "cranelift-frontend"
version = "0.106.2"
version = "0.107.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5482a5fcdf98f2f31b21093643bdcfe9030866b8be6481117022e7f52baa0f2b"
checksum = "a07fd7393041d7faa2f37426f5dc7fc04003b70988810e8c063beefeff1cd8f9"
dependencies = [
"cranelift-codegen 0.106.2",
"cranelift-codegen 0.107.0",
"log",
"smallvec",
"target-lexicon",
@ -760,34 +760,34 @@ checksum = "393bc73c451830ff8dbb3a07f61843d6cb41a084f9996319917c0b291ed785bb"
[[package]]
name = "cranelift-isle"
version = "0.106.2"
version = "0.107.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f6e1869b6053383bdb356900e42e33555b4c9ebee05699469b7c53cdafc82ea"
checksum = "f341d7938caa6dff8149dac05bb2b53fc680323826b83b4cf175ab9f5139a3c9"
[[package]]
name = "cranelift-native"
version = "0.106.2"
version = "0.107.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a91446e8045f1c4bc164b7bba68e2419c623904580d4b730877a663c6da38964"
checksum = "82af6066e6448d26eeabb7aa26a43f7ff79f8217b06bade4ee6ef230aecc8880"
dependencies = [
"cranelift-codegen 0.106.2",
"cranelift-codegen 0.107.0",
"libc",
"target-lexicon",
]
[[package]]
name = "cranelift-wasm"
version = "0.106.2"
version = "0.107.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8b17979b862d3b0d52de6ae3294ffe4d86c36027b56ad0443a7c8c8f921d14f"
checksum = "2766fab7284a914a7f17f90ebe865c86453225fb8637ac31f123f5028fee69cd"
dependencies = [
"cranelift-codegen 0.106.2",
"cranelift-entity 0.106.2",
"cranelift-frontend 0.106.2",
"cranelift-codegen 0.107.0",
"cranelift-entity 0.107.0",
"cranelift-frontend 0.107.0",
"itertools",
"log",
"smallvec",
"wasmparser 0.201.0",
"wasmparser 0.202.0",
"wasmtime-types",
]
@ -1979,7 +1979,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19"
dependencies = [
"cfg-if",
"windows-targets 0.48.5",
"windows-targets 0.52.4",
]
[[package]]
@ -2351,6 +2351,15 @@ name = "object"
version = "0.32.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441"
dependencies = [
"memchr",
]
[[package]]
name = "object"
version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8dd6c0cdf9429bce006e1362bfce61fa1bfd8c898a643ed8d2b471934701d3d"
dependencies = [
"crc32fast",
"hashbrown 0.14.3",
@ -4465,9 +4474,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasi-common"
version = "19.0.2"
version = "20.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce39d43366511a954708a80e9e2e1245bf2fed4e37385cc49f8686d7a9c094dc"
checksum = "63255d85e10627b07325d7cf4e5fe5a40fa4ff183569a0a67931be26d50ede07"
dependencies = [
"anyhow",
"bitflags 2.5.0",
@ -4578,15 +4587,6 @@ version = "0.2.84"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d"
[[package]]
name = "wasm-encoder"
version = "0.201.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9c7d2731df60006819b013f64ccc2019691deccf6e11a1804bc850cd6748f1a"
dependencies = [
"leb128",
]
[[package]]
name = "wasm-encoder"
version = "0.202.0"
@ -4899,9 +4899,9 @@ dependencies = [
[[package]]
name = "wasmparser"
version = "0.201.0"
version = "0.202.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84e5df6dba6c0d7fafc63a450f1738451ed7a0b52295d83e868218fa286bf708"
checksum = "d6998515d3cf3f8b980ef7c11b29a9b1017d4cf86b99ae93b546992df9931413"
dependencies = [
"bitflags 2.5.0",
"indexmap 2.2.6",
@ -4910,19 +4910,19 @@ dependencies = [
[[package]]
name = "wasmprinter"
version = "0.201.0"
version = "0.202.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a67e66da702706ba08729a78e3c0079085f6bfcb1a62e4799e97bbf728c2c265"
checksum = "ab1cc9508685eef9502e787f4d4123745f5651a1e29aec047645d3cac1e2da7a"
dependencies = [
"anyhow",
"wasmparser 0.201.0",
"wasmparser 0.202.0",
]
[[package]]
name = "wasmtime"
version = "19.0.2"
version = "20.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e300c0e3f19dc9064e3b17ce661088646c70dbdde36aab46470ed68ba58db7d"
checksum = "5a5990663c28d81015ddbb02a068ac1bf396a4ea296eba7125b2dfc7c00cb52e"
dependencies = [
"addr2line",
"anyhow",
@ -4937,7 +4937,7 @@ dependencies = [
"ittapi",
"libc",
"log",
"object",
"object 0.33.0",
"once_cell",
"paste",
"rayon",
@ -4947,8 +4947,8 @@ dependencies = [
"serde_derive",
"serde_json",
"target-lexicon",
"wasm-encoder 0.201.0",
"wasmparser 0.201.0",
"wasm-encoder",
"wasmparser 0.202.0",
"wasmtime-cache",
"wasmtime-component-macro",
"wasmtime-component-util",
@ -4966,18 +4966,18 @@ dependencies = [
[[package]]
name = "wasmtime-asm-macros"
version = "19.0.2"
version = "20.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "110aa598e02a136fb095ca70fa96367fc16bab55256a131e66f9b58f16c73daf"
checksum = "625ee94c72004f3ea0228989c9506596e469517d7d0ed66f7300d1067bdf1ca9"
dependencies = [
"cfg-if",
]
[[package]]
name = "wasmtime-cache"
version = "19.0.2"
version = "20.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4e660537b0ac2fc76917fb0cc9d403d2448b6983a84e59c51f7fea7b7dae024"
checksum = "98534bf28de232299e83eab33984a7a6c40c69534d6bd0ea216150b63d41a83a"
dependencies = [
"anyhow",
"base64",
@ -4995,9 +4995,9 @@ dependencies = [
[[package]]
name = "wasmtime-component-macro"
version = "19.0.2"
version = "20.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "091f32ce586251ac4d07019388fb665b010d9518ffe47be1ddbabb162eed6007"
checksum = "64f84414a25ee3a624c8b77550f3fe7b5d8145bd3405ca58886ee6900abb6dc2"
dependencies = [
"anyhow",
"proc-macro2",
@ -5010,72 +5010,55 @@ dependencies = [
[[package]]
name = "wasmtime-component-util"
version = "19.0.2"
version = "20.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0dd17dc1ebc0b28fd24b6b9d07638f55b82ae908918ff08fd221f8b0fefa9125"
checksum = "78580bdb4e04c7da3bf98088559ca1d29382668536e4d5c7f2f966d79c390307"
[[package]]
name = "wasmtime-cranelift"
version = "19.0.2"
version = "20.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e923262451a4b5b39fe02f69f1338d56356db470e289ea1887346b9c7f592738"
checksum = "b60df0ee08c6a536c765f69e9e8205273435b66d02dd401e938769a2622a6c1a"
dependencies = [
"anyhow",
"cfg-if",
"cranelift-codegen 0.106.2",
"cranelift-codegen 0.107.0",
"cranelift-control",
"cranelift-entity 0.106.2",
"cranelift-frontend 0.106.2",
"cranelift-entity 0.107.0",
"cranelift-frontend 0.107.0",
"cranelift-native",
"cranelift-wasm",
"gimli 0.28.1",
"log",
"object",
"object 0.33.0",
"target-lexicon",
"thiserror",
"wasmparser 0.201.0",
"wasmtime-cranelift-shared",
"wasmparser 0.202.0",
"wasmtime-environ",
"wasmtime-versioned-export-macros",
]
[[package]]
name = "wasmtime-cranelift-shared"
version = "19.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "508898cbbea0df81a5d29cfc1c7c72431a1bc4c9e89fd9514b4c868474c05c7a"
dependencies = [
"anyhow",
"cranelift-codegen 0.106.2",
"cranelift-control",
"cranelift-native",
"gimli 0.28.1",
"object",
"target-lexicon",
"wasmtime-environ",
]
[[package]]
name = "wasmtime-environ"
version = "19.0.2"
version = "20.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7e3f2aa72dbb64c19708646e1ff97650f34e254598b82bad5578ea9c80edd30"
checksum = "64ffc1613db69ee47c96738861534f9a405e422a5aa00224fbf5d410b03fb445"
dependencies = [
"anyhow",
"bincode",
"cpp_demangle",
"cranelift-entity 0.106.2",
"cranelift-entity 0.107.0",
"gimli 0.28.1",
"indexmap 2.2.6",
"log",
"object",
"object 0.33.0",
"rustc-demangle",
"serde",
"serde_derive",
"target-lexicon",
"thiserror",
"wasm-encoder 0.201.0",
"wasmparser 0.201.0",
"wasm-encoder",
"wasmparser 0.202.0",
"wasmprinter",
"wasmtime-component-util",
"wasmtime-types",
@ -5083,9 +5066,9 @@ dependencies = [
[[package]]
name = "wasmtime-fiber"
version = "19.0.2"
version = "20.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9235b643527bcbac808216ed342e1fba324c95f14a62762acfa6f2e6ca5edbd6"
checksum = "f043514a23792761c5765f8ba61a4aa7d67f260c0c37494caabceb41d8ae81de"
dependencies = [
"anyhow",
"cc",
@ -5098,11 +5081,11 @@ dependencies = [
[[package]]
name = "wasmtime-jit-debug"
version = "19.0.2"
version = "20.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92de34217bf7f0464262adf391a9950eba440f9dfc7d3b0e3209302875c6f65f"
checksum = "9c0ca2ad8f5d2b37f507ef1c935687a690e84e9f325f5a2af9639440b43c1f0e"
dependencies = [
"object",
"object 0.33.0",
"once_cell",
"rustix",
"wasmtime-versioned-export-macros",
@ -5110,9 +5093,9 @@ dependencies = [
[[package]]
name = "wasmtime-jit-icache-coherence"
version = "19.0.2"
version = "20.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c22ca2ef4d87b23d400660373453e274b2251bc2d674e3102497f690135e04b0"
checksum = "7a9f93a3289057b26dc75eb84d6e60d7694f7d169c7c09597495de6e016a13ff"
dependencies = [
"cfg-if",
"libc",
@ -5121,9 +5104,9 @@ dependencies = [
[[package]]
name = "wasmtime-runtime"
version = "19.0.2"
version = "20.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1806ee242ca4fd183309b7406e4e83ae7739b7569f395d56700de7c7ef9f5eb8"
checksum = "c6332a2b0af4224c3ea57c857ad39acd2780ccc2b0c99ba1baa01864d90d7c94"
dependencies = [
"anyhow",
"cc",
@ -5132,47 +5115,47 @@ dependencies = [
"indexmap 2.2.6",
"libc",
"log",
"mach",
"mach2",
"memfd",
"memoffset 0.9.1",
"paste",
"psm",
"rustix",
"sptr",
"wasm-encoder 0.201.0",
"wasm-encoder",
"wasmtime-asm-macros",
"wasmtime-environ",
"wasmtime-fiber",
"wasmtime-jit-debug",
"wasmtime-slab",
"wasmtime-versioned-export-macros",
"wasmtime-wmemcheck",
"windows-sys 0.52.0",
]
[[package]]
name = "wasmtime-slab"
version = "19.0.2"
version = "20.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20c58bef9ce877fd06acb58f08d003af17cb05cc51225b455e999fbad8e584c0"
checksum = "8b3655075824a374c536a2b2cc9283bb765fcdf3d58b58587862c48571ad81ef"
[[package]]
name = "wasmtime-types"
version = "19.0.2"
version = "20.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cebe297aa063136d9d2e5b347c1528868aa43c2c8d0e1eb0eec144567e38fe0f"
checksum = "b98cf64a242b0b9257604181ca28b28a5fcaa4c9ea1d396f76d1d2d1c5b40eef"
dependencies = [
"cranelift-entity 0.106.2",
"cranelift-entity 0.107.0",
"serde",
"serde_derive",
"thiserror",
"wasmparser 0.201.0",
"wasmparser 0.202.0",
]
[[package]]
name = "wasmtime-versioned-export-macros"
version = "19.0.2"
version = "20.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffaafa5c12355b1a9ee068e9295d50c4ca0a400c721950cdae4f5b54391a2da5"
checksum = "8561d9e2920db2a175213d557d71c2ac7695831ab472bbfafb9060cd1034684f"
dependencies = [
"proc-macro2",
"quote",
@ -5181,26 +5164,26 @@ dependencies = [
[[package]]
name = "wasmtime-winch"
version = "19.0.2"
version = "20.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d618b4e90d3f259b1b77411ce573c9f74aade561957102132e169918aabdc863"
checksum = "a06b573d14ac846a0fb8c541d8fca6a64acf9a1d176176982472274ab1d2fa5d"
dependencies = [
"anyhow",
"cranelift-codegen 0.106.2",
"cranelift-codegen 0.107.0",
"gimli 0.28.1",
"object",
"object 0.33.0",
"target-lexicon",
"wasmparser 0.201.0",
"wasmtime-cranelift-shared",
"wasmparser 0.202.0",
"wasmtime-cranelift",
"wasmtime-environ",
"winch-codegen",
]
[[package]]
name = "wasmtime-wit-bindgen"
version = "19.0.2"
version = "20.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c7a253c8505edd7493603e548bff3af937b0b7dbf2b498bd5ff2131b651af72"
checksum = "595bc7bb3b0ff4aa00fab718c323ea552c3034d77abc821a35112552f2ea487a"
dependencies = [
"anyhow",
"heck 0.4.1",
@ -5208,12 +5191,6 @@ dependencies = [
"wit-parser",
]
[[package]]
name = "wasmtime-wmemcheck"
version = "19.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c9a8c62e9df8322b2166d2a6f096fbec195ddb093748fd74170dcf25ef596769"
[[package]]
name = "wast"
version = "35.0.2"
@ -5233,7 +5210,7 @@ dependencies = [
"leb128",
"memchr",
"unicode-width",
"wasm-encoder 0.202.0",
"wasm-encoder",
]
[[package]]
@ -5325,9 +5302,9 @@ dependencies = [
[[package]]
name = "wiggle"
version = "19.0.2"
version = "20.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "899d3fe5fbacd02f114cacdaa1cca9040280c4153c71833a77b9609c60ccf72b"
checksum = "1b6552dda951239e219c329e5a768393664e8d120c5e0818487ac2633f173b1f"
dependencies = [
"anyhow",
"async-trait",
@ -5340,9 +5317,9 @@ dependencies = [
[[package]]
name = "wiggle-generate"
version = "19.0.2"
version = "20.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2df5887f452cff44ffe1e1aba69b7fafe812deed38498446fa7a46b55e962cd5"
checksum = "da64cb31e0bfe8b1d2d13956ef9fd5c77545756a1a6ef0e6cfd44e8f1f207aed"
dependencies = [
"anyhow",
"heck 0.4.1",
@ -5355,9 +5332,9 @@ dependencies = [
[[package]]
name = "wiggle-macro"
version = "19.0.2"
version = "20.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acdb12de36507498abaa3a042f895a43ee00a2f6125b6901b9a27edf72bfdbe7"
checksum = "900b2416ef2ff2903ded6cf55d4a941fed601bf56a8c4874856d7a77c1891994"
dependencies = [
"proc-macro2",
"quote",
@ -5398,17 +5375,18 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "winch-codegen"
version = "0.17.2"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d15869abc9e3bb29c017c003dbe007a08e9910e8ff9023a962aa13c1b2ee6af"
checksum = "fb23450977f9d4a23c02439cf6899340b2d68887b19465c5682740d9cc37d52e"
dependencies = [
"anyhow",
"cranelift-codegen 0.106.2",
"cranelift-codegen 0.107.0",
"gimli 0.28.1",
"regalloc2 0.9.3",
"smallvec",
"target-lexicon",
"wasmparser 0.201.0",
"wasmparser 0.202.0",
"wasmtime-cranelift",
"wasmtime-environ",
]
@ -5642,9 +5620,9 @@ dependencies = [
[[package]]
name = "wit-parser"
version = "0.201.0"
version = "0.202.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "196d3ecfc4b759a8573bf86a9b3f8996b304b3732e4c7de81655f875f6efdca6"
checksum = "744237b488352f4f27bca05a10acb79474415951c450e52ebd0da784c1df2bcc"
dependencies = [
"anyhow",
"id-arena",
@ -5655,7 +5633,7 @@ dependencies = [
"serde_derive",
"serde_json",
"unicode-xid",
"wasmparser 0.201.0",
"wasmparser 0.202.0",
]
[[package]]

View File

@ -1,5 +1,10 @@
use std::{collections::HashMap, path::PathBuf};
use std::{
collections::HashMap,
fs, io,
path::{Path, PathBuf},
};
use oci_spec::runtime::{LinuxMemory, LinuxMemoryBuilder};
use procfs::{process::Process, ProcError};
use super::{controller_type::CONTROLLERS, ControllerType};
@ -41,6 +46,71 @@ pub fn list_supported_mount_points() -> Result<HashMap<ControllerType, PathBuf>,
Ok(mount_paths)
}
pub fn get_memory_data(pid: i32) -> Result<LinuxMemory, Box<dyn std::error::Error>> {
let cgroup_mount_point = get_subsystem_mount_point(&ControllerType::Memory)?;
let mut cgroup_path = get_subsystem_path(pid, "memory")?;
// Removing the leading slash to convert the path to be relative to the cgroup mount point
if cgroup_path.is_absolute() {
cgroup_path = cgroup_path.strip_prefix("/")?.to_path_buf();
}
let mut memory_data = LinuxMemoryBuilder::default();
let cgroup_memory_files = vec![
"memory.limit_in_bytes",
"memory.soft_limit_in_bytes",
"memory.memsw.limit_in_bytes",
"memory.kmem.limit_in_bytes",
"memory.kmem.tcp.limit_in_bytes",
"memory.swappiness",
"memory.oom_control",
];
let path = cgroup_mount_point.join(&cgroup_path);
for file in cgroup_memory_files {
let file_path = path.join(file);
if file_path.exists() {
let value = std::fs::read_to_string(&file_path)?;
match file {
"memory.limit_in_bytes" => {
let limit = value.trim().parse::<i64>()?;
memory_data = memory_data.limit(limit);
}
"memory.soft_limit_in_bytes" => {
let reservation = value.trim().parse::<i64>()?;
memory_data = memory_data.reservation(reservation);
}
"memory.memsw.limit_in_bytes" => {
let swap = value.trim().parse::<i64>()?;
memory_data = memory_data.swap(swap);
}
"memory.kmem.limit_in_bytes" => {
let kernel = value.trim().parse::<i64>()?;
memory_data = memory_data.kernel(kernel);
}
"memory.kmem.tcp.limit_in_bytes" => {
let kernel_tcp = value.trim().parse::<i64>()?;
memory_data = memory_data.kernel_tcp(kernel_tcp);
}
"memory.swappiness" => {
let swappiness = value.trim().parse::<u64>()?;
memory_data = memory_data.swappiness(swappiness);
}
"memory.oom_control" => {
let oom_control = value.split_whitespace().collect::<Vec<&str>>();
let oom_control = oom_control
.get(1)
.ok_or("Failed to get oom_control")?
.parse::<u64>()?;
memory_data = memory_data.disable_oom_killer(oom_control == 1);
}
_ => {}
};
}
}
Ok(memory_data.build()?)
}
pub fn get_subsystem_mount_point(subsystem: &ControllerType) -> Result<PathBuf, V1MountPointError> {
let subsystem_name = subsystem.to_string();
Process::myself()
@ -79,3 +149,24 @@ pub fn get_subsystem_mount_point(subsystem: &ControllerType) -> Result<PathBuf,
subsystem: *subsystem,
})
}
pub fn get_subsystem_path(pid: i32, subsystem: &str) -> Result<PathBuf, io::Error> {
let contents = fs::read_to_string(Path::new(&format!("/proc/{}/cgroup", pid)))
.unwrap_or_else(|_| panic!("failed to read /proc/{}/cgroup", pid));
for line in contents.lines() {
let parts: Vec<&str> = line.splitn(3, ':').collect();
if parts.len() < 3 {
continue;
}
let subparts: Vec<&str> = parts[1].split(',').collect();
for subpart in subparts {
if subpart == subsystem {
return Ok(PathBuf::from(parts[2].to_string()));
}
}
}
Err(io::Error::new(
io::ErrorKind::Other,
format!("subsystem {} not found", subsystem),
))
}

View File

@ -44,8 +44,8 @@ caps = "0.5.5"
wasmer = { version = "4.0.0", optional = true }
wasmer-wasix = { version = "0.9.0", optional = true }
wasmedge-sdk = { version = "0.13.2", optional = true }
wasmtime = { version = "19.0.2", optional = true }
wasi-common = { version = "19.0.2", optional = true }
wasmtime = { version = "20.0.0", optional = true }
wasi-common = { version = "20.0.0", optional = true }
tracing = { version = "0.1.40", features = ["attributes"] }
tracing-subscriber = { version = "0.3.18", features = ["json", "env-filter"] }
tracing-journald = "0.3.0"

View File

@ -99,6 +99,7 @@ fn main() -> Result<()> {
let cgroup_v1_memory = cgroups::memory::get_test_group();
let cgroup_v1_network = cgroups::network::get_test_group();
let cgroup_v1_blkio = cgroups::blkio::get_test_group();
let cgroup_v1_relative_memory = cgroups::relative_memory::get_test_group();
let seccomp = get_seccomp_test();
let seccomp_notify = get_seccomp_notify_test();
let ro_paths = get_ro_paths_test();
@ -122,6 +123,7 @@ fn main() -> Result<()> {
tm.add_test_group(Box::new(cgroup_v1_memory));
tm.add_test_group(Box::new(cgroup_v1_network));
tm.add_test_group(Box::new(cgroup_v1_blkio));
tm.add_test_group(Box::new(cgroup_v1_relative_memory));
tm.add_test_group(Box::new(seccomp));
tm.add_test_group(Box::new(seccomp_notify));
tm.add_test_group(Box::new(ro_paths));

View File

@ -5,8 +5,9 @@ use oci_spec::runtime::{
LinuxBuilder, LinuxMemoryBuilder, LinuxResourcesBuilder, Spec, SpecBuilder,
};
use test_framework::{test_result, ConditionalTest, TestGroup, TestResult};
use utils::linux_resource_memory::validate_linux_resource_memory;
use crate::utils::{test_outside_container, test_utils::check_container_created};
use crate::utils::{self, test_outside_container};
const CGROUP_MEMORY_LIMIT: &str = "/sys/fs/cgroup/memory/memory.limit_in_bytes";
const CGROUP_MEMORY_SWAPPINESS: &str = "/sys/fs/cgroup/memory/memory.swappiness";
@ -50,8 +51,8 @@ fn test_memory_cgroups() -> TestResult {
];
for spec in cases.into_iter() {
let test_result = test_outside_container(spec, &|data| {
test_result!(check_container_created(&data));
let test_result = test_outside_container(spec.clone(), &|data| {
test_result!(validate_linux_resource_memory(&spec, data));
TestResult::Passed
});

View File

@ -8,6 +8,7 @@ pub mod cpu;
pub mod memory;
pub mod network;
pub mod pids;
pub mod relative_memory;
pub fn cleanup_v1() -> Result<()> {
for subsystem in list_subsystem_mount_points()? {

View File

@ -0,0 +1,67 @@
use std::path::Path;
use crate::utils::linux_resource_memory::validate_linux_resource_memory;
use crate::utils::test_outside_container;
use anyhow::{Context, Result};
use oci_spec::runtime::{
LinuxBuilder, LinuxMemoryBuilder, LinuxResourcesBuilder, Spec, SpecBuilder,
};
use test_framework::{test_result, ConditionalTest, TestGroup, TestResult};
const CGROUP_MEMORY_LIMIT: &str = "/sys/fs/cgroup/memory/memory.limit_in_bytes";
const CGROUP_MEMORY_SWAPPINESS: &str = "/sys/fs/cgroup/memory/memory.swappiness";
fn create_spec(cgroup_name: &str, limit: i64, swappiness: u64) -> Result<Spec> {
let spec = SpecBuilder::default()
.linux(
LinuxBuilder::default()
.cgroups_path(Path::new("/testdir/runtime-test/container").join(cgroup_name))
.resources(
LinuxResourcesBuilder::default()
.memory(
LinuxMemoryBuilder::default()
.limit(limit)
.swappiness(swappiness)
.build()
.context("failed to build memory spec")?,
)
.build()
.context("failed to build resource spec")?,
)
.build()
.context("failed to build linux spec")?,
)
.build()
.context("failed to build spec")?;
Ok(spec)
}
fn test_relative_memory_cgroups() -> TestResult {
let cgroup_name = "test_relative_memory_cgroups";
let spec = test_result!(create_spec(cgroup_name, 50593792, 10));
test_outside_container(spec.clone(), &|data| {
test_result!(validate_linux_resource_memory(&spec, data));
TestResult::Passed
})
}
fn can_run() -> bool {
Path::new(CGROUP_MEMORY_LIMIT).exists() && Path::new(CGROUP_MEMORY_SWAPPINESS).exists()
}
pub fn get_test_group() -> TestGroup {
let mut test_group = TestGroup::new("cgroup_v1_relative_memory");
let linux_cgroups_memory = ConditionalTest::new(
"test_linux_cgroups_relative_memory",
Box::new(can_run),
Box::new(test_relative_memory_cgroups),
);
test_group.add(vec![Box::new(linux_cgroups_memory)]);
test_group
}

View File

@ -0,0 +1,36 @@
use super::ContainerData;
use anyhow::{bail, Result};
use libcgroups::v1::util::get_memory_data;
use oci_spec::runtime::Spec;
pub(crate) fn validate_linux_resource_memory(spec: &Spec, data: ContainerData) -> Result<()> {
let expected_memory = spec
.linux()
.as_ref()
.unwrap()
.resources()
.as_ref()
.unwrap()
.memory()
.as_ref();
let expected_memory = match expected_memory {
Some(m) => m,
None => bail!("expected memory to be set, but it was not"),
};
let memory = get_memory_data(data.state.unwrap().pid.unwrap());
if memory.is_err() {
bail!("failed to get memory data: {:?}", memory.err().unwrap());
}
if expected_memory.limit().unwrap() != memory.as_ref().unwrap().limit().unwrap() {
bail!("expected memory {:?}, got {:?}", expected_memory, memory);
}
if expected_memory.swappiness().unwrap() != memory.as_ref().unwrap().swappiness().unwrap() {
bail!("expected memory {:?}, got {:?}", expected_memory, memory);
}
Ok(())
}

View File

@ -1,3 +1,4 @@
pub mod linux_resource_memory;
pub mod support;
pub mod test_utils;