-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3500 from thisismiller/toml-testspec
Add support for .toml tests
- Loading branch information
Showing
208 changed files
with
3,344 additions
and
2,563 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/usr/bin/env python | ||
import sys | ||
|
||
|
||
def main(): | ||
if len(sys.argv) != 2: | ||
print("Usage: txt-to-toml.py [src.txt]") | ||
return 1 | ||
|
||
filename = sys.argv[1] | ||
|
||
indent = " " | ||
in_workload = False | ||
first_test = False | ||
keys_before_test = False | ||
|
||
for line in open(filename): | ||
k = "" | ||
v = "" | ||
|
||
if line.strip().startswith(";"): | ||
print((indent if in_workload else "") + line.strip().replace(";", "#")) | ||
continue | ||
|
||
if "=" in line: | ||
(k, v) = line.strip().split("=") | ||
(k, v) = (k.strip(), v.strip()) | ||
|
||
if k == "testTitle": | ||
first_test = True | ||
if in_workload: | ||
print("") | ||
in_workload = False | ||
if keys_before_test: | ||
print("") | ||
keys_before_test = False | ||
print("[[test]]") | ||
|
||
if k == "testName": | ||
in_workload = True | ||
print("") | ||
print(indent + "[[test.workload]]") | ||
|
||
if not first_test: | ||
keys_before_test = True | ||
|
||
if v.startswith("."): | ||
v = "0" + v | ||
|
||
if any(c.isalpha() or c in ["/", "!"] for c in v): | ||
if v != "true" and v != "false": | ||
v = "'" + v + "'" | ||
|
||
if k == "buggify": | ||
print("buggify = " + ("true" if v == "'on'" else "false")) | ||
elif k: | ||
print((indent if in_workload else "") + k + " = " + v) | ||
|
||
return 0 | ||
|
||
|
||
if __name__ == "__main__": | ||
sys.exit(main()) |
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,28 @@ | ||
find_path(TOML11_INCLUDE_DIR | ||
NAMES | ||
toml.hpp | ||
PATH_SUFFIXES | ||
include | ||
toml11 | ||
include/toml11 | ||
HINTS | ||
"${_TOML11_HINTS}" | ||
) | ||
|
||
if (NOT TOML11_INCLUDE_DIR) | ||
include(ExternalProject) | ||
|
||
ExternalProject_add(toml11 | ||
URL "https://github.com/ToruNiina/toml11/archive/v3.4.0.tar.gz" | ||
URL_HASH SHA256=bc6d733efd9216af8c119d8ac64a805578c79cc82b813e4d1d880ca128bd154d | ||
CMAKE_CACHE_ARGS | ||
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/toml11 | ||
-Dtoml11_BUILD_TEST:BOOL=OFF) | ||
|
||
set(TOML11_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/toml11/include") | ||
endif() | ||
|
||
find_package_handle_standard_args(TOML11 | ||
REQUIRED_VARS | ||
TOML11_INCLUDE_DIR | ||
) |
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
Oops, something went wrong.