Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smaller optimizations to test cases #195

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

ReDTerraN
Copy link
Contributor

smaller optimization to sed.
removed excessive rm usage.

It should look good but please make sure I havent made any mistake.

Cheers

@ReDTerraN ReDTerraN changed the title Smaller optimizations to the test cases Smaller optimizations to test cases Apr 28, 2023
@greymd
Copy link
Owner

greymd commented Apr 29, 2023

It looks like, case 49 fails.

$  bash ./test/test_generator.sh 49 > ./test/case49.sh

//////// FOLLOWING TEST CASES WILL BE EXECUTED ////////
# @case: 49
# @skip: 1.8,2.3
test_log_option() {
$ bash ./test/case49.sh
Testing for bash 4.2.46(2)-release
tmux path: /home/linuxbrew/.linuxbrew/bin/tmux
            tmux 3.3a

[detached (from session 0)]
>>>>>>>>>>
TMUX_XPANES_EXEC ... '/home/linuxbrew/.linuxbrew/bin/tmux'
test_log_option

$ TMUX_XPANES_LOG_DIRECTORY="/tmp/shunit.CpyQKF/tmp/logs" ./xpanes --log -I@ -S /tmp/shunit.CpyQKF/tmp/.xpanes-shunit -c"echo HOGE_@_ | sed s/HOGE/GEGE/ && touch /tmp/shunit.CpyQKF/tmp/fin/@ && /home/linuxbrew/.linuxbrew/bin/tmux detach-client" AAAA AAAA BBBB
[xpanes:info] /tmp/shunit.CpyQKF/tmp/logs is created.
[detached (from session xpanes-14266)]
wait_panes_separation: 1 sec...
AAAA-14405 @1
_window_id:[@1]
0: [181x39] [history 0/2000, 2603 bytes] %1 (active)
1: [180x39] [history 0/2000, 2823 bytes] %3
2: [362x38] [history 0/2000, 3471 bytes] %2
/tmp/shunit.CpyQKF/tmp/logs/AAAA-1.log.2023-04-29_16-31-14
/tmp/shunit.CpyQKF/tmp/logs/AAAA-2.log.2023-04-29_16-31-14
/tmp/shunit.CpyQKF/tmp/logs/BBBB-1.log.2023-04-29_16-31-14

TMUX(TMUX_XPANES_LOG_DIRECTORY="/tmp/shunit.CpyQKF/tmp/logs" ./xpanes --log -I@ -S /tmp/shunit.CpyQKF/tmp/.xpanes-shunit -c"echo HOGE_@_ | sed s/HOGE/GEGE/ && touch /tmp/shunit.CpyQKF/tmp/fin/@ && /home/linuxbrew/.linuxbrew/bin/tmux detach-client" AAAA AAAA BBBB)
[detached (from session 0)]
[detached (from session 0)]
wait_panes_separation: 1 sec...
bash @0
AAAA-14821 @1
_window_id:[@1]
0: [181x39] [history 0/2000, 2603 bytes] %1 (active)
1: [180x39] [history 0/2000, 2823 bytes] %3
2: [362x38] [history 0/2000, 3471 bytes] %2
/tmp/shunit.CpyQKF/tmp/logs/AAAA-1.log.2023-04-29_16-31-14
/tmp/shunit.CpyQKF/tmp/logs/AAAA-1.log.2023-04-29_16-31-24
./test/case49.sh: line 651: /tmp/shunit.CpyQKF/tmp/logs/AAAA-1.log.2023-04-29_16-31-14
/tmp/shunit.CpyQKF/tmp/logs/AAAA-1.log.2023-04-29_16-31-24: No such file or directory
ASSERT:expected:<1> but was:<>
/tmp/shunit.CpyQKF/tmp/logs/AAAA-2.log.2023-04-29_16-31-14
/tmp/shunit.CpyQKF/tmp/logs/AAAA-2.log.2023-04-29_16-31-24
./test/case49.sh: line 656: /tmp/shunit.CpyQKF/tmp/logs/AAAA-2.log.2023-04-29_16-31-14
/tmp/shunit.CpyQKF/tmp/logs/AAAA-2.log.2023-04-29_16-31-24: No such file or directory
ASSERT:expected:<1> but was:<>
/tmp/shunit.CpyQKF/tmp/logs/BBBB-1.log.2023-04-29_16-31-14
/tmp/shunit.CpyQKF/tmp/logs/BBBB-1.log.2023-04-29_16-31-24
./test/case49.sh: line 661: /tmp/shunit.CpyQKF/tmp/logs/BBBB-1.log.2023-04-29_16-31-14
/tmp/shunit.CpyQKF/tmp/logs/BBBB-1.log.2023-04-29_16-31-24: No such file or directory
ASSERT:expected:<1> but was:<>
<<<<<<<<<<

in oneTimeTearDown

Ran 1 test.

FAILED (failures=3)
<<<<<<<<<<

Copy link
Owner

@greymd greymd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some changes have unnecessarily removed directories and it may cause the test failures.

test/cases_all.sh Show resolved Hide resolved
rmdir "${_tmpdir}"/logs
rm -f "${_tmpdir}"/fin/*
rmdir "${_tmpdir}"/fin
rm -rf "${_logdir}" "${_tmpdir}"/fin
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
rm -rf "${_logdir}" "${_tmpdir}"/fin
rm -rf "${_tmpdir}"/{fin,logs}

@@ -3016,8 +2971,7 @@ test_x_option_with_pipe() {
assertEquals "CCCC" "$(cat "${_tmpdir}/fin/CCCC")"

close_tmux_session "$_socket_file"
rm -f "${_tmpdir}"/fin/*
rmdir "${_tmpdir}"/fin
rm -rf "${_tmpdir}"/fin
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set indentation

Suggested change
rm -rf "${_tmpdir}"/fin
rm -rf "${_tmpdir}"/fin

@@ -3081,8 +3035,7 @@ test_x_option_with_cols_rows() {
assertEquals "CCCC" "$(cat "${_tmpdir}/fin/CCCC")"

close_tmux_session "$_socket_file"
rm -f "${_tmpdir}"/fin/*
rmdir "${_tmpdir}"/fin
rm -rf "${_tmpdir}"/fin
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set indentation

Suggested change
rm -rf "${_tmpdir}"/fin
rm -rf "${_tmpdir}"/fin

@@ -3149,8 +3102,7 @@ test_t_and_x_option() {
assertEquals "AAAA@BBBB@CCCC@DDDD@" "$(eval "${TMUX_EXEC} -S ${_socket_file} list-panes -F '#{pane_title}'" | tr '\n' '@')"

close_tmux_session "$_socket_file"
rm -f "${_tmpdir}"/fin/*
rmdir "${_tmpdir}"/fin
rm -rf "${_tmpdir}"/fin
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
rm -rf "${_tmpdir}"/fin
rm -rf "${_tmpdir}"/fin

@@ -3184,8 +3136,7 @@ test_t_option_pipe() {
assertEquals "AAAA@BBBB@" "$(eval "${TMUX_EXEC} -S ${_socket_file} list-panes -F '#{pane_title}'" | tr '\n' '@')"

close_tmux_session "$_socket_file"
rm -f "${_tmpdir}"/fin/*
rmdir "${_tmpdir}"/fin
rm -rf "${_tmpdir}"/fin
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
rm -rf "${_tmpdir}"/fin
rm -rf "${_tmpdir}"/fin

test/cases_all.sh Outdated Show resolved Hide resolved
@ReDTerraN
Copy link
Contributor Author

Hello Greymd, thank your for your review. I managed to send it just before I got sick and was not able to look over the merge at that time. I will fix all the required changes over the upcoming next week. I will mark this as draft for now.

@ReDTerraN ReDTerraN marked this pull request as draft May 7, 2023 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants