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

use testfiles from origin #19

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed testdemos_files/deps/regamedll/cstrike/dlls/mp.dll
Binary file not shown.
33 changes: 33 additions & 0 deletions testdemos_files/runTest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# rsync -a deps/rehlds/* .

Check failure on line 1 in testdemos_files/runTest.sh

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

testdemos_files/runTest.sh#L1

Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

Choose a reason for hiding this comment

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

Codacy found a critical Error Prone issue: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

The issue identified by ShellCheck is that the script lacks a shebang line, which specifies the interpreter that should be used to execute the script. Without a shebang, the shell used to run the script is determined by the environment, which can lead to inconsistencies and unexpected behavior if the script is run in different environments. Adding a shebang ensures that the script is executed with the intended shell, making it more portable and less error-prone.

To fix this issue, you should add a shebang line at the top of the script to specify the shell. For example, if you want to use Bash, you can add #!/bin/bash as the first line of the script.

Suggested change
# rsync -a deps/rehlds/* .
#!/bin/bash

This comment was generated by an experimental AI tool.


# demo="cstrike-muliplayer-1"
# desc="CS: Multiplayer"

params=$(cat "testdemos/${demo}.params")

echo -e "\e[1;36m${desc} testing...\e[0m"
echo -e " - \e[0;33mParameters: $params\e[0m"

retVal=0
wine hlds.exe --rehlds-enable-all-hooks --rehlds-test-play "testdemos/${demo}.bin" $params &> result.log || retVal=$?
if [ $retVal -ne 777 ] && [ $retVal -ne 9 ]; then
echo -e " 🔸 🔸 🔸 🔸 🔸 🔸 🔸 🔸 🔸 🔸"

if [ -f rehlds_demo_error.txt ]; then
while read line; do
echo -e " \e[1;31m$line";
done < rehlds_demo_error.txt
else
echo -e " \e[1;33mrehlds_demo_error.txt not found, dumping result.log:\e[0m"
cat result.log
fi
echo -e " \e[30;41mExit code: $retVal\e[0m"
echo -e "\e[1;36m${desc} testing...\e[1;31m Failed ❌\e[0m"
exit 6 # Test demo failed
else
while read line; do
echo -e " \e[0;33m$line"
done <<< $(cat result.log | sed '/wine:/d;/./,$!d')

Check notice on line 30 in testdemos_files/runTest.sh

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

testdemos_files/runTest.sh#L30

Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.

Choose a reason for hiding this comment

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

ℹ️ Codacy found a minor Performance issue: Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.

The issue identified by ShellCheck is that the use of cat in the command $(cat result.log | sed '/wine:/d;/./,$!d') is unnecessary and inefficient. The cat command is used to output the contents of a file, but in this context, it can be avoided by directly passing the file as an argument to the sed command. This approach reduces the number of processes spawned and is generally considered more efficient.

Here is the suggested change to fix the issue:

Suggested change
done <<< $(cat result.log | sed '/wine:/d;/./,$!d')
done <<< $(sed '/wine:/d;/./,$!d' result.log)

This comment was generated by an experimental AI tool.

echo -e " \e[30;43mExit code: $retVal\e[0m"
echo -e "\e[1;36m${desc} testing...\e[1;32m Succeed ✔\e[0m"
fi