Skip to content

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.

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}

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

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

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

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

@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