Skip to content
Snippets Groups Projects
Commit 6c19c7c3 authored by lche0021's avatar lche0021
Browse files

add script that generate testcase case in the form of <binary> --version

parent 147616fb
No related branches found
No related tags found
3 merge requests!464Fix listdeps,!442Smoke test,!351Smoke test
#!/bin/bash
NUM_MODULE=${2:-50}
TESTCASE_DIR='./tests'
USAGE_REPORT=software_usage.txt
if [ ! -f $USAGE_REPORT ]; then
software_usage $USAGE_REPORT
fi
echo '#!/bin/bash
name=$( realpath $0 | xargs dirname | xargs basename )
ver=${1:-"default"}
bin_dirs=$(module show $name/$ver 2>&1 | sed -n "s/.* PATH \(.*\)/\1/p")
for bin in $bin_dirs; do
for i in $(ls -X $bin); do
$i --version
done
done
' > $TESTCASE_DIR/bintest
IFS_orig=$IFS
IFS=$'\n'
for i in $(head -n $NUM_MODULE $USAGE_REPORT); do
m=$(sed -n 's/\(.*\)\/\(.*\) - \(.*\)/\1 \2/p' <<< $i)
name=$(cut -f1 -d' ' <<< $m)
ver=$(cut -f2 -d' ' <<< $m)
MODIFED_PATH=$(module show $name/$ver 2>&1 | sed -n 's/.* PATH \(.*\)/\1/p')
if [ -z ${MODIFIED_PATH+_} ]; then
mkdir -p $TESTCASE_DIR/$name
cp $TESTCASE_DIR/bintest $TESTCASE_DIR/$name/bintest
chmod u+x $TESTCASE_DIR/$name/bintest
fi
done
IFS=$IFS_orig
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment