From b13cea0dbdb484c6fb0bf1edea0435d6b260bdb1 Mon Sep 17 00:00:00 2001 From: Daylon Wilkins Date: Wed, 17 Jul 2019 18:11:56 -0700 Subject: [PATCH] Fixed/skipped failing bats tests on Windows --- bats/1pk5col-ints.bats | 4 ++-- bats/git-dolt.bats | 20 ++++++++++++++++++++ bats/remotes.bats | 16 ++++++++++++++++ bats/sql-shell.bats | 19 +++++++++++++++++++ 4 files changed, 57 insertions(+), 2 deletions(-) diff --git a/bats/1pk5col-ints.bats b/bats/1pk5col-ints.bats index 380e836d8f..634714b2f1 100755 --- a/bats/1pk5col-ints.bats +++ b/bats/1pk5col-ints.bats @@ -569,7 +569,7 @@ teardown() { [ "$status" -eq 0 ] [ "$output" = "Successfully exported data." ] [ -f export.sql ] - diff $BATS_TEST_DIRNAME/helper/1pk5col-ints.sql export.sql + diff --strip-trailing-cr $BATS_TEST_DIRNAME/helper/1pk5col-ints.sql export.sql } @test "dolt schema" { @@ -608,7 +608,7 @@ teardown() { [ "$status" -eq 0 ] [ "$output" = "" ] [ -f export.schema ] - run diff $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema export.schema + run diff --strip-trailing-cr $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema export.schema [ "$status" -eq 0 ] [ "$output" = "" ] } diff --git a/bats/git-dolt.bats b/bats/git-dolt.bats index ce67295fd3..af35c136a1 100755 --- a/bats/git-dolt.bats +++ b/bats/git-dolt.bats @@ -7,6 +7,24 @@ setup() { export BATS_TMPDIR=$HOME/batstmp/ mkdir $BATS_TMPDIR fi + + skiponwindows() { :; } + + unameOut="$(uname -s)" + case "${unameOut}" in + CYGWIN*) machine=Windows;; + MINGW*) machine=Windows;; + *) machine=Unix;; + esac + + if [ ${machine} = "Windows" ]; then + pkill() { + taskkill -fi "IMAGENAME eq $2*" -f + } + skiponwindows() { + skip "$1" + } + fi export PATH=$PATH:$GOPATH/bin export NOMS_VERSION_NEXT=1 @@ -89,6 +107,7 @@ teardown() { } @test "git dolt's smudge filter automatically clones dolt repositories referenced in checked out git-dolt pointer files" { + skiponwindows "This test works on Windows command prompt but not the bash terminal: GitHub Issue #1809" init_git_repo git dolt install git dolt link $REMOTE @@ -138,6 +157,7 @@ teardown() { } @test "git dolt fails helpfully when dolt is not installed" { + skiponwindows "This test does not work on Windows: GitHub Issue #1801" mkdir TMP_PATH pushd TMP_PATH which git | xargs ln -sf diff --git a/bats/remotes.bats b/bats/remotes.bats index 7735718696..9b767749f5 100644 --- a/bats/remotes.bats +++ b/bats/remotes.bats @@ -5,6 +5,22 @@ setup() { export BATS_TMPDIR=$HOME/batstmp/ mkdir $BATS_TMPDIR fi + + unameOut="$(uname -s)" + case "${unameOut}" in + CYGWIN*) machine=Windows;; + MINGW*) machine=Windows;; + *) machine=Unix;; + esac + + if [ ${machine} = "Windows" ]; then + pkill() { + taskkill -fi "IMAGENAME eq $2*" -f + } + pgrep() { + tasklist -fi "IMAGENAME eq $1*" + } + fi export PATH=$PATH:~/go/bin export NOMS_VERSION_NEXT=1 diff --git a/bats/sql-shell.bats b/bats/sql-shell.bats index 986252c479..b551464429 100644 --- a/bats/sql-shell.bats +++ b/bats/sql-shell.bats @@ -3,6 +3,22 @@ setup() { export PATH=$PATH:~/go/bin export NOMS_VERSION_NEXT=1 + + skiponwindows() { :; } + + unameOut="$(uname -s)" + case "${unameOut}" in + CYGWIN*) machine=Windows;; + MINGW*) machine=Windows;; + *) machine=Unix;; + esac + + if [ ${machine} = "Windows" ]; then + skiponwindows() { + skip "$1" + } + fi + cd $BATS_TMPDIR mkdir "dolt-repo-$$" cd "dolt-repo-$$" @@ -15,6 +31,7 @@ teardown() { } @test "start a sql shell and exit using exit" { + skiponwindows "Works on Windows command prompt but not the MinTTY terminal used during bats" run bash -c "echo exit | dolt sql" [ $status -eq 0 ] [[ "$output" =~ "# Welcome to the DoltSQL shell." ]] || false @@ -22,6 +39,7 @@ teardown() { } @test "start a sql shell and exit using quit" { + skiponwindows "Works on Windows command prompt but not the MinTTY terminal used during bats" run bash -c "echo quit | dolt sql" [ $status -eq 0 ] [[ "$output" =~ "# Welcome to the DoltSQL shell." ]] || false @@ -29,6 +47,7 @@ teardown() { } @test "run a query in sql shell" { + skiponwindows "Works on Windows command prompt but not the MinTTY terminal used during bats" run bash -c "echo 'select * from test;' | dolt sql" [ $status -eq 0 ] [[ "$output" =~ "# Welcome to the DoltSQL shell." ]] || false