-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: more file tests for task evaluation.
These test cases come directly from the 1.2 WDL specification.
- Loading branch information
1 parent
100d3ab
commit 465838d
Showing
76 changed files
with
367 additions
and
0 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 @@ | ||
data |
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 @@ | ||
index |
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,3 @@ | ||
{ | ||
"change_extension.prefix": "foo" | ||
} |
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,5 @@ | ||
{ | ||
"change_extension.data_file": "work/foo.data", | ||
"change_extension.data": "data", | ||
"change_extension.index": "index" | ||
} |
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,22 @@ | ||
version 1.2 | ||
|
||
task change_extension { | ||
input { | ||
String prefix | ||
} | ||
|
||
command <<< | ||
printf "data" > '~{prefix}.data' | ||
printf "index" > '~{prefix}.index' | ||
>>> | ||
|
||
output { | ||
File data_file = "~{prefix}.data" | ||
String data = read_string(data_file) | ||
String index = read_string(sub(data_file, "\\.data$", ".index")) | ||
} | ||
|
||
requirements { | ||
container: "ubuntu:latest" | ||
} | ||
} |
Empty file.
Empty file.
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,10 @@ | ||
error: type mismatch: argument to function `size` expects type `None`, `File?`, `String?`, `Directory?`, or `X` where `X`: any compound type that recursively contains a `File` or `Directory`, but found type `Map[String, Pair[Int, String?]]` | ||
┌─ tests/tasks/file-sizes-task/source.wdl:14:31 | ||
│ | ||
14 │ Float nested_bytes = size({ | ||
│ ╭───────────────────────────────^ | ||
15 │ │ "a": (10, "created_file"), | ||
16 │ │ "b": (50, missing_file) | ||
17 │ │ }) | ||
│ ╰─────^ this is type `Map[String, Pair[Int, String?]]` | ||
|
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 @@ | ||
this file is 22 bytes |
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 @@ | ||
{} |
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,7 @@ | ||
{ | ||
"file_sizes.created_file": "work/created_file", | ||
"file_sizes.missing_file_bytes": 0.0, | ||
"file_sizes.created_file_bytes": 22.0, | ||
"file_sizes.multi_file_kb": 0.022, | ||
"file_sizes.nested_bytes": 22.0 | ||
} |
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,24 @@ | ||
version 1.2 | ||
|
||
task file_sizes { | ||
command <<< | ||
printf "this file is 22 bytes\n" > created_file | ||
>>> | ||
|
||
File? missing_file = None | ||
|
||
output { | ||
File created_file = "created_file" | ||
Float missing_file_bytes = size(missing_file) | ||
Float created_file_bytes = size(created_file, "B") | ||
Float multi_file_kb = size([created_file, missing_file], "K") | ||
Float nested_bytes = size({ | ||
"a": (10, created_file), | ||
"b": (50, missing_file) | ||
}) | ||
} | ||
|
||
requirements { | ||
container: "ubuntu:latest" | ||
} | ||
} |
Empty file.
Empty file.
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 @@ | ||
{} |
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,5 @@ | ||
{ | ||
"test_basename.is_true1": true, | ||
"test_basename.is_true2": true, | ||
"test_basename.is_true3": true | ||
} |
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,11 @@ | ||
version 1.2 | ||
|
||
task test_basename { | ||
command <<<>>> | ||
|
||
output { | ||
Boolean is_true1 = basename("/path/to/file.txt") == "file.txt" | ||
Boolean is_true2 = basename("/path/to/file.txt", ".txt") == "file" | ||
Boolean is_true3 = basename("/path/to/dir") == "dir" | ||
} | ||
} |
Empty file.
Empty file.
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,3 @@ | ||
{ | ||
"test_ceil.i1": 2 | ||
} |
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,6 @@ | ||
{ | ||
"test_ceil.all_true": [ | ||
true, | ||
true | ||
] | ||
} |
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,17 @@ | ||
version 1.2 | ||
|
||
task test_ceil { | ||
input { | ||
Int i1 | ||
} | ||
|
||
Int i2 = i1 + 1 | ||
Float f1 = i1 | ||
Float f2 = i1 + 0.1 | ||
|
||
command <<<>>> | ||
|
||
output { | ||
Array[Boolean] all_true = [ceil(f1) == i1, ceil(f2) == i2] | ||
} | ||
} |
Empty file.
Empty file.
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 @@ | ||
{} |
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,4 @@ | ||
{ | ||
"find_string.match1": "ello", | ||
"find_string.match2": null | ||
} |
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,16 @@ | ||
version 1.2 | ||
|
||
task find_string { | ||
input { | ||
String in = "hello world" | ||
String pattern1 = "e..o" | ||
String pattern2 = "goodbye" | ||
} | ||
|
||
command <<<>>> | ||
|
||
output { | ||
String? match1 = find(in, pattern1) # "ello" | ||
String? match2 = find(in, pattern2) # None | ||
} | ||
} |
Empty file.
Empty file.
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,3 @@ | ||
{ | ||
"test_floor.i1": 2 | ||
} |
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,6 @@ | ||
{ | ||
"test_floor.all_true": [ | ||
true, | ||
true | ||
] | ||
} |
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,17 @@ | ||
version 1.2 | ||
|
||
task test_floor { | ||
input { | ||
Int i1 | ||
} | ||
|
||
Int i2 = i1 - 1 | ||
Float f1 = i1 | ||
Float f2 = i1 - 0.1 | ||
|
||
command <<<>>> | ||
|
||
output { | ||
Array[Boolean] all_true = [floor(f1) == i1, floor(f2) == i2] | ||
} | ||
} |
Empty file.
Empty file.
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 @@ | ||
hello |
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 @@ | ||
{} |
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,5 @@ | ||
{ | ||
"resolve_paths_task.bins_equal": true, | ||
"resolve_paths_task.result": "hello", | ||
"resolve_paths_task.missing_file": null | ||
} |
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,38 @@ | ||
version 1.2 | ||
|
||
task resolve_paths_task { | ||
input { | ||
File abs_file = "/usr" | ||
String abs_str = "/usr" | ||
String rel_dir_str = "bin" | ||
File rel_file = "echo" | ||
File rel_dir_file = "mydir" | ||
String rel_str = "mydata.txt" | ||
} | ||
|
||
# these are all equivalent to '/usr/bin/echo' | ||
File bin1 = join_paths(abs_file, [rel_dir_str, rel_file]) | ||
File bin2 = join_paths(abs_str, [rel_dir_str, rel_file]) | ||
File bin3 = join_paths([abs_str, rel_dir_str, rel_file]) | ||
|
||
# the default behavior is that this resolves to | ||
# '<working dir>/mydir/mydata.txt' | ||
File data = join_paths(rel_dir_file, rel_str) | ||
|
||
# this resolves to '<working dir>/bin/echo', which is non-existent | ||
File doesnt_exist = join_paths([rel_dir_str, rel_file]) | ||
command <<< | ||
mkdir ~{rel_dir_file} | ||
echo -n "hello" > ~{data} | ||
>>> | ||
|
||
output { | ||
Boolean bins_equal = (bin1 == bin2) && (bin1 == bin3) | ||
String result = read_string(data) | ||
File? missing_file = doesnt_exist | ||
} | ||
|
||
runtime { | ||
container: "ubuntu:latest" | ||
} | ||
} |
Empty file.
Empty file.
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,3 @@ | ||
{ | ||
"contains_string.fastq": "sample1234_R1.fastq" | ||
} |
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,4 @@ | ||
{ | ||
"contains_string.is_compressed": false, | ||
"contains_string.is_read1": true | ||
} |
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,14 @@ | ||
version 1.2 | ||
|
||
task contains_string { | ||
input { | ||
File fastq | ||
} | ||
|
||
command <<<>>> | ||
|
||
output { | ||
Boolean is_compressed = matches(basename(fastq), "\\.(gz|zip|zstd)") | ||
Boolean is_read1 = matches(basename(fastq), "_R1") | ||
} | ||
} |
Empty file.
Empty file.
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,4 @@ | ||
{ | ||
"test_max.value1": 1, | ||
"test_max.value2": 2.0 | ||
} |
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,4 @@ | ||
{ | ||
"test_max.max1": 2.0, | ||
"test_max.max2": 2.0 | ||
} |
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,16 @@ | ||
version 1.2 | ||
|
||
task test_max { | ||
input { | ||
Int value1 | ||
Float value2 | ||
} | ||
|
||
command <<<>>> | ||
|
||
output { | ||
# these two expressions are equivalent | ||
Float max1 = if value1 > value2 then value1 else value2 | ||
Float max2 = max(value1, value2) | ||
} | ||
} |
Empty file.
Empty file.
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,4 @@ | ||
{ | ||
"test_min.value1": 1, | ||
"test_min.value2": 2.0 | ||
} |
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,4 @@ | ||
{ | ||
"test_min.min1": 1.0, | ||
"test_min.min2": 1.0 | ||
} |
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,16 @@ | ||
version 1.2 | ||
|
||
task test_min { | ||
input { | ||
Int value1 | ||
Float value2 | ||
} | ||
|
||
command <<<>>> | ||
|
||
output { | ||
# these two expressions are equivalent | ||
Float min1 = if value1 < value2 then value1 else value2 | ||
Float min2 = min(value1, value2) | ||
} | ||
} |
Empty file.
Empty file.
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,3 @@ | ||
{ | ||
"test_round.i1": 2 | ||
} |
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,6 @@ | ||
{ | ||
"test_round.all_true": [ | ||
true, | ||
true | ||
] | ||
} |
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,17 @@ | ||
version 1.2 | ||
|
||
task test_round { | ||
input { | ||
Int i1 | ||
} | ||
|
||
Int i2 = i1 + 1 | ||
Float f1 = i1 + 0.49 | ||
Float f2 = i1 + 0.50 | ||
|
||
command <<<>>> | ||
|
||
output { | ||
Array[Boolean] all_true = [round(f1) == i1, round(f2) == i2] | ||
} | ||
} |
Empty file.
Empty file.
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 @@ | ||
{} |
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,3 @@ | ||
{ | ||
"echo_stderr.message": "hello world" | ||
} |
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,9 @@ | ||
version 1.2 | ||
|
||
task echo_stderr { | ||
command <<< >&2 printf "hello world" >>> | ||
|
||
output { | ||
String message = read_string(stderr()) | ||
} | ||
} |
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 @@ | ||
hello world |
Empty file.
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 @@ | ||
{} |
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,3 @@ | ||
{ | ||
"echo_stdout.message": "hello world" | ||
} |
Oops, something went wrong.