Skip to content

Commit

Permalink
Add xml_validator test for IsoSeq
Browse files Browse the repository at this point in the history
  • Loading branch information
kfang4 committed Jun 1, 2023
1 parent 1bce446 commit efd7e16
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/wdlci/wdl_tests/count_columns.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ task count_columns {
current_run_output_column_count=$(sed 's;,;\t;g' ~{current_run_output} | awk '{print NF}' | sort -nu | tail -n 1)
validated_output_column_count=$(sed 's;,;\t;g' ~{validated_output} | awk '{print NF}' | sort -nu | tail -n 1)
else
current_run_output_column_count=$(awk '{print NF}' ~{current_run_output} | sort -nu | tail -n 1)
validated_output_column_count=$(awk '{print NF}' ~{validated_output} | sort -nu | tail -n 1)
# Disregard headers starting with `#`
current_run_output_column_count=$(sed '/^#/d' ~{current_run_output} | awk '{print NF}' | sort -nu | tail -n 1)
validated_output_column_count=$(sed '/^#/d' ~{validated_output} | awk '{print NF}' | sort -nu | tail -n 1)
fi

if [[ "$current_run_output_column_count" != "$validated_output_column_count" ]]; then
Expand Down
47 changes: 47 additions & 0 deletions src/wdlci/wdl_tests/xml_validator.wdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
version 1.0

# Parse and validate XML file
# Input type: XML files
task xml_validator {
input {
File current_run_output
File validated_output
}

Int disk_size = ceil(size(current_run_output, "GB") + size(validated_output, "GB") + 50)

command <<<
set -euo pipefail

err() {
message=$1

echo -e "[ERROR] $message" >&2
}

if ! xmllint --noout ~{validated_output}; then
err "Validated XML file: [~{basename(validated_output)}] is invalid"
exit 1
else
if ! xmllint --noout ~{current_run_output}; then
err "Current run XML file: [~{basename(current_run_output)}] is invalid"
exit 1
else
echo "Current run XML file: [~{basename(current_run_output)}] is valid"
fi
fi
>>>

output {
}

runtime {
docker: "dnastack/dnastack-wdl-ci-tools:0.0.1"
cpu: 1
memory: "3.75 GB"
disk: disk_size + " GB"
disks: "local-disk " + disk_size + " HDD"
preemptible: 1
}
}

0 comments on commit efd7e16

Please sign in to comment.