From 05242b04859d981329a90b1a1ccdee84f57a68ec Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Wed, 28 Apr 2021 02:19:33 -0700 Subject: [PATCH 01/38] Forgot to reactivate windows CI test --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1fd04799f..b8d89f7f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: cd analysis # git checkout converted these to windows newline. Convert back to unix newline here dos2unix test.sh tests/src/*.res tests/src/*.resi - & $env:CYGWIN_ROOT\\bin\\ocaml-env exec -- make + & $env:CYGWIN_ROOT\\bin\\ocaml-env exec -- make test artifact-folder: win32 runs-on: ${{matrix.os}} From 5745fe2da84a64bb45f82752b1778fb0c098a273 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Wed, 28 Apr 2021 02:31:36 -0700 Subject: [PATCH 02/38] dos2unix test snapshots --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b8d89f7f0..e0534eb69 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: build: | cd analysis # git checkout converted these to windows newline. Convert back to unix newline here - dos2unix test.sh tests/src/*.res tests/src/*.resi + dos2unix test.sh tests/src/*.res tests/src/*.resi tests/src/expected/* & $env:CYGWIN_ROOT\\bin\\ocaml-env exec -- make test artifact-folder: win32 From 31001b68177f2185692b8d4eea78c9af32e659ae Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Wed, 28 Apr 2021 02:37:32 -0700 Subject: [PATCH 03/38] Try git newline --- .github/workflows/ci.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e0534eb69..758146640 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,13 +25,18 @@ jobs: build: | cd analysis # git checkout converted these to windows newline. Convert back to unix newline here - dos2unix test.sh tests/src/*.res tests/src/*.resi tests/src/expected/* + # dos2unix test.sh tests/src/*.res tests/src/*.resi tests/src/expected/* & $env:CYGWIN_ROOT\\bin\\ocaml-env exec -- make test artifact-folder: win32 runs-on: ${{matrix.os}} steps: + - name: Set git to use LF + run: | + git config --global core.autocrlf false + git config --global core.eol lf + - uses: actions/checkout@v2.3.4 - name: Cache OCaml's opam From 5824585b6e125866f8c581f511ebbab42901973e Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Wed, 28 Apr 2021 02:42:31 -0700 Subject: [PATCH 04/38] Cat Auto.res.txt --- analysis/test.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/analysis/test.sh b/analysis/test.sh index 6ba881f21..fd7fca6f7 100755 --- a/analysis/test.sh +++ b/analysis/test.sh @@ -2,6 +2,8 @@ function exp { echo "$(dirname $1)/expected/$(basename $1).txt" } +cat tests/src/expected/Auto.res.txt + for file in tests/src/*.{res,resi}; do ./rescript-editor-analysis.exe test $file &> $(exp $file) done @@ -15,6 +17,7 @@ if [[ $diff = "" ]]; then printf "${successGreen}✅ No unstaged tests difference.${reset}\n" else printf "${warningYellow}⚠️ There are unstaged differences in tests/! Did you break a test?\n${diff}\n${reset}" + cat tests/src/expected/Auto.res.txt git --no-pager diff tests/src/expected exit 1 fi From 5e4d6af93894839ffc2a486c212cc7e7dfc64fa7 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Wed, 28 Apr 2021 03:00:19 -0700 Subject: [PATCH 05/38] Spit out charcodes --- analysis/checkErrors.js | 12 ++++++++++++ analysis/test.sh | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 analysis/checkErrors.js diff --git a/analysis/checkErrors.js b/analysis/checkErrors.js new file mode 100644 index 000000000..58b6b6c81 --- /dev/null +++ b/analysis/checkErrors.js @@ -0,0 +1,12 @@ +var fs = require('fs') +var content = fs.readFileSync("tests/src/expected/Auto.res.txt", { encoding: 'utf-8' }) +console.log("content is:===") +console.log(content) +console.log("--- end of content") +let len = content.length +console.log("char count:", len) +var arr = [] +for (let i = 0; i < len; i++) { + arr.push(content.charCodeAt(i)) +} +console.log("char codes:", arr.toString()) diff --git a/analysis/test.sh b/analysis/test.sh index fd7fca6f7..89e85f89f 100755 --- a/analysis/test.sh +++ b/analysis/test.sh @@ -2,7 +2,7 @@ function exp { echo "$(dirname $1)/expected/$(basename $1).txt" } -cat tests/src/expected/Auto.res.txt +node ./checkErrors.js for file in tests/src/*.{res,resi}; do ./rescript-editor-analysis.exe test $file &> $(exp $file) @@ -17,7 +17,7 @@ if [[ $diff = "" ]]; then printf "${successGreen}✅ No unstaged tests difference.${reset}\n" else printf "${warningYellow}⚠️ There are unstaged differences in tests/! Did you break a test?\n${diff}\n${reset}" - cat tests/src/expected/Auto.res.txt + node ./checkErrors.js git --no-pager diff tests/src/expected exit 1 fi From ff1c56f9d1432f5b6df7fc1901fd7c6cd4974562 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Wed, 28 Apr 2021 05:39:13 -0700 Subject: [PATCH 06/38] Why didn't dos2unix on expected work? --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 758146640..9b71933a6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,17 +25,17 @@ jobs: build: | cd analysis # git checkout converted these to windows newline. Convert back to unix newline here - # dos2unix test.sh tests/src/*.res tests/src/*.resi tests/src/expected/* + dos2unix test.sh tests/src/*.res tests/src/*.resi tests/src/expected/* & $env:CYGWIN_ROOT\\bin\\ocaml-env exec -- make test artifact-folder: win32 runs-on: ${{matrix.os}} steps: - - name: Set git to use LF - run: | - git config --global core.autocrlf false - git config --global core.eol lf + # - name: Set git to use LF + # run: | + # git config --global core.autocrlf false + # git config --global core.eol lf - uses: actions/checkout@v2.3.4 From 998889de6ef34ce847d9ca5e412aee797973c79c Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Wed, 28 Apr 2021 05:44:35 -0700 Subject: [PATCH 07/38] Keep expected in windows newline --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b71933a6..8edea8c8e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: build: | cd analysis # git checkout converted these to windows newline. Convert back to unix newline here - dos2unix test.sh tests/src/*.res tests/src/*.resi tests/src/expected/* + dos2unix test.sh tests/src/*.res tests/src/*.resi & $env:CYGWIN_ROOT\\bin\\ocaml-env exec -- make test artifact-folder: win32 From f142312ac2f96ffb6419178550b40369f90d8582 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Wed, 28 Apr 2021 05:54:41 -0700 Subject: [PATCH 08/38] Show more precise diff --- analysis/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/analysis/test.sh b/analysis/test.sh index 89e85f89f..438645d57 100755 --- a/analysis/test.sh +++ b/analysis/test.sh @@ -18,6 +18,6 @@ if [[ $diff = "" ]]; then else printf "${warningYellow}⚠️ There are unstaged differences in tests/! Did you break a test?\n${diff}\n${reset}" node ./checkErrors.js - git --no-pager diff tests/src/expected + git --no-pager diff --word-diff-regex=. tests/src/expected/Auto.res.txt exit 1 fi From 1d7057b1d1ef3243027d39ddf47b6f4255f9b950 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Wed, 28 Apr 2021 06:12:48 -0700 Subject: [PATCH 09/38] Try regular diff --- analysis/test.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/analysis/test.sh b/analysis/test.sh index 438645d57..fe392f8e7 100755 --- a/analysis/test.sh +++ b/analysis/test.sh @@ -4,6 +4,8 @@ function exp { node ./checkErrors.js +cp tests/src/expected/Auto.res.txt tests/src/Auto.res.txt_old + for file in tests/src/*.{res,resi}; do ./rescript-editor-analysis.exe test $file &> $(exp $file) done @@ -19,5 +21,6 @@ else printf "${warningYellow}⚠️ There are unstaged differences in tests/! Did you break a test?\n${diff}\n${reset}" node ./checkErrors.js git --no-pager diff --word-diff-regex=. tests/src/expected/Auto.res.txt + diff -u tests/src/Auto.res.txt_old tests/src/expected/Auto.res.txt exit 1 fi From 53356045e15cf9a58ac16fc00aaa0fe0ed596ff6 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Wed, 28 Apr 2021 06:21:19 -0700 Subject: [PATCH 10/38] Diff more clearly --- analysis/test.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/analysis/test.sh b/analysis/test.sh index fe392f8e7..c44013877 100755 --- a/analysis/test.sh +++ b/analysis/test.sh @@ -21,6 +21,14 @@ else printf "${warningYellow}⚠️ There are unstaged differences in tests/! Did you break a test?\n${diff}\n${reset}" node ./checkErrors.js git --no-pager diff --word-diff-regex=. tests/src/expected/Auto.res.txt + echo "old:" + cat tests/src/Auto.res.txt_old + echo "new:" + cat tests/src/expected/Auto.res.txt + echo "diff -u:" diff -u tests/src/Auto.res.txt_old tests/src/expected/Auto.res.txt + echo "trivial diff:" + diff -u tests/src/Auto.res.txt_old tests/src/expected/Hover.res.txt + echo "done" exit 1 fi From 922ab0aa73964fc05b320a9630b7a011d67f9421 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Wed, 28 Apr 2021 06:48:50 -0700 Subject: [PATCH 11/38] Try cmp --- analysis/test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/analysis/test.sh b/analysis/test.sh index c44013877..04cf4aee3 100755 --- a/analysis/test.sh +++ b/analysis/test.sh @@ -27,8 +27,8 @@ else cat tests/src/expected/Auto.res.txt echo "diff -u:" diff -u tests/src/Auto.res.txt_old tests/src/expected/Auto.res.txt - echo "trivial diff:" - diff -u tests/src/Auto.res.txt_old tests/src/expected/Hover.res.txt + echo "cmp:" + cmp tests/src/Auto.res.txt_old tests/src/expected/Auto.res.txt echo "done" exit 1 fi From bbd1acdb3c20a7a36894d940781d6f0fbe5edc3f Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Wed, 28 Apr 2021 06:55:22 -0700 Subject: [PATCH 12/38] Hex dump --- analysis/test.sh | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/analysis/test.sh b/analysis/test.sh index 04cf4aee3..28287afc4 100755 --- a/analysis/test.sh +++ b/analysis/test.sh @@ -4,7 +4,7 @@ function exp { node ./checkErrors.js -cp tests/src/expected/Auto.res.txt tests/src/Auto.res.txt_old +hexdump -C tests/src/expected/Auto.res.txt > old.hex for file in tests/src/*.{res,resi}; do ./rescript-editor-analysis.exe test $file &> $(exp $file) @@ -21,14 +21,9 @@ else printf "${warningYellow}⚠️ There are unstaged differences in tests/! Did you break a test?\n${diff}\n${reset}" node ./checkErrors.js git --no-pager diff --word-diff-regex=. tests/src/expected/Auto.res.txt - echo "old:" - cat tests/src/Auto.res.txt_old - echo "new:" - cat tests/src/expected/Auto.res.txt - echo "diff -u:" - diff -u tests/src/Auto.res.txt_old tests/src/expected/Auto.res.txt - echo "cmp:" - cmp tests/src/Auto.res.txt_old tests/src/expected/Auto.res.txt + echo "diff hex:" + hexdump -C tests/src/expected/Auto.res.txt > new.hex + diff old.hex new.hex echo "done" exit 1 fi From a222edb91b1c76c80af8618957fd1e1afb50dde4 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Wed, 28 Apr 2021 07:01:23 -0700 Subject: [PATCH 13/38] Git diff earlier to debug --- analysis/test.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/analysis/test.sh b/analysis/test.sh index 28287afc4..caf062a29 100755 --- a/analysis/test.sh +++ b/analysis/test.sh @@ -2,9 +2,11 @@ function exp { echo "$(dirname $1)/expected/$(basename $1).txt" } -node ./checkErrors.js +echo "git status right now" +git --no-pager diff --word-diff-regex=. tests/src/expected/Auto.res.txt +echo "done" -hexdump -C tests/src/expected/Auto.res.txt > old.hex +node ./checkErrors.js for file in tests/src/*.{res,resi}; do ./rescript-editor-analysis.exe test $file &> $(exp $file) @@ -21,9 +23,5 @@ else printf "${warningYellow}⚠️ There are unstaged differences in tests/! Did you break a test?\n${diff}\n${reset}" node ./checkErrors.js git --no-pager diff --word-diff-regex=. tests/src/expected/Auto.res.txt - echo "diff hex:" - hexdump -C tests/src/expected/Auto.res.txt > new.hex - diff old.hex new.hex - echo "done" exit 1 fi From 116a6cd67ab1e1b2f5199dd46e1badd47ca5d4ed Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Wed, 28 Apr 2021 07:13:16 -0700 Subject: [PATCH 14/38] git diff even earlier --- .github/workflows/ci.yml | 5 +++++ analysis/test.sh | 10 +++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8edea8c8e..cd010d671 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,12 @@ jobs: build: | cd analysis # git checkout converted these to windows newline. Convert back to unix newline here + echo "hi diff====" + git diff tests/src dos2unix test.sh tests/src/*.res tests/src/*.resi + echo "hi diff 2====" + git diff tests/src + echo "make now====" & $env:CYGWIN_ROOT\\bin\\ocaml-env exec -- make test artifact-folder: win32 diff --git a/analysis/test.sh b/analysis/test.sh index caf062a29..c0c2bd20a 100755 --- a/analysis/test.sh +++ b/analysis/test.sh @@ -2,14 +2,18 @@ function exp { echo "$(dirname $1)/expected/$(basename $1).txt" } -echo "git status right now" -git --no-pager diff --word-diff-regex=. tests/src/expected/Auto.res.txt -echo "done" +echo "git status right now=====" +git --no-pager diff --word-diff-regex=. tests/src/ +echo "done---------" node ./checkErrors.js for file in tests/src/*.{res,resi}; do ./rescript-editor-analysis.exe test $file &> $(exp $file) + # CI + # if [ "$RUNNER_OS" == "Windows" ]; then + # dos2unix $(exp $file) + # fi done warningYellow='\033[0;33m' From fbc99468f1865fc468274524442f76ddb2f2cb28 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Wed, 28 Apr 2021 07:31:51 -0700 Subject: [PATCH 15/38] Cat everywhere --- .github/workflows/ci.yml | 8 ++++---- analysis/Makefile | 2 ++ analysis/test.sh | 8 ++++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cd010d671..b6e809da4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,11 +25,11 @@ jobs: build: | cd analysis # git checkout converted these to windows newline. Convert back to unix newline here - echo "hi diff====" - git diff tests/src + echo "cat -A ci====" + cat -A tests/src/expected/Auto.res.txt dos2unix test.sh tests/src/*.res tests/src/*.resi - echo "hi diff 2====" - git diff tests/src + echo "cat -A ci second time====" + cat -A tests/src/expected/Auto.res.txt echo "make now====" & $env:CYGWIN_ROOT\\bin\\ocaml-env exec -- make test artifact-folder: win32 diff --git a/analysis/Makefile b/analysis/Makefile index 3a1e8efeb..c0276b0c9 100644 --- a/analysis/Makefile +++ b/analysis/Makefile @@ -37,6 +37,8 @@ tests/node_modules/.bin/rescript: test: dce tests/node_modules/.bin/rescript @cd tests && node_modules/.bin/rescript + @echo "cat -A makefile test======" + cat -A tests/src/expected/Auto.res.txt ./test.sh clean: diff --git a/analysis/test.sh b/analysis/test.sh index c0c2bd20a..bea42a8ae 100755 --- a/analysis/test.sh +++ b/analysis/test.sh @@ -2,8 +2,8 @@ function exp { echo "$(dirname $1)/expected/$(basename $1).txt" } -echo "git status right now=====" -git --no-pager diff --word-diff-regex=. tests/src/ +echo "cat -A test.sh" +cat -A tests/src/expected/Auto.res.txt echo "done---------" node ./checkErrors.js @@ -16,6 +16,10 @@ for file in tests/src/*.{res,resi}; do # fi done +echo "cat -A test.sh second time" +cat -A tests/src/expected/Auto.res.txt +echo "done 2---------" + warningYellow='\033[0;33m' successGreen='\033[0;32m' reset='\033[0m' From ba3ef0a5482956ad04df542cbadd26a93ea0a579 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Wed, 28 Apr 2021 07:40:55 -0700 Subject: [PATCH 16/38] Last cats --- analysis/test.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/analysis/test.sh b/analysis/test.sh index bea42a8ae..5c850c7f2 100755 --- a/analysis/test.sh +++ b/analysis/test.sh @@ -6,7 +6,7 @@ echo "cat -A test.sh" cat -A tests/src/expected/Auto.res.txt echo "done---------" -node ./checkErrors.js +# node ./checkErrors.js for file in tests/src/*.{res,resi}; do ./rescript-editor-analysis.exe test $file &> $(exp $file) @@ -25,11 +25,17 @@ successGreen='\033[0;32m' reset='\033[0m' diff=$(git ls-files --modified tests/src/expected) +echo "cat -A test.sh third time (after ls-files)" +cat -A tests/src/expected/Auto.res.txt +echo "done 3---------" if [[ $diff = "" ]]; then printf "${successGreen}✅ No unstaged tests difference.${reset}\n" else printf "${warningYellow}⚠️ There are unstaged differences in tests/! Did you break a test?\n${diff}\n${reset}" - node ./checkErrors.js + # node ./checkErrors.js git --no-pager diff --word-diff-regex=. tests/src/expected/Auto.res.txt + echo "cat -A test.sh last time (after git diff)" + cat -A tests/src/expected/Auto.res.txt + echo "done 4last---------" exit 1 fi From 4bfc215e1dde060bc1c9405a74fcdccceb9f0e63 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Wed, 28 Apr 2021 07:46:11 -0700 Subject: [PATCH 17/38] Earliest git diff --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b6e809da4..245ba25d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,8 @@ jobs: build: | cd analysis # git checkout converted these to windows newline. Convert back to unix newline here + echo "git diff now" + git diff echo "cat -A ci====" cat -A tests/src/expected/Auto.res.txt dos2unix test.sh tests/src/*.res tests/src/*.resi From 3704f49e5fed8516a95aa0d03131d2ea3b53c2a9 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Wed, 28 Apr 2021 07:52:25 -0700 Subject: [PATCH 18/38] Git diff everywhere --- .github/workflows/ci.yml | 8 +++----- analysis/Makefile | 4 ++-- analysis/test.sh | 14 ++------------ 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 245ba25d7..19d88f100 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,12 +26,10 @@ jobs: cd analysis # git checkout converted these to windows newline. Convert back to unix newline here echo "git diff now" - git diff - echo "cat -A ci====" - cat -A tests/src/expected/Auto.res.txt + git diff tests/src/expected/Auto.res.txt dos2unix test.sh tests/src/*.res tests/src/*.resi - echo "cat -A ci second time====" - cat -A tests/src/expected/Auto.res.txt + echo "git diff again" + git diff tests/src/expected/Auto.res.txt echo "make now====" & $env:CYGWIN_ROOT\\bin\\ocaml-env exec -- make test artifact-folder: win32 diff --git a/analysis/Makefile b/analysis/Makefile index c0276b0c9..88630f6d3 100644 --- a/analysis/Makefile +++ b/analysis/Makefile @@ -37,8 +37,8 @@ tests/node_modules/.bin/rescript: test: dce tests/node_modules/.bin/rescript @cd tests && node_modules/.bin/rescript - @echo "cat -A makefile test======" - cat -A tests/src/expected/Auto.res.txt + @echo "git diff makefile" + git diff tests/src/expected/Auto.res.txt ./test.sh clean: diff --git a/analysis/test.sh b/analysis/test.sh index 5c850c7f2..694ff9a3d 100755 --- a/analysis/test.sh +++ b/analysis/test.sh @@ -2,8 +2,8 @@ function exp { echo "$(dirname $1)/expected/$(basename $1).txt" } -echo "cat -A test.sh" -cat -A tests/src/expected/Auto.res.txt +echo "git diff test.sh" +git diff tests/src/expected/Auto.res.txt echo "done---------" # node ./checkErrors.js @@ -16,26 +16,16 @@ for file in tests/src/*.{res,resi}; do # fi done -echo "cat -A test.sh second time" -cat -A tests/src/expected/Auto.res.txt -echo "done 2---------" - warningYellow='\033[0;33m' successGreen='\033[0;32m' reset='\033[0m' diff=$(git ls-files --modified tests/src/expected) -echo "cat -A test.sh third time (after ls-files)" -cat -A tests/src/expected/Auto.res.txt -echo "done 3---------" if [[ $diff = "" ]]; then printf "${successGreen}✅ No unstaged tests difference.${reset}\n" else printf "${warningYellow}⚠️ There are unstaged differences in tests/! Did you break a test?\n${diff}\n${reset}" # node ./checkErrors.js git --no-pager diff --word-diff-regex=. tests/src/expected/Auto.res.txt - echo "cat -A test.sh last time (after git diff)" - cat -A tests/src/expected/Auto.res.txt - echo "done 4last---------" exit 1 fi From 7fbdb81573b27a5245de6c5b1716a8a84302cbac Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Wed, 28 Apr 2021 18:37:15 -0700 Subject: [PATCH 19/38] diff makefile. Cornered --- analysis/Makefile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/analysis/Makefile b/analysis/Makefile index 88630f6d3..f74da0e9e 100644 --- a/analysis/Makefile +++ b/analysis/Makefile @@ -30,14 +30,24 @@ $(OUTPUT): $(SOURCE_FILES) build-native: $(OUTPUT) depend dce: build-native + @echo "git diff makefile dce 1" + git diff tests/src/expected/Auto.res.txt ../node_modules/.bin/reanalyze -dce-cmt src -suppress src/vendor + @echo "git diff makefile dce 2" + git diff tests/src/expected/Auto.res.txt tests/node_modules/.bin/rescript: + @echo "git diff makefile rescript 1" + git diff tests/src/expected/Auto.res.txt @cd tests && npm install + @echo "git diff makefile rescript 2" + git diff tests/src/expected/Auto.res.txt test: dce tests/node_modules/.bin/rescript + @echo "git diff makefile test 1" + git diff tests/src/expected/Auto.res.txt @cd tests && node_modules/.bin/rescript - @echo "git diff makefile" + @echo "git diff makefile test 2" git diff tests/src/expected/Auto.res.txt ./test.sh From 5de2084d2105e46cd4e2fc4075791fc3336cb5ef Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Wed, 28 Apr 2021 19:05:06 -0700 Subject: [PATCH 20/38] earliest in makefile --- .github/workflows/ci.yml | 2 +- analysis/Makefile | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 19d88f100..2198cfdb3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: echo "git diff again" git diff tests/src/expected/Auto.res.txt echo "make now====" - & $env:CYGWIN_ROOT\\bin\\ocaml-env exec -- make test + & $env:CYGWIN_ROOT\\bin\\ocaml-env exec -- make foo artifact-folder: win32 runs-on: ${{matrix.os}} diff --git a/analysis/Makefile b/analysis/Makefile index f74da0e9e..108f4a71a 100644 --- a/analysis/Makefile +++ b/analysis/Makefile @@ -54,6 +54,10 @@ test: dce tests/node_modules/.bin/rescript clean: git clean -dfx src +foo: + @echo "git diff makefile foo" + git diff tests/src/expected/Auto.res.txt + .DEFAULT_GOAL := build-native -.PHONY: depend clean build-native dce test +.PHONY: depend clean build-native dce test foo From d21be91762bf9c4c01ee2feb611000509cf82806 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Wed, 28 Apr 2021 19:10:16 -0700 Subject: [PATCH 21/38] Try without ocaml-env --- .github/workflows/ci.yml | 2 +- analysis/Makefile | 90 ++++++++++++++++++++-------------------- 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2198cfdb3..061ad1258 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: echo "git diff again" git diff tests/src/expected/Auto.res.txt echo "make now====" - & $env:CYGWIN_ROOT\\bin\\ocaml-env exec -- make foo + make foo artifact-folder: win32 runs-on: ${{matrix.os}} diff --git a/analysis/Makefile b/analysis/Makefile index 108f4a71a..fd663f4df 100644 --- a/analysis/Makefile +++ b/analysis/Makefile @@ -8,51 +8,51 @@ OCAMLDEP = ocamldep.opt OUTPUT = rescript-editor-analysis.exe -%.cmi : %.mli - @echo Building $@ - @$(OCAMLOPT) $(OCAMLFLAGS) -c $< -%.cmx : %.ml - @echo Building $@ - @$(OCAMLOPT) $(OCAMLFLAGS) -c $< - -include .depend -depend: - @$(OCAMLDEP) -native $(INCLUDES) `find src -name "*.ml" -o -name "*.mli"` > .depend - -SOURCE_FILES = $(shell $(OCAMLDEP) -sort `find src -name "*.ml"` | sed -E "s/\.ml/.cmx/g") - -$(OUTPUT): $(SOURCE_FILES) - @echo Linking... - @$(OCAMLOPT) $(OCAMLFLAGS) -O2 -o $(OUTPUT) \ - -I +compiler-libs unix.cmxa str.cmxa ocamlcommon.cmxa $(INCLUDES) $(SOURCE_FILES) - @echo Done! - -build-native: $(OUTPUT) depend - -dce: build-native - @echo "git diff makefile dce 1" - git diff tests/src/expected/Auto.res.txt - ../node_modules/.bin/reanalyze -dce-cmt src -suppress src/vendor - @echo "git diff makefile dce 2" - git diff tests/src/expected/Auto.res.txt - -tests/node_modules/.bin/rescript: - @echo "git diff makefile rescript 1" - git diff tests/src/expected/Auto.res.txt - @cd tests && npm install - @echo "git diff makefile rescript 2" - git diff tests/src/expected/Auto.res.txt - -test: dce tests/node_modules/.bin/rescript - @echo "git diff makefile test 1" - git diff tests/src/expected/Auto.res.txt - @cd tests && node_modules/.bin/rescript - @echo "git diff makefile test 2" - git diff tests/src/expected/Auto.res.txt - ./test.sh - -clean: - git clean -dfx src +# %.cmi : %.mli +# @echo Building $@ +# @$(OCAMLOPT) $(OCAMLFLAGS) -c $< +# %.cmx : %.ml +# @echo Building $@ +# @$(OCAMLOPT) $(OCAMLFLAGS) -c $< + +# include .depend +# depend: +# @$(OCAMLDEP) -native $(INCLUDES) `find src -name "*.ml" -o -name "*.mli"` > .depend + +# SOURCE_FILES = $(shell $(OCAMLDEP) -sort `find src -name "*.ml"` | sed -E "s/\.ml/.cmx/g") + +# $(OUTPUT): $(SOURCE_FILES) +# @echo Linking... +# @$(OCAMLOPT) $(OCAMLFLAGS) -O2 -o $(OUTPUT) \ +# -I +compiler-libs unix.cmxa str.cmxa ocamlcommon.cmxa $(INCLUDES) $(SOURCE_FILES) +# @echo Done! + +# build-native: $(OUTPUT) depend + +# dce: build-native +# @echo "git diff makefile dce 1" +# git diff tests/src/expected/Auto.res.txt +# ../node_modules/.bin/reanalyze -dce-cmt src -suppress src/vendor +# @echo "git diff makefile dce 2" +# git diff tests/src/expected/Auto.res.txt + +# tests/node_modules/.bin/rescript: +# @echo "git diff makefile rescript 1" +# git diff tests/src/expected/Auto.res.txt +# @cd tests && npm install +# @echo "git diff makefile rescript 2" +# git diff tests/src/expected/Auto.res.txt + +# test: dce tests/node_modules/.bin/rescript +# @echo "git diff makefile test 1" +# git diff tests/src/expected/Auto.res.txt +# @cd tests && node_modules/.bin/rescript +# @echo "git diff makefile test 2" +# git diff tests/src/expected/Auto.res.txt +# ./test.sh + +# clean: +# git clean -dfx src foo: @echo "git diff makefile foo" From b703366a7e023993d71ecd0be5aa9a33bf57c3a1 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Wed, 28 Apr 2021 22:04:39 -0700 Subject: [PATCH 22/38] Double check ocaml-env changing --- .github/workflows/ci.yml | 6 +++--- analysis/Makefile | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 061ad1258..af83d4724 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,11 +25,11 @@ jobs: build: | cd analysis # git checkout converted these to windows newline. Convert back to unix newline here - echo "git diff now" - git diff tests/src/expected/Auto.res.txt dos2unix test.sh tests/src/*.res tests/src/*.resi - echo "git diff again" + echo "git diff ci" git diff tests/src/expected/Auto.res.txt + echo "cat -A Auto.res.txt" + cat -A tests/src/expected/Auto.res.txt echo "make now====" make foo artifact-folder: win32 diff --git a/analysis/Makefile b/analysis/Makefile index fd663f4df..a45ed31df 100644 --- a/analysis/Makefile +++ b/analysis/Makefile @@ -57,6 +57,8 @@ OUTPUT = rescript-editor-analysis.exe foo: @echo "git diff makefile foo" git diff tests/src/expected/Auto.res.txt + @echo "cat -A Auto.res.txt in makefile" + cat -A tests/src/expected/Auto.res.txt .DEFAULT_GOAL := build-native From b1c7e92210b089d3c791b1ec32ea433ec96dc19c Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Wed, 28 Apr 2021 22:17:14 -0700 Subject: [PATCH 23/38] Add back ocaml-env --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af83d4724..a32defcaa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: echo "cat -A Auto.res.txt" cat -A tests/src/expected/Auto.res.txt echo "make now====" - make foo + & $env:CYGWIN_ROOT\\bin\\ocaml-env exec -- make foo artifact-folder: win32 runs-on: ${{matrix.os}} From 5a3aaf651356d7ffa14b5a0f6e9504db4772afde Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Wed, 28 Apr 2021 22:45:09 -0700 Subject: [PATCH 24/38] Try LF again --- .github/workflows/ci.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a32defcaa..fac72eed2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,22 +25,23 @@ jobs: build: | cd analysis # git checkout converted these to windows newline. Convert back to unix newline here - dos2unix test.sh tests/src/*.res tests/src/*.resi + # dos2unix test.sh tests/src/*.res tests/src/*.resi echo "git diff ci" git diff tests/src/expected/Auto.res.txt echo "cat -A Auto.res.txt" cat -A tests/src/expected/Auto.res.txt echo "make now====" - & $env:CYGWIN_ROOT\\bin\\ocaml-env exec -- make foo + # & $env:CYGWIN_ROOT\\bin\\ocaml-env exec -- make foo + make foo artifact-folder: win32 runs-on: ${{matrix.os}} steps: - # - name: Set git to use LF - # run: | - # git config --global core.autocrlf false - # git config --global core.eol lf + - name: Set git to use LF + run: | + git config --global core.autocrlf false + git config --global core.eol lf - uses: actions/checkout@v2.3.4 From 465796b5982e4b38687164dfcb56578a9903e697 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Wed, 28 Apr 2021 22:50:50 -0700 Subject: [PATCH 25/38] Use ocaml-env with LF --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fac72eed2..c73732c14 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,8 +31,8 @@ jobs: echo "cat -A Auto.res.txt" cat -A tests/src/expected/Auto.res.txt echo "make now====" - # & $env:CYGWIN_ROOT\\bin\\ocaml-env exec -- make foo - make foo + & $env:CYGWIN_ROOT\\bin\\ocaml-env exec -- make foo + # make foo artifact-folder: win32 runs-on: ${{matrix.os}} From c0c092210415f272a73aa8ea54b9ae4bb29635bf Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Wed, 28 Apr 2021 23:05:13 -0700 Subject: [PATCH 26/38] Put back most things --- .github/workflows/ci.yml | 3 +- analysis/Makefile | 84 ++++++++++++++++++++-------------------- analysis/test.sh | 11 ++++++ 3 files changed, 54 insertions(+), 44 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c73732c14..90a6eadbc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,8 +31,7 @@ jobs: echo "cat -A Auto.res.txt" cat -A tests/src/expected/Auto.res.txt echo "make now====" - & $env:CYGWIN_ROOT\\bin\\ocaml-env exec -- make foo - # make foo + & $env:CYGWIN_ROOT\\bin\\ocaml-env exec -- make test artifact-folder: win32 runs-on: ${{matrix.os}} diff --git a/analysis/Makefile b/analysis/Makefile index a45ed31df..f8f327541 100644 --- a/analysis/Makefile +++ b/analysis/Makefile @@ -8,57 +8,57 @@ OCAMLDEP = ocamldep.opt OUTPUT = rescript-editor-analysis.exe -# %.cmi : %.mli -# @echo Building $@ -# @$(OCAMLOPT) $(OCAMLFLAGS) -c $< -# %.cmx : %.ml -# @echo Building $@ -# @$(OCAMLOPT) $(OCAMLFLAGS) -c $< +%.cmi : %.mli + @echo Building $@ + @$(OCAMLOPT) $(OCAMLFLAGS) -c $< +%.cmx : %.ml + @echo Building $@ + @$(OCAMLOPT) $(OCAMLFLAGS) -c $< -# include .depend -# depend: -# @$(OCAMLDEP) -native $(INCLUDES) `find src -name "*.ml" -o -name "*.mli"` > .depend +include .depend +depend: + @$(OCAMLDEP) -native $(INCLUDES) `find src -name "*.ml" -o -name "*.mli"` > .depend -# SOURCE_FILES = $(shell $(OCAMLDEP) -sort `find src -name "*.ml"` | sed -E "s/\.ml/.cmx/g") +SOURCE_FILES = $(shell $(OCAMLDEP) -sort `find src -name "*.ml"` | sed -E "s/\.ml/.cmx/g") -# $(OUTPUT): $(SOURCE_FILES) -# @echo Linking... -# @$(OCAMLOPT) $(OCAMLFLAGS) -O2 -o $(OUTPUT) \ -# -I +compiler-libs unix.cmxa str.cmxa ocamlcommon.cmxa $(INCLUDES) $(SOURCE_FILES) -# @echo Done! +$(OUTPUT): $(SOURCE_FILES) + @echo Linking... + @$(OCAMLOPT) $(OCAMLFLAGS) -O2 -o $(OUTPUT) \ + -I +compiler-libs unix.cmxa str.cmxa ocamlcommon.cmxa $(INCLUDES) $(SOURCE_FILES) + @echo Done! -# build-native: $(OUTPUT) depend +build-native: $(OUTPUT) depend -# dce: build-native -# @echo "git diff makefile dce 1" -# git diff tests/src/expected/Auto.res.txt -# ../node_modules/.bin/reanalyze -dce-cmt src -suppress src/vendor -# @echo "git diff makefile dce 2" -# git diff tests/src/expected/Auto.res.txt +dce: build-native + @echo "git diff makefile dce 1" + git diff tests/src/expected/Auto.res.txt + ../node_modules/.bin/reanalyze -dce-cmt src -suppress src/vendor + @echo "git diff makefile dce 2" + git diff tests/src/expected/Auto.res.txt -# tests/node_modules/.bin/rescript: -# @echo "git diff makefile rescript 1" -# git diff tests/src/expected/Auto.res.txt -# @cd tests && npm install -# @echo "git diff makefile rescript 2" -# git diff tests/src/expected/Auto.res.txt +tests/node_modules/.bin/rescript: + @echo "git diff makefile rescript 1" + git diff tests/src/expected/Auto.res.txt + @cd tests && npm install + @echo "git diff makefile rescript 2" + git diff tests/src/expected/Auto.res.txt -# test: dce tests/node_modules/.bin/rescript -# @echo "git diff makefile test 1" -# git diff tests/src/expected/Auto.res.txt -# @cd tests && node_modules/.bin/rescript -# @echo "git diff makefile test 2" -# git diff tests/src/expected/Auto.res.txt -# ./test.sh +test: dce tests/node_modules/.bin/rescript + @echo "git diff makefile test 1" + git diff tests/src/expected/Auto.res.txt + @cd tests && node_modules/.bin/rescript + @echo "git diff makefile test 2" + git diff tests/src/expected/Auto.res.txt + ./test.sh -# clean: -# git clean -dfx src +clean: + git clean -dfx src -foo: - @echo "git diff makefile foo" - git diff tests/src/expected/Auto.res.txt - @echo "cat -A Auto.res.txt in makefile" - cat -A tests/src/expected/Auto.res.txt +# foo: +# @echo "git diff makefile foo" +# git diff tests/src/expected/Auto.res.txt +# @echo "cat -A Auto.res.txt in makefile" +# cat -A tests/src/expected/Auto.res.txt .DEFAULT_GOAL := build-native diff --git a/analysis/test.sh b/analysis/test.sh index 694ff9a3d..8e3279c49 100755 --- a/analysis/test.sh +++ b/analysis/test.sh @@ -2,6 +2,9 @@ function exp { echo "$(dirname $1)/expected/$(basename $1).txt" } +echo "cat -A test.sh" +cat -A tests/src/expected/Auto.res.txt +echo "done---------" echo "git diff test.sh" git diff tests/src/expected/Auto.res.txt echo "done---------" @@ -26,6 +29,14 @@ if [[ $diff = "" ]]; then else printf "${warningYellow}⚠️ There are unstaged differences in tests/! Did you break a test?\n${diff}\n${reset}" # node ./checkErrors.js + + echo "cat -A test.sh last" + cat -A tests/src/expected/Auto.res.txt + echo "done cat last---------" + echo "git diff test.sh last" + git diff tests/src/expected/Auto.res.txt + echo "done git last---------" + git --no-pager diff --word-diff-regex=. tests/src/expected/Auto.res.txt exit 1 fi From 102557aafd779d7f736b819c28db6d0c46eea36c Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Thu, 29 Apr 2021 00:08:30 -0700 Subject: [PATCH 27/38] check windows bash newline behavior --- analysis/test.sh | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/analysis/test.sh b/analysis/test.sh index 8e3279c49..1fa953fd2 100755 --- a/analysis/test.sh +++ b/analysis/test.sh @@ -1,6 +1,9 @@ function exp { echo "$(dirname $1)/expected/$(basename $1).txt" } +function exp2 { + echo "$(dirname $1)/expected/$(basename $1).2.txt" +} echo "cat -A test.sh" cat -A tests/src/expected/Auto.res.txt @@ -9,16 +12,27 @@ echo "git diff test.sh" git diff tests/src/expected/Auto.res.txt echo "done---------" +echo "doing an echo test" + # node ./checkErrors.js for file in tests/src/*.{res,resi}; do - ./rescript-editor-analysis.exe test $file &> $(exp $file) + # ./rescript-editor-analysis.exe test $file &> $(exp $file) + cat $(exp $file) &> $(exp2 $file) # CI # if [ "$RUNNER_OS" == "Windows" ]; then # dos2unix $(exp $file) # fi done +echo "cat -A test.sh last" +cat -A tests/src/expected/Auto.res.2.txt +echo "done cat last---------" +echo "git diff test.sh last" +diff -u tests/src/expected/Auto.res.txt tests/src/expected/Auto.res.2.txt +echo "done git last---------" + + warningYellow='\033[0;33m' successGreen='\033[0;32m' reset='\033[0m' @@ -30,13 +44,6 @@ else printf "${warningYellow}⚠️ There are unstaged differences in tests/! Did you break a test?\n${diff}\n${reset}" # node ./checkErrors.js - echo "cat -A test.sh last" - cat -A tests/src/expected/Auto.res.txt - echo "done cat last---------" - echo "git diff test.sh last" - git diff tests/src/expected/Auto.res.txt - echo "done git last---------" - git --no-pager diff --word-diff-regex=. tests/src/expected/Auto.res.txt exit 1 fi From 699b72daa556fd4a4ff7efc2d6d599ebfbcbff8b Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Thu, 29 Apr 2021 01:30:29 -0700 Subject: [PATCH 28/38] dos2unix in test script --- analysis/Makefile | 12 ------------ analysis/test.sh | 24 +++++++----------------- 2 files changed, 7 insertions(+), 29 deletions(-) diff --git a/analysis/Makefile b/analysis/Makefile index f8f327541..1501e7bc1 100644 --- a/analysis/Makefile +++ b/analysis/Makefile @@ -30,25 +30,13 @@ $(OUTPUT): $(SOURCE_FILES) build-native: $(OUTPUT) depend dce: build-native - @echo "git diff makefile dce 1" - git diff tests/src/expected/Auto.res.txt ../node_modules/.bin/reanalyze -dce-cmt src -suppress src/vendor - @echo "git diff makefile dce 2" - git diff tests/src/expected/Auto.res.txt tests/node_modules/.bin/rescript: - @echo "git diff makefile rescript 1" - git diff tests/src/expected/Auto.res.txt @cd tests && npm install - @echo "git diff makefile rescript 2" - git diff tests/src/expected/Auto.res.txt test: dce tests/node_modules/.bin/rescript - @echo "git diff makefile test 1" - git diff tests/src/expected/Auto.res.txt @cd tests && node_modules/.bin/rescript - @echo "git diff makefile test 2" - git diff tests/src/expected/Auto.res.txt ./test.sh clean: diff --git a/analysis/test.sh b/analysis/test.sh index 1fa953fd2..e54bb0125 100755 --- a/analysis/test.sh +++ b/analysis/test.sh @@ -1,9 +1,6 @@ function exp { echo "$(dirname $1)/expected/$(basename $1).txt" } -function exp2 { - echo "$(dirname $1)/expected/$(basename $1).2.txt" -} echo "cat -A test.sh" cat -A tests/src/expected/Auto.res.txt @@ -12,27 +9,22 @@ echo "git diff test.sh" git diff tests/src/expected/Auto.res.txt echo "done---------" -echo "doing an echo test" - -# node ./checkErrors.js - for file in tests/src/*.{res,resi}; do - # ./rescript-editor-analysis.exe test $file &> $(exp $file) - cat $(exp $file) &> $(exp2 $file) - # CI - # if [ "$RUNNER_OS" == "Windows" ]; then - # dos2unix $(exp $file) - # fi + ./rescript-editor-analysis.exe test $file &> $(exp $file) done +# CI +if [ "$RUNNER_OS" == "Windows" ]; then + dos2unix tests/src/expected/* +fi + echo "cat -A test.sh last" -cat -A tests/src/expected/Auto.res.2.txt +cat -A tests/src/expected/Auto.res.txt echo "done cat last---------" echo "git diff test.sh last" diff -u tests/src/expected/Auto.res.txt tests/src/expected/Auto.res.2.txt echo "done git last---------" - warningYellow='\033[0;33m' successGreen='\033[0;32m' reset='\033[0m' @@ -42,8 +34,6 @@ if [[ $diff = "" ]]; then printf "${successGreen}✅ No unstaged tests difference.${reset}\n" else printf "${warningYellow}⚠️ There are unstaged differences in tests/! Did you break a test?\n${diff}\n${reset}" - # node ./checkErrors.js - git --no-pager diff --word-diff-regex=. tests/src/expected/Auto.res.txt exit 1 fi From e7a4127ea91ba5551dbc84f963ea7a74f9b309e1 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Thu, 29 Apr 2021 01:44:55 -0700 Subject: [PATCH 29/38] Welp, dos2unix on the files get stuck... --- analysis/test.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/analysis/test.sh b/analysis/test.sh index e54bb0125..a150c2007 100755 --- a/analysis/test.sh +++ b/analysis/test.sh @@ -13,10 +13,10 @@ for file in tests/src/*.{res,resi}; do ./rescript-editor-analysis.exe test $file &> $(exp $file) done -# CI -if [ "$RUNNER_OS" == "Windows" ]; then - dos2unix tests/src/expected/* -fi +# # CI +# if [ "$RUNNER_OS" == "Windows" ]; then +# dos2unix tests/src/expected/* +# fi echo "cat -A test.sh last" cat -A tests/src/expected/Auto.res.txt From 1a1056164d1e846699a06cf5998e28f3752b4745 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Thu, 29 Apr 2021 02:27:22 -0700 Subject: [PATCH 30/38] Throw more tests --- analysis/Makefile | 3 +++ analysis/basetest.txt | 3 +++ analysis/randomfile.txt | 3 +++ analysis/test.sh | 45 ++++++++++++++++++++++++++++------------- analysis/testfile.ml | 14 +++++++++++++ analysis/testfile2.ml | 6 ++++++ analysis/testmore.ml | 1 + 7 files changed, 61 insertions(+), 14 deletions(-) create mode 100644 analysis/basetest.txt create mode 100644 analysis/randomfile.txt create mode 100644 analysis/testfile.ml create mode 100644 analysis/testfile2.ml create mode 100644 analysis/testmore.ml diff --git a/analysis/Makefile b/analysis/Makefile index 1501e7bc1..52c334cd6 100644 --- a/analysis/Makefile +++ b/analysis/Makefile @@ -37,6 +37,9 @@ tests/node_modules/.bin/rescript: test: dce tests/node_modules/.bin/rescript @cd tests && node_modules/.bin/rescript + OCAMLOPT -o testmore.exe ./testmore.ml + OCAMLOPT -o testfile.exe ./testfile.ml + OCAMLOPT -o testfile2.exe ./testfile2.ml ./test.sh clean: diff --git a/analysis/basetest.txt b/analysis/basetest.txt new file mode 100644 index 000000000..50d1c1bc4 --- /dev/null +++ b/analysis/basetest.txt @@ -0,0 +1,3 @@ +hello +world +this is basetest diff --git a/analysis/randomfile.txt b/analysis/randomfile.txt new file mode 100644 index 000000000..21d437dc3 --- /dev/null +++ b/analysis/randomfile.txt @@ -0,0 +1,3 @@ +hello this is used +by +testfile diff --git a/analysis/test.sh b/analysis/test.sh index a150c2007..f21f7cdae 100755 --- a/analysis/test.sh +++ b/analysis/test.sh @@ -2,29 +2,46 @@ function exp { echo "$(dirname $1)/expected/$(basename $1).txt" } -echo "cat -A test.sh" -cat -A tests/src/expected/Auto.res.txt -echo "done---------" -echo "git diff test.sh" -git diff tests/src/expected/Auto.res.txt -echo "done---------" - for file in tests/src/*.{res,resi}; do ./rescript-editor-analysis.exe test $file &> $(exp $file) done +./testmore.exe > helloworld.txt +./testfile.exe > helloworld2.txt +./testfile2.exe > helloworld3.txt + +echo "cat basetest.txt" +cat -A basetest.txt +echo "------" +echo "cat basetest.txt > pipetest.txt then cat" +cat basetest.txt > pipetest.txt +cat -A pipetest.txt +echo "------" +echo "cat helloworld.txt" +cat -A helloworld.txt +echo "------" +echo "cat helloworld2.txt" +cat -A helloworld2.txt +echo "------" +echo "cat helloworld3.txt" +cat -A helloworld3.txt +echo "------" +echo "dox2unix helloworld.txt" +dos2unix helloworld.txt +echo "------" +echo "dox2unix helloworld2.txt" +dos2unix helloworld2.txt +echo "------" +echo "dox2unix helloworld3.txt" +dos2unix helloworld3.txt +echo "------" +echo "========all done!=========" + # # CI # if [ "$RUNNER_OS" == "Windows" ]; then # dos2unix tests/src/expected/* # fi -echo "cat -A test.sh last" -cat -A tests/src/expected/Auto.res.txt -echo "done cat last---------" -echo "git diff test.sh last" -diff -u tests/src/expected/Auto.res.txt tests/src/expected/Auto.res.2.txt -echo "done git last---------" - warningYellow='\033[0;33m' successGreen='\033[0;32m' reset='\033[0m' diff --git a/analysis/testfile.ml b/analysis/testfile.ml new file mode 100644 index 000000000..ac44d9387 --- /dev/null +++ b/analysis/testfile.ml @@ -0,0 +1,14 @@ +let readFile ~filename = + try + (* windows can't use open_in *) + let chan = open_in_bin filename in + let content = really_input_string chan (in_channel_length chan) in + close_in_noerr chan; + Some content + with _ -> None + +let content = readFile "./randomfile.txt" + +let () = match content with +| None -> raise Not_found +| Some content -> print_endline content diff --git a/analysis/testfile2.ml b/analysis/testfile2.ml new file mode 100644 index 000000000..a7007d3aa --- /dev/null +++ b/analysis/testfile2.ml @@ -0,0 +1,6 @@ +let content = {| + hello + how are you +|} + +let () = print_endline content diff --git a/analysis/testmore.ml b/analysis/testmore.ml new file mode 100644 index 000000000..f528862e8 --- /dev/null +++ b/analysis/testmore.ml @@ -0,0 +1 @@ +print_endline "hello, world!" From 6219edac3ff25f4f906ab843746712f75c19f32e Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Thu, 29 Apr 2021 03:00:31 -0700 Subject: [PATCH 31/38] Sed away --- analysis/test.sh | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/analysis/test.sh b/analysis/test.sh index f21f7cdae..759e732b6 100755 --- a/analysis/test.sh +++ b/analysis/test.sh @@ -1,9 +1,15 @@ -function exp { - echo "$(dirname $1)/expected/$(basename $1).txt" -} +printenv for file in tests/src/*.{res,resi}; do - ./rescript-editor-analysis.exe test $file &> $(exp $file) + output="$(dirname $file)/expected/$(basename $file).txt" + ./rescript-editor-analysis.exe test $file &> $output + # CI + echo "inside loop now" + echo $RUNNER_OS + if [ "$RUNNER_OS" == "Windows" ]; then + echo "sedding..." + sed -i "s/\r\n/\n/g" $output + fi done ./testmore.exe > helloworld.txt @@ -26,21 +32,17 @@ echo "------" echo "cat helloworld3.txt" cat -A helloworld3.txt echo "------" -echo "dox2unix helloworld.txt" -dos2unix helloworld.txt -echo "------" -echo "dox2unix helloworld2.txt" -dos2unix helloworld2.txt -echo "------" -echo "dox2unix helloworld3.txt" -dos2unix helloworld3.txt -echo "------" -echo "========all done!=========" -# # CI -# if [ "$RUNNER_OS" == "Windows" ]; then -# dos2unix tests/src/expected/* -# fi +# echo "dox2unix helloworld.txt" +# dos2unix helloworld.txt +# echo "------" +# echo "dox2unix helloworld2.txt" +# dos2unix helloworld2.txt +# echo "------" +# echo "dox2unix helloworld3.txt" +# dos2unix helloworld3.txt +# echo "------" +# echo "========all done!=========" warningYellow='\033[0;33m' successGreen='\033[0;32m' From 66259f7fb7bc849ea0adf96a3cd50c418aa4b922 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Thu, 29 Apr 2021 03:34:02 -0700 Subject: [PATCH 32/38] am i sedding wrong --- analysis/test.sh | 35 +---------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/analysis/test.sh b/analysis/test.sh index 759e732b6..e473129b9 100755 --- a/analysis/test.sh +++ b/analysis/test.sh @@ -1,5 +1,3 @@ -printenv - for file in tests/src/*.{res,resi}; do output="$(dirname $file)/expected/$(basename $file).txt" ./rescript-editor-analysis.exe test $file &> $output @@ -10,40 +8,9 @@ for file in tests/src/*.{res,resi}; do echo "sedding..." sed -i "s/\r\n/\n/g" $output fi + cat -A $output done -./testmore.exe > helloworld.txt -./testfile.exe > helloworld2.txt -./testfile2.exe > helloworld3.txt - -echo "cat basetest.txt" -cat -A basetest.txt -echo "------" -echo "cat basetest.txt > pipetest.txt then cat" -cat basetest.txt > pipetest.txt -cat -A pipetest.txt -echo "------" -echo "cat helloworld.txt" -cat -A helloworld.txt -echo "------" -echo "cat helloworld2.txt" -cat -A helloworld2.txt -echo "------" -echo "cat helloworld3.txt" -cat -A helloworld3.txt -echo "------" - -# echo "dox2unix helloworld.txt" -# dos2unix helloworld.txt -# echo "------" -# echo "dox2unix helloworld2.txt" -# dos2unix helloworld2.txt -# echo "------" -# echo "dox2unix helloworld3.txt" -# dos2unix helloworld3.txt -# echo "------" -# echo "========all done!=========" - warningYellow='\033[0;33m' successGreen='\033[0;32m' reset='\033[0m' From e24465811c417fab92c48c40a71d157b9a3b57d4 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Thu, 29 Apr 2021 03:47:14 -0700 Subject: [PATCH 33/38] Try sed again --- analysis/test.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/analysis/test.sh b/analysis/test.sh index e473129b9..abf36e3db 100755 --- a/analysis/test.sh +++ b/analysis/test.sh @@ -6,8 +6,9 @@ for file in tests/src/*.{res,resi}; do echo $RUNNER_OS if [ "$RUNNER_OS" == "Windows" ]; then echo "sedding..." - sed -i "s/\r\n/\n/g" $output + sed -i "" $output fi + echo "catting" cat -A $output done From faedf8ae12974782529762cd024f782b29aa80c4 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Thu, 29 Apr 2021 04:02:48 -0700 Subject: [PATCH 34/38] Try all the crlf stripping --- analysis/Makefile | 3 --- analysis/test.sh | 25 +++++++++++++++++++++---- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/analysis/Makefile b/analysis/Makefile index 52c334cd6..1501e7bc1 100644 --- a/analysis/Makefile +++ b/analysis/Makefile @@ -37,9 +37,6 @@ tests/node_modules/.bin/rescript: test: dce tests/node_modules/.bin/rescript @cd tests && node_modules/.bin/rescript - OCAMLOPT -o testmore.exe ./testmore.ml - OCAMLOPT -o testfile.exe ./testfile.ml - OCAMLOPT -o testfile2.exe ./testfile2.ml ./test.sh clean: diff --git a/analysis/test.sh b/analysis/test.sh index abf36e3db..2c4d2c38f 100755 --- a/analysis/test.sh +++ b/analysis/test.sh @@ -2,16 +2,33 @@ for file in tests/src/*.{res,resi}; do output="$(dirname $file)/expected/$(basename $file).txt" ./rescript-editor-analysis.exe test $file &> $output # CI - echo "inside loop now" - echo $RUNNER_OS if [ "$RUNNER_OS" == "Windows" ]; then echo "sedding..." sed -i "" $output fi - echo "catting" - cat -A $output done +echo "cat auto" +cat -A tests/src/expected/Auto.res.txt +echo "---" +echo "sed with regex" +sed -i "s/\r\n/\n/g" tests/src/expected/Auto.res.txt +cat -A tests/src/expected/Auto.res.txt +echo "---" +echo "sed with empty regex" +sed -i "" tests/src/expected/Auto.res.txt +cat -A tests/src/expected/Auto.res.txt +echo "---" +echo "perl======" +perl -pi -e 's/\r\n/\n/g' -- tests/src/expected/Auto.res.txt +cat -A tests/src/expected/Auto.res.txt +echo "---" +echo "zip unzip" +zip -ll tests.zip tests/src/expected/* +unzip -ll tests.zip +cat -A tests/src/expected/Auto.res.txt +echo "---" + warningYellow='\033[0;33m' successGreen='\033[0;32m' reset='\033[0m' From 12718e81acddfc9d55000b2d01c74b2c1a626440 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Thu, 29 Apr 2021 04:24:19 -0700 Subject: [PATCH 35/38] perl works! --- analysis/test.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/analysis/test.sh b/analysis/test.sh index 2c4d2c38f..ce3a4fb6f 100755 --- a/analysis/test.sh +++ b/analysis/test.sh @@ -4,7 +4,7 @@ for file in tests/src/*.{res,resi}; do # CI if [ "$RUNNER_OS" == "Windows" ]; then echo "sedding..." - sed -i "" $output + perl -pi -e 's/\r\n/\n/g' -- $output fi done @@ -23,11 +23,11 @@ echo "perl======" perl -pi -e 's/\r\n/\n/g' -- tests/src/expected/Auto.res.txt cat -A tests/src/expected/Auto.res.txt echo "---" -echo "zip unzip" -zip -ll tests.zip tests/src/expected/* -unzip -ll tests.zip -cat -A tests/src/expected/Auto.res.txt -echo "---" +# echo "zip unzip" +# zip -ll tests.zip tests/src/expected/* +# unzip -ll tests.zip +# cat -A tests/src/expected/Auto.res.txt +# echo "---" warningYellow='\033[0;33m' successGreen='\033[0;32m' From 9a4e549233917ddecc57fdf2e52fede1ec123374 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Thu, 29 Apr 2021 04:36:54 -0700 Subject: [PATCH 36/38] Clean up! --- .github/workflows/ci.yml | 12 ++---------- analysis/Makefile | 8 +------- analysis/basetest.txt | 3 --- analysis/checkErrors.js | 12 ------------ analysis/randomfile.txt | 3 --- analysis/test.sh | 26 ++------------------------ analysis/testfile.ml | 14 -------------- analysis/testfile2.ml | 6 ------ analysis/testmore.ml | 1 - 9 files changed, 5 insertions(+), 80 deletions(-) delete mode 100644 analysis/basetest.txt delete mode 100644 analysis/checkErrors.js delete mode 100644 analysis/randomfile.txt delete mode 100644 analysis/testfile.ml delete mode 100644 analysis/testfile2.ml delete mode 100644 analysis/testmore.ml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 90a6eadbc..dff7f4513 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,21 +22,13 @@ jobs: build: eval $(opam env) && cd analysis && make test artifact-folder: linux - os: windows-latest - build: | - cd analysis - # git checkout converted these to windows newline. Convert back to unix newline here - # dos2unix test.sh tests/src/*.res tests/src/*.resi - echo "git diff ci" - git diff tests/src/expected/Auto.res.txt - echo "cat -A Auto.res.txt" - cat -A tests/src/expected/Auto.res.txt - echo "make now====" - & $env:CYGWIN_ROOT\\bin\\ocaml-env exec -- make test + build: "cd analysis && & $env:CYGWIN_ROOT\\bin\\ocaml-env exec -- make test" artifact-folder: win32 runs-on: ${{matrix.os}} steps: + # needed for Windows testing - name: Set git to use LF run: | git config --global core.autocrlf false diff --git a/analysis/Makefile b/analysis/Makefile index 1501e7bc1..3a1e8efeb 100644 --- a/analysis/Makefile +++ b/analysis/Makefile @@ -42,12 +42,6 @@ test: dce tests/node_modules/.bin/rescript clean: git clean -dfx src -# foo: -# @echo "git diff makefile foo" -# git diff tests/src/expected/Auto.res.txt -# @echo "cat -A Auto.res.txt in makefile" -# cat -A tests/src/expected/Auto.res.txt - .DEFAULT_GOAL := build-native -.PHONY: depend clean build-native dce test foo +.PHONY: depend clean build-native dce test diff --git a/analysis/basetest.txt b/analysis/basetest.txt deleted file mode 100644 index 50d1c1bc4..000000000 --- a/analysis/basetest.txt +++ /dev/null @@ -1,3 +0,0 @@ -hello -world -this is basetest diff --git a/analysis/checkErrors.js b/analysis/checkErrors.js deleted file mode 100644 index 58b6b6c81..000000000 --- a/analysis/checkErrors.js +++ /dev/null @@ -1,12 +0,0 @@ -var fs = require('fs') -var content = fs.readFileSync("tests/src/expected/Auto.res.txt", { encoding: 'utf-8' }) -console.log("content is:===") -console.log(content) -console.log("--- end of content") -let len = content.length -console.log("char count:", len) -var arr = [] -for (let i = 0; i < len; i++) { - arr.push(content.charCodeAt(i)) -} -console.log("char codes:", arr.toString()) diff --git a/analysis/randomfile.txt b/analysis/randomfile.txt deleted file mode 100644 index 21d437dc3..000000000 --- a/analysis/randomfile.txt +++ /dev/null @@ -1,3 +0,0 @@ -hello this is used -by -testfile diff --git a/analysis/test.sh b/analysis/test.sh index ce3a4fb6f..9585a319d 100755 --- a/analysis/test.sh +++ b/analysis/test.sh @@ -1,34 +1,12 @@ for file in tests/src/*.{res,resi}; do output="$(dirname $file)/expected/$(basename $file).txt" ./rescript-editor-analysis.exe test $file &> $output - # CI + # CI. We use LF, and the CI OCaml fork prints CRLF. Convert. if [ "$RUNNER_OS" == "Windows" ]; then - echo "sedding..." perl -pi -e 's/\r\n/\n/g' -- $output fi done -echo "cat auto" -cat -A tests/src/expected/Auto.res.txt -echo "---" -echo "sed with regex" -sed -i "s/\r\n/\n/g" tests/src/expected/Auto.res.txt -cat -A tests/src/expected/Auto.res.txt -echo "---" -echo "sed with empty regex" -sed -i "" tests/src/expected/Auto.res.txt -cat -A tests/src/expected/Auto.res.txt -echo "---" -echo "perl======" -perl -pi -e 's/\r\n/\n/g' -- tests/src/expected/Auto.res.txt -cat -A tests/src/expected/Auto.res.txt -echo "---" -# echo "zip unzip" -# zip -ll tests.zip tests/src/expected/* -# unzip -ll tests.zip -# cat -A tests/src/expected/Auto.res.txt -# echo "---" - warningYellow='\033[0;33m' successGreen='\033[0;32m' reset='\033[0m' @@ -38,6 +16,6 @@ if [[ $diff = "" ]]; then printf "${successGreen}✅ No unstaged tests difference.${reset}\n" else printf "${warningYellow}⚠️ There are unstaged differences in tests/! Did you break a test?\n${diff}\n${reset}" - git --no-pager diff --word-diff-regex=. tests/src/expected/Auto.res.txt + git --no-pager diff tests/src/expected exit 1 fi diff --git a/analysis/testfile.ml b/analysis/testfile.ml deleted file mode 100644 index ac44d9387..000000000 --- a/analysis/testfile.ml +++ /dev/null @@ -1,14 +0,0 @@ -let readFile ~filename = - try - (* windows can't use open_in *) - let chan = open_in_bin filename in - let content = really_input_string chan (in_channel_length chan) in - close_in_noerr chan; - Some content - with _ -> None - -let content = readFile "./randomfile.txt" - -let () = match content with -| None -> raise Not_found -| Some content -> print_endline content diff --git a/analysis/testfile2.ml b/analysis/testfile2.ml deleted file mode 100644 index a7007d3aa..000000000 --- a/analysis/testfile2.ml +++ /dev/null @@ -1,6 +0,0 @@ -let content = {| - hello - how are you -|} - -let () = print_endline content diff --git a/analysis/testmore.ml b/analysis/testmore.ml deleted file mode 100644 index f528862e8..000000000 --- a/analysis/testmore.ml +++ /dev/null @@ -1 +0,0 @@ -print_endline "hello, world!" From a1bab5ac4b91578e50cc459ab0b7e8b0374583a7 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Thu, 29 Apr 2021 04:56:57 -0700 Subject: [PATCH 37/38] Cause an intentional error --- analysis/src/Protocol.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/analysis/src/Protocol.ml b/analysis/src/Protocol.ml index 021ca46b7..d2874b8aa 100644 --- a/analysis/src/Protocol.ml +++ b/analysis/src/Protocol.ml @@ -59,7 +59,7 @@ let stringifyLocation h = let stringifyDocumentSymbolItem i = Printf.sprintf {|{ - "name": "%s", + "namea": "%s", "kind": %i, "location": %s }|} From cfb72b54e22ad5c3195eda349a34877eb6040a32 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Thu, 29 Apr 2021 05:12:53 -0700 Subject: [PATCH 38/38] Undo intentional bug --- analysis/src/Protocol.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/analysis/src/Protocol.ml b/analysis/src/Protocol.ml index d2874b8aa..021ca46b7 100644 --- a/analysis/src/Protocol.ml +++ b/analysis/src/Protocol.ml @@ -59,7 +59,7 @@ let stringifyLocation h = let stringifyDocumentSymbolItem i = Printf.sprintf {|{ - "namea": "%s", + "name": "%s", "kind": %i, "location": %s }|}