Skip to content

Commit

Permalink
test strange file and repo names
Browse files Browse the repository at this point in the history
  • Loading branch information
lueFlake authored Oct 16, 2024
1 parent e04db0f commit 54f3eba
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions tests/steps/test-summarize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,68 +24,69 @@ set -e
set -o pipefail

stdout=$2
file_name="file -p \(test \) \\n\?.k"
repo_name="comp_.lex\$repo\[info\]>"

{
echo "${TARGET}"
rm -rf "${TARGET}/data"
rm -rf "${TARGET}/measurements"
rm -rf "${TARGET}/summary"
rm -rf "${TARGET}/temp"
dir1="${TARGET}/measurements/repo1"
dir1="${TARGET}/measurements/${repo_name}1"
mkdir -p "${dir1}"
"${LOCAL}/steps/summarize.sh"
test -z "$(ls -A "${TARGET}/data/summary")"
} > "${stdout}" 2>&1
echo "👍🏻 Summarization step handled empty repository correctly"
echo "👍🏻 Summarization step handled empty ${repo_name}sitory correctly"

{
rm -rf "${TARGET}/data"
rm -rf "${TARGET}/measurements"
rm -rf "${TARGET}/summary"
rm -rf "${TARGET}/temp"
dir1="${TARGET}/measurements/repo1"
dir1="${TARGET}/measurements/${repo_name}1"
mkdir -p "${TARGET}/temp"
touch "${TARGET}/temp/repos-to-aggregate.txt"
echo "repo1" >> "${TARGET}/temp/repos-to-aggregate.txt"
echo "${repo_name}1" >> "${TARGET}/temp/repos-to-aggregate.txt"
mkdir -p "${dir1}"
echo "50" > "${dir1}/file1.m.LOC"
echo "100" > "${dir1}/file2.m.LOC"
echo "10" > "${dir1}/file1.m.CYC"
echo "20" > "${dir1}/file2.m.CYC"
echo "50" > "${dir1}/${file_name}1.m.LOC"
echo "100" > "${dir1}/${file_name}2.m.LOC"
echo "10" > "${dir1}/${file_name}1.m.CYC"
echo "20" > "${dir1}/${file_name}2.m.CYC"
"${LOCAL}/steps/summarize.sh"
test -e "${TARGET}/data/summary/LOC.csv"
test -e "${TARGET}/data/summary/CYC.csv"
grep "repo1,2,150" < "${TARGET}/data/summary/LOC.csv"
grep "repo1,2,30" < "${TARGET}/data/summary/CYC.csv"
grep "${repo_name}1,2,150" < "${TARGET}/data/summary/LOC.csv"
grep "${repo_name}1,2,30" < "${TARGET}/data/summary/CYC.csv"
} > "${stdout}" 2>&1
echo "👍🏻 Summarization step handled multiple metrics correctly"


{
rm -rf "${TARGET}/data"
rm -rf "${TARGET}/measurements"
rm -rf "${TARGET}/summary"
rm -rf "${TARGET}/temp"
dir1="${TARGET}/measurements/repo1"
dir1="${TARGET}/measurements/${repo_name}1"
mkdir -p "${TARGET}/temp"
touch "${TARGET}/temp/repos-to-aggregate.txt"
echo "repo1" >> "${TARGET}/temp/repos-to-aggregate.txt"
echo "repo2" >> "${TARGET}/temp/repos-to-aggregate.txt"
echo "${repo_name}1" >> "${TARGET}/temp/repos-to-aggregate.txt"
echo "${repo_name}2" >> "${TARGET}/temp/repos-to-aggregate.txt"
mkdir -p "${dir1}"
echo "50" > "${dir1}/file1.m.LOC"
echo "100" > "${dir1}/file2.m.LOC"
echo "10" > "${dir1}/file1.m.CYC"
dir2="${TARGET}/measurements/repo2"
echo "50" > "${dir1}/${file_name}1.m.LOC"
echo "100" > "${dir1}/${file_name}2.m.LOC"
echo "10" > "${dir1}/${file_name}1.m.CYC"
dir2="${TARGET}/measurements/${repo_name}2"
mkdir -p "${dir2}"
echo "25" > "${dir2}/file1.m.LOC"
echo "25" > "${dir2}/${file_name}1.m.LOC"
"${LOCAL}/steps/summarize.sh"
test -e "${TARGET}/data/summary/LOC.csv"
grep "repo1,2,150" < "${TARGET}/data/summary/LOC.csv"
grep "repo2,1,25" < "${TARGET}/data/summary/LOC.csv"
grep "${repo_name}1,2,150" < "${TARGET}/data/summary/LOC.csv"
grep "${repo_name}2,1,25" < "${TARGET}/data/summary/LOC.csv"
test -e "${TARGET}/data/summary/CYC.csv"
grep "repo1,1,10" < "${TARGET}/data/summary/CYC.csv"
if grep "repo2" < "${TARGET}/data/summary/CYC.csv"; then
grep "${repo_name}1,1,10" < "${TARGET}/data/summary/CYC.csv"
if grep "${repo_name}2" < "${TARGET}/data/summary/CYC.csv"; then
exit 1
fi
} > "${stdout}" 2>&1
echo "👍🏻 Summarization step handled mixed metrics across repositories correctly"
echo "👍🏻 Summarization step handled mixed metrics across repositories correctly"

0 comments on commit 54f3eba

Please sign in to comment.