-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[python] Move from
toml
library to tomli
+ tomli-w
`toml` Python library (for parsing and generating TOML files) is buggy and doesn't support the full spec of TOML 1.0.0. This commit replaces it with more robust `tomli` (for parsing) and `tomli-w` (for generating). New LibOS regression test is added that combines all tricky/legacy TOML syntax, including the checks for TOML-syntax bugs. Signed-off-by: Dmitrii Kuvaiskii <[email protected]>
- Loading branch information
Dmitrii Kuvaiskii
committed
Nov 25, 2022
1 parent
67b1b9f
commit 740e169
Showing
18 changed files
with
93 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# This test contains tricky/legacy TOML syntax, just to test TOML parsing and have some coverage | ||
|
||
{% set entrypoint = "helloworld" -%} | ||
|
||
loader.entrypoint = "file:{{ gramine.libos }}" | ||
libos.entrypoint = "{{ entrypoint }}" | ||
|
||
loader.env.LD_LIBRARY_PATH = "/lib" | ||
|
||
# keep the deprecated `fs.mount` syntax for test purposes | ||
# TODO: this syntax is deprecated in v1.2 and will be removed two versions after it. | ||
|
||
fs.mount.lib.type = "chroot" | ||
fs.mount.lib.path = "/lib" | ||
fs.mount.lib.uri = "file:{{ gramine.runtimedir(libc) }}" | ||
|
||
fs.mount.entrypoint.type = "chroot" | ||
fs.mount.entrypoint.path = "{{ entrypoint }}" | ||
fs.mount.entrypoint.uri = "file:{{ binary_dir }}/{{ entrypoint }}" | ||
|
||
# the manifest option below added only so that this feature has any test coverage | ||
libos.check_invalid_pointers = false | ||
|
||
sgx.nonpie_binary = true | ||
sgx.debug = true | ||
|
||
# the manifest options below added only so that they have any test coverage | ||
sgx.seal_key.flags_mask = "0xffffffffffffffff" | ||
sgx.seal_key.xfrm_mask = "0xfffffffffff9ff1b" | ||
sgx.seal_key.misc_mask = "0xffffffff" | ||
|
||
# below format of sgx.trusted_files is to test TOML-table syntax without `sha256` | ||
[[sgx.trusted_files]] | ||
uri = "file:{{ gramine.libos }}" | ||
|
||
[[sgx.trusted_files]] | ||
uri = "file:{{ gramine.runtimedir(libc) }}/" | ||
|
||
[[sgx.trusted_files]] | ||
uri = "file:{{ binary_dir }}/{{ entrypoint }}" | ||
|
||
# below entry is to test TOML-table syntax with `sha256` (trusted_testfile has hard-coded contents, | ||
# so we can use pre-calculated SHA256 hash) | ||
[[sgx.trusted_files]] | ||
uri = "file:trusted_testfile" | ||
sha256 = "41dacdf1e6d0481d3b1ab1a91f93139db02b96f29cfdd3fb0b819ba1e33cafc4" | ||
|
||
# below entry is to test parsing of `\\x2d` sequence (previously-used `toml` Python parser had bug) | ||
[[sgx.trusted_files]] | ||
uri = "file:nonexisting\\x2dfile" | ||
sha256 = "0123456789012345678901234567890123456789012345678901234567890123" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters