diff --git a/functest/clean.sh b/functest/clean.sh new file mode 100755 index 000000000..37e78239a --- /dev/null +++ b/functest/clean.sh @@ -0,0 +1,5 @@ + +source common.rc + +rm -rf $RAW_DATA_LOCAL $CODE_LOCAL + diff --git a/functest/common.rc b/functest/common.rc new file mode 100644 index 000000000..ef1b8582f --- /dev/null +++ b/functest/common.rc @@ -0,0 +1,27 @@ + +BASE_DIR_S3=https://s3-us-west-2.amazonaws.com/dataversioncontrol +RAW_DATA_S3=$BASE_DIR_S3/stackoverflow_raw_small + +RAW_DATA_LOCAL=sync_raw_data +CODE_LOCAL=sync_code +TEST_REPO=repo_clean + +TEST_REPO=repo_clean + +function _init_repo() { + git init + dvc-init + mkdir data/xml + dvc-data-import ../$RAW_DATA_LOCAL/* data/xml + mkdir code + cp ../$CODE_LOCAL/* code/ + git add code/ + git commit -m 'Add code' +} + +function create_repo() { + rm -rf $TEST_REPO + mkdir $TEST_REPO + (cd $TEST_REPO && _init_repo) +} + diff --git a/functest/init.sh b/functest/init.sh new file mode 100755 index 000000000..c36f5d9bf --- /dev/null +++ b/functest/init.sh @@ -0,0 +1,16 @@ + +source common.rc + +./clean.sh + +rm -rf $RAW_DATA_LOCAL +mkdir $RAW_DATA_LOCAL +for file in "Badges.xml" "Tags.xml" "PostLinks.xml" +do + (cd $RAW_DATA_LOCAL; wget $RAW_DATA_S3/$file) +done + +rm -rf $CODE_LOCAL +mkdir $CODE_LOCAL +(cd $CODE_LOCAL; wget "$BASE_DIR_S3/functests/code/xmltotsv.py") + diff --git a/functest/test-repro-code.sh b/functest/test-repro-code.sh new file mode 100755 index 000000000..657c276dd --- /dev/null +++ b/functest/test-repro-code.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +source common.rc + +function run_test() { + mkdir data/tsv + dvc-run --code code/xmltotsv.py python code/xmltotsv.py --extract row/@Id,row/@UserId,row/@Name,row/@Class,row/@TagBased,row/@Date data/xml/Badges.xml data/tsv/Badges.tsv + + echo " " >> code/xmltotsv.py + git commit -am 'Change code' + dvc-repro data/tsv/Badges.tsv + +} + +TEST_REPO=repo_repro_test +create_repo +(cd repo_repro_test; run_test)