From 7e9fd18a2a38810b73da22c55e0ab317bc436697 Mon Sep 17 00:00:00 2001 From: Azeem Sajid Date: Tue, 8 Oct 2024 13:18:19 +0500 Subject: [PATCH 1/9] [CI] Update `sheet` command tests --- app/test/Makefile | 40 +++++++++++++++---------------- app/test/expected/test-sheet4.out | 5 ++++ 2 files changed, 24 insertions(+), 21 deletions(-) create mode 100644 app/test/expected/test-sheet4.out diff --git a/app/test/Makefile b/app/test/Makefile index 22129c1f..2d40c160 100644 --- a/app/test/Makefile +++ b/app/test/Makefile @@ -559,33 +559,31 @@ test-compare: test-%: ${BUILD_DIR}/bin/zsv_%${EXE} test-sheet: test-%: ${BUILD_DIR}/bin/zsv_%${EXE} worldcitiespop_mil.csv @${TEST_INIT} @(tmux new-session -x 1000 -y 5 -d -s $@ "${PREFIX} $< worldcitiespop_mil.csv" && \ - tmux set-window-option -t test-sheet prefix none && \ - sleep 0.5 && \ - tmux capture-pane -t $@ -p ${REDIRECT1} ${TMP_DIR}/$@1.out && \ - tmux send-keys -t $@ "q" && \ + tmux set-option default-terminal "tmux-256color" && \ + tmux set-option prefix C-M-S-b && \ + tmux unbind-key C-b && \ + sleep 0.5) + + @(tmux capture-pane -t $@ -p ${REDIRECT1} ${TMP_DIR}/$@1.out && \ ${CMP} ${TMP_DIR}/$@1.out expected/$@1.out && ${TEST_PASS} || ${TEST_FAIL}) - @(tmux new-session -x 1000 -y 5 -d -s $@ "${PREFIX} $< worldcitiespop_mil.csv" && \ - tmux set-window-option -t test-sheet prefix none && \ - sleep 0.5 && \ - tmux send-keys -t $@ "C-F" && \ + @(tmux send-keys -t $@ "C-f" "C-f" "C-b" && \ tmux capture-pane -t $@ -p ${REDIRECT1} ${TMP_DIR}/$@2.out && \ - tmux send-keys -t $@ "q" && \ ${CMP} ${TMP_DIR}/$@2.out expected/$@2.out && ${TEST_PASS} || ${TEST_FAIL}) - @(tmux new-session -x 1000 -y 5 -d -s $@ "${PREFIX} $< worldcitiespop_mil.csv" && \ - tmux set-window-option -t test-sheet prefix none && \ + @(tmux send-keys -t $@ "f" "sarmaj" Enter && \ sleep 0.5 && \ - tmux send-keys -t $@ "C-F" "C-F" "C-B" && \ - tmux capture-pane -t $@ -p ${REDIRECT1} ${TMP_DIR}/$@2.out && \ - tmux send-keys -t $@ "q" && \ - ${CMP} ${TMP_DIR}/$@2.out expected/$@2.out && ${TEST_PASS} || ${TEST_FAIL}) + tmux capture-pane -t $@ -p ${REDIRECT1} ${TMP_DIR}/$@3.out && \ + tmux send-keys -t $@ Escape Escape && \ + ${CMP} ${TMP_DIR}/$@3.out expected/$@3.out && ${TEST_PASS} || ${TEST_FAIL}) - @(tmux new-session -x 1000 -y 5 -d -s $@ "${PREFIX} $< worldcitiespop_mil.csv" && \ - tmux set-window-option -t test-sheet prefix none && \ - sleep 0.5 && \ - tmux send-keys -t $@ "f" "sarmaj" Enter && \ + @(tmux capture-pane -t $@ -p ${REDIRECT1} ${TMP_DIR}/$@1.out && \ + ${CMP} ${TMP_DIR}/$@1.out expected/$@1.out && ${TEST_PASS} || ${TEST_FAIL}) + + @(tmux send-keys -t $@ "S-Down" "C-b" && \ sleep 0.5 && \ - tmux capture-pane -t $@ -p ${REDIRECT1} ${TMP_DIR}/$@3.out && \ + tmux capture-pane -t $@ -p ${REDIRECT1} ${TMP_DIR}/$@4.out && \ tmux send-keys -t $@ "q" && \ - ${CMP} ${TMP_DIR}/$@3.out expected/$@3.out && ${TEST_PASS} || ${TEST_FAIL}) + ${CMP} ${TMP_DIR}/$@4.out expected/$@4.out && ${TEST_PASS} || ${TEST_FAIL}) + + @(! tmux kill-session -t $@ 2>/dev/null && ${TEST_PASS} || ${TEST_FAIL}) diff --git a/app/test/expected/test-sheet4.out b/app/test/expected/test-sheet4.out new file mode 100644 index 00000000..84ac8386 --- /dev/null +++ b/app/test/expected/test-sheet4.out @@ -0,0 +1,5 @@ +Row # Country City AccentCit Region Populatio Latitude Longitude +999995 ml fallou Fallou 08 15.516666 -4.366666 +999996 gw quenem Quenem 04 12.228333 -15.64444 +999997 ph villa gar Villa Gar 29 17.033333 120.45 +999997 From e7c857a12d4c966e055e9f741d14ff2005841b8f Mon Sep 17 00:00:00 2001 From: Azeem Sajid Date: Tue, 8 Oct 2024 13:23:22 +0500 Subject: [PATCH 2/9] Minor update --- app/test/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/test/Makefile b/app/test/Makefile index 2d40c160..d64ec7d2 100644 --- a/app/test/Makefile +++ b/app/test/Makefile @@ -562,7 +562,8 @@ test-sheet: test-%: ${BUILD_DIR}/bin/zsv_%${EXE} worldcitiespop_mil.csv tmux set-option default-terminal "tmux-256color" && \ tmux set-option prefix C-M-S-b && \ tmux unbind-key C-b && \ - sleep 0.5) + sleep 0.5 && \ + ${TEST_PASS} || ${TEST_FAIL}) @(tmux capture-pane -t $@ -p ${REDIRECT1} ${TMP_DIR}/$@1.out && \ ${CMP} ${TMP_DIR}/$@1.out expected/$@1.out && ${TEST_PASS} || ${TEST_FAIL}) From e411d6c30a2c9df145ecc6ec4201c5bf537ca248 Mon Sep 17 00:00:00 2001 From: Azeem Sajid Date: Tue, 8 Oct 2024 14:33:02 +0500 Subject: [PATCH 3/9] Print diff of output and expected files for debugging --- app/test/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/test/Makefile b/app/test/Makefile index d64ec7d2..c6979547 100644 --- a/app/test/Makefile +++ b/app/test/Makefile @@ -585,6 +585,9 @@ test-sheet: test-%: ${BUILD_DIR}/bin/zsv_%${EXE} worldcitiespop_mil.csv sleep 0.5 && \ tmux capture-pane -t $@ -p ${REDIRECT1} ${TMP_DIR}/$@4.out && \ tmux send-keys -t $@ "q" && \ - ${CMP} ${TMP_DIR}/$@4.out expected/$@4.out && ${TEST_PASS} || ${TEST_FAIL}) + cat ${TMP_DIR}/$@4.out && \ + diff ${TMP_DIR}/$@4.out expected/$@4.out && \ + ${CMP} ${TMP_DIR}/$@4.out expected/$@4.out && \ + ${TEST_PASS} || ${TEST_FAIL}) @(! tmux kill-session -t $@ 2>/dev/null && ${TEST_PASS} || ${TEST_FAIL}) From 902d38daf466bc437ae483c49b2c6fd1ff5fe076 Mon Sep 17 00:00:00 2001 From: Azeem Sajid Date: Tue, 8 Oct 2024 15:00:23 +0500 Subject: [PATCH 4/9] Increase wait for last SHIFT+Down test --- app/test/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/test/Makefile b/app/test/Makefile index c6979547..5a7a43f6 100644 --- a/app/test/Makefile +++ b/app/test/Makefile @@ -582,7 +582,7 @@ test-sheet: test-%: ${BUILD_DIR}/bin/zsv_%${EXE} worldcitiespop_mil.csv ${CMP} ${TMP_DIR}/$@1.out expected/$@1.out && ${TEST_PASS} || ${TEST_FAIL}) @(tmux send-keys -t $@ "S-Down" "C-b" && \ - sleep 0.5 && \ + sleep 1 && \ tmux capture-pane -t $@ -p ${REDIRECT1} ${TMP_DIR}/$@4.out && \ tmux send-keys -t $@ "q" && \ cat ${TMP_DIR}/$@4.out && \ From f66b0e75970eeb5c5bdd1ee2145859854f067356 Mon Sep 17 00:00:00 2001 From: Azeem Sajid Date: Tue, 8 Oct 2024 15:07:52 +0500 Subject: [PATCH 5/9] Increase wait for last SHIFT+Down test --- app/test/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/test/Makefile b/app/test/Makefile index 5a7a43f6..b32e3777 100644 --- a/app/test/Makefile +++ b/app/test/Makefile @@ -582,7 +582,7 @@ test-sheet: test-%: ${BUILD_DIR}/bin/zsv_%${EXE} worldcitiespop_mil.csv ${CMP} ${TMP_DIR}/$@1.out expected/$@1.out && ${TEST_PASS} || ${TEST_FAIL}) @(tmux send-keys -t $@ "S-Down" "C-b" && \ - sleep 1 && \ + sleep 5 && \ tmux capture-pane -t $@ -p ${REDIRECT1} ${TMP_DIR}/$@4.out && \ tmux send-keys -t $@ "q" && \ cat ${TMP_DIR}/$@4.out && \ From eef28950874f1923e7401191f8bc72b339a12c89 Mon Sep 17 00:00:00 2001 From: Azeem Sajid Date: Tue, 8 Oct 2024 15:23:12 +0500 Subject: [PATCH 6/9] Add 20s delay for Shift+Down test --- app/test/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/test/Makefile b/app/test/Makefile index b32e3777..a8afe774 100644 --- a/app/test/Makefile +++ b/app/test/Makefile @@ -582,7 +582,7 @@ test-sheet: test-%: ${BUILD_DIR}/bin/zsv_%${EXE} worldcitiespop_mil.csv ${CMP} ${TMP_DIR}/$@1.out expected/$@1.out && ${TEST_PASS} || ${TEST_FAIL}) @(tmux send-keys -t $@ "S-Down" "C-b" && \ - sleep 5 && \ + sleep 20 && \ tmux capture-pane -t $@ -p ${REDIRECT1} ${TMP_DIR}/$@4.out && \ tmux send-keys -t $@ "q" && \ cat ${TMP_DIR}/$@4.out && \ From 69b6bb799eaeb636e469a8b77a86f9680bcfbd6d Mon Sep 17 00:00:00 2001 From: Azeem Sajid Date: Tue, 8 Oct 2024 15:39:29 +0500 Subject: [PATCH 7/9] Verify Ctrl+b --- app/test/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/test/Makefile b/app/test/Makefile index a8afe774..9f2d8cab 100644 --- a/app/test/Makefile +++ b/app/test/Makefile @@ -561,7 +561,7 @@ test-sheet: test-%: ${BUILD_DIR}/bin/zsv_%${EXE} worldcitiespop_mil.csv @(tmux new-session -x 1000 -y 5 -d -s $@ "${PREFIX} $< worldcitiespop_mil.csv" && \ tmux set-option default-terminal "tmux-256color" && \ tmux set-option prefix C-M-S-b && \ - tmux unbind-key C-b && \ + # tmux unbind-key C-b && \ sleep 0.5 && \ ${TEST_PASS} || ${TEST_FAIL}) @@ -582,10 +582,10 @@ test-sheet: test-%: ${BUILD_DIR}/bin/zsv_%${EXE} worldcitiespop_mil.csv ${CMP} ${TMP_DIR}/$@1.out expected/$@1.out && ${TEST_PASS} || ${TEST_FAIL}) @(tmux send-keys -t $@ "S-Down" "C-b" && \ - sleep 20 && \ + sleep 0.5 && \ tmux capture-pane -t $@ -p ${REDIRECT1} ${TMP_DIR}/$@4.out && \ tmux send-keys -t $@ "q" && \ - cat ${TMP_DIR}/$@4.out && \ + cat ${TMP_DIR}/$@4.out expected/$@4.out && \ diff ${TMP_DIR}/$@4.out expected/$@4.out && \ ${CMP} ${TMP_DIR}/$@4.out expected/$@4.out && \ ${TEST_PASS} || ${TEST_FAIL}) From 133aac3b7c59e83bebe51baea3b54c70c311603e Mon Sep 17 00:00:00 2001 From: Azeem Sajid Date: Tue, 8 Oct 2024 16:08:39 +0500 Subject: [PATCH 8/9] Use Up Down keys instead --- app/test/Makefile | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/test/Makefile b/app/test/Makefile index 9f2d8cab..21ac32f9 100644 --- a/app/test/Makefile +++ b/app/test/Makefile @@ -559,11 +559,9 @@ test-compare: test-%: ${BUILD_DIR}/bin/zsv_%${EXE} test-sheet: test-%: ${BUILD_DIR}/bin/zsv_%${EXE} worldcitiespop_mil.csv @${TEST_INIT} @(tmux new-session -x 1000 -y 5 -d -s $@ "${PREFIX} $< worldcitiespop_mil.csv" && \ - tmux set-option default-terminal "tmux-256color" && \ - tmux set-option prefix C-M-S-b && \ - # tmux unbind-key C-b && \ - sleep 0.5 && \ - ${TEST_PASS} || ${TEST_FAIL}) + tmux set-option -g default-terminal "tmux-256color" && \ + tmux set-option -g prefix C-M-S-b && \ + sleep 0.5) @(tmux capture-pane -t $@ -p ${REDIRECT1} ${TMP_DIR}/$@1.out && \ ${CMP} ${TMP_DIR}/$@1.out expected/$@1.out && ${TEST_PASS} || ${TEST_FAIL}) @@ -581,7 +579,7 @@ test-sheet: test-%: ${BUILD_DIR}/bin/zsv_%${EXE} worldcitiespop_mil.csv @(tmux capture-pane -t $@ -p ${REDIRECT1} ${TMP_DIR}/$@1.out && \ ${CMP} ${TMP_DIR}/$@1.out expected/$@1.out && ${TEST_PASS} || ${TEST_FAIL}) - @(tmux send-keys -t $@ "S-Down" "C-b" && \ + @(tmux send-keys -t $@ "S-Down" Up Up Up Up Up Down Down && \ sleep 0.5 && \ tmux capture-pane -t $@ -p ${REDIRECT1} ${TMP_DIR}/$@4.out && \ tmux send-keys -t $@ "q" && \ From 0c4b8bee6fb51d8161f9ff83453ea41e63181ef1 Mon Sep 17 00:00:00 2001 From: Azeem Sajid Date: Tue, 8 Oct 2024 17:33:09 +0500 Subject: [PATCH 9/9] Update global configuration --- app/test/Makefile | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/app/test/Makefile b/app/test/Makefile index 21ac32f9..4366ced6 100644 --- a/app/test/Makefile +++ b/app/test/Makefile @@ -558,19 +558,18 @@ test-compare: test-%: ${BUILD_DIR}/bin/zsv_%${EXE} test-sheet: test-%: ${BUILD_DIR}/bin/zsv_%${EXE} worldcitiespop_mil.csv @${TEST_INIT} - @(tmux new-session -x 1000 -y 5 -d -s $@ "${PREFIX} $< worldcitiespop_mil.csv" && \ - tmux set-option -g default-terminal "tmux-256color" && \ - tmux set-option -g prefix C-M-S-b && \ + @(echo 'set-option default-terminal "tmux-256color"' > ~/.tmux.conf && \ + tmux new-session -x 1000 -y 5 -d -s $@ "${PREFIX} $< worldcitiespop_mil.csv" && \ sleep 0.5) @(tmux capture-pane -t $@ -p ${REDIRECT1} ${TMP_DIR}/$@1.out && \ ${CMP} ${TMP_DIR}/$@1.out expected/$@1.out && ${TEST_PASS} || ${TEST_FAIL}) - @(tmux send-keys -t $@ "C-f" "C-f" "C-b" && \ + @(tmux send-keys -t $@ C-f C-f C-b && \ tmux capture-pane -t $@ -p ${REDIRECT1} ${TMP_DIR}/$@2.out && \ ${CMP} ${TMP_DIR}/$@2.out expected/$@2.out && ${TEST_PASS} || ${TEST_FAIL}) - @(tmux send-keys -t $@ "f" "sarmaj" Enter && \ + @(tmux send-keys -t $@ f sarmaj Enter && \ sleep 0.5 && \ tmux capture-pane -t $@ -p ${REDIRECT1} ${TMP_DIR}/$@3.out && \ tmux send-keys -t $@ Escape Escape && \ @@ -579,12 +578,10 @@ test-sheet: test-%: ${BUILD_DIR}/bin/zsv_%${EXE} worldcitiespop_mil.csv @(tmux capture-pane -t $@ -p ${REDIRECT1} ${TMP_DIR}/$@1.out && \ ${CMP} ${TMP_DIR}/$@1.out expected/$@1.out && ${TEST_PASS} || ${TEST_FAIL}) - @(tmux send-keys -t $@ "S-Down" Up Up Up Up Up Down Down && \ + @(tmux send-keys -t $@ S-Down C-b && \ sleep 0.5 && \ tmux capture-pane -t $@ -p ${REDIRECT1} ${TMP_DIR}/$@4.out && \ tmux send-keys -t $@ "q" && \ - cat ${TMP_DIR}/$@4.out expected/$@4.out && \ - diff ${TMP_DIR}/$@4.out expected/$@4.out && \ ${CMP} ${TMP_DIR}/$@4.out expected/$@4.out && \ ${TEST_PASS} || ${TEST_FAIL})