M7350v1_en_gpl

This commit is contained in:
T
2024-09-09 08:52:07 +00:00
commit f9cc65cfda
65988 changed files with 26357421 additions and 0 deletions

View File

@ -0,0 +1,137 @@
#!/bin/bash
# compiler test script running in target
#
# Author: Jiajun Xu <jiajun.xu@intel.com>
#
# This file is licensed under the GNU General Public License,
# Version 2.
#
# Prepare test folder for compiler test
COMPILE_FOLDER="/opt/test/compile_test"
TEST_FILE="$COMPILE_FOLDER/compile_test.c"
EXECUTE_FILE="$COMPILE_FOLDER/compile_test"
TEST_MAKEFILE="$COMPILE_FOLDER/makefile"
TEST_LIST="gcc g++ make"
if [ ! -d $COMPILE_FOLDER ]; then
mkdir -p $COMPILE_FOLDER
fi
Target_Info()
{
echo -e "\tTARGET: $*"
}
Target_Err()
{
echo -e "\tTARGET: ##### Error Log #####"
$@
echo -e "\tTARGET: ##### End #####"
}
# Function to generate a c test file for compiler testing
Gen_File()
{
temp=`mktemp`
# Generate c/c++ test file for compiler testing
echo "#include <stdio.h>" >> $temp
echo "#include <math.h>" >> $temp
echo "" >> $temp
echo "double" >> $temp
echo "convert(long long l)" >> $temp
echo "{" >> $temp
echo " return (double)l; // or double(l)" >> $temp
echo "}" >> $temp
echo "" >> $temp
echo "int" >> $temp
echo "main(int argc, char * argv[])" >> $temp
echo "{" >> $temp
echo " long long l = 10;" >> $temp
echo " double f;" >> $temp
echo "" >> $temp
echo " f = convert(l);" >> $temp
echo " printf(\"convert: %lld => %f\n\", l, f);" >> $temp
echo "" >> $temp
echo " f = 1234.67;" >> $temp
echo " printf(\"floorf(%f) = %f\n\", f, floorf(f));" >> $temp
echo " return 0;" >> $temp
echo "}" >> $temp
echo $temp
}
# Function to generate a makefile for compiler testing
Gen_Makefile()
{
temp=`mktemp`
basename=`basename $EXECUTE_FILE`
echo -e "$basename: $basename.o" >> $temp
echo -e "\tgcc -o $basename $basename.o -lm" >> $temp
echo -e "$basename.o: $basename.c" >> $temp
echo -e "\tgcc -c $basename.c" >> $temp
echo $temp
}
# Generate a c test file for compiler testing
test_file=`Gen_File`
MOVE=`which mv`
$MOVE $test_file $TEST_FILE
# Begin compiler test in target
for cmd in $TEST_LIST
do
which $cmd
if [ $? -ne 0 ]; then
Target_Info "No $cmd command found"
exit 1
fi
if [ "$cmd" == "make" ]; then
rm -rf $EXECUTE_FILE
# For makefile test, we need to generate a makefile and run with a c file
makefile=`Gen_Makefile`
$MOVE $makefile $TEST_MAKEFILE
cd `dirname $TEST_MAKEFILE`
make
if [ $? -ne 0 ]; then
Target_Info "$cmd running with error, Pls. check error in following"
Target_Err make
exit 1
fi
else
rm -rf $EXECUTE_FILE
# For gcc/g++, we compile a c test file and check the output
$cmd $TEST_FILE -o $EXECUTE_FILE -lm
if [ $? -ne 0 ]; then
Target_Info "$cmd running with error, Pls. check error in following"
Target_Err $cmd $TEST_FILE -o $EXECUTE_FILE -lm
exit 1
fi
fi
# Check if the binary file generated by $cmd can work without error
if [ -f $EXECUTE_FILE ]; then
$EXECUTE_FILE
if [ $? -ne 0 ]; then
Target_Info "$EXECUTE_FILE running with error, Pls. check error in following"
Target_Err $EXECUTE_FILE
exit 1
else
Target_Info "$cmd can work without problem in target"
fi
else
Target_Info "No executalbe file $EXECUTE_FILE found, Pls. check the error log"
exit 1
fi
done
exit 0

View File

@ -0,0 +1,75 @@
#!/bin/bash
# connman test script running in target
#
# Author: Jiajun Xu <jiajun.xu@intel.com>
#
# This file is licensed under the GNU General Public License,
# Version 2.
#
Target_Info()
{
echo -e "\tTARGET: $*"
}
Target_Err()
{
echo -e "\tTARGET: connman has issue when running, Pls. check the error log"
echo -e "\tTARGET: ##### Error Log #####"
$1
echo -e "\tTARGET: ##### End #####"
}
# Check if ps comes from Procps or busybox first
ls -l `which ps` | grep -q "busybox"
RET=$?
if [ $RET -eq 0 ]; then
PS="ps"
else
PS="ps -ef"
fi
# Check if connmand is in target
if [ ! -f /usr/sbin/connmand ]; then
Target_Info "No connmand command found"
exit 1
fi
# Check if connmand is running in background
if [ $RET -eq 0 ]; then
count=`ps | awk '{print $5}' | grep -c connmand`
else
count=`ps -eo comm | cut -d " " -f 1 | grep -c connmand`
fi
if [ $count -ne 1 ]; then
Target_Info "connmand has issue when running in background, Pls, check the output of ps"
${PS} | grep connmand
exit 1
fi
# Check if there is always only one connmand running in background
if [ connmand > /dev/null 2>&1 ]; then
Target_Info "connmand command run without problem"
if [ $RET -eq 0 ]; then
count=`ps | awk '{print $5}' | grep -c connmand`
else
count=`ps -eo comm | cut -d " " -f 1 | grep -c connmand`
fi
if [ $count -ne 1 ]; then
Target_Info "There are more than one connmand running in background, Pls, check the output of ps"
${PS} | grep connmand
exit 1
else
Target_Info "There is always one connmand running in background, test pass"
exit 0
fi
else
Target_Err connmand
exit 1
fi
exit 0

View File

@ -0,0 +1,26 @@
#!/bin/bash
# Dmesg test script running in QEMU
#
# Author: Jiajun Xu <jiajun.xu@intel.com>
#
# This file is licensed under the GNU General Public License,
# Version 2.
#
which dmesg
if [ $? -ne 0 ]; then
echo "QEMU: No dmesg command found"
exit 1
fi
dmesg | grep -iq "error"
if [ $? -eq 0 ]; then
echo "QEMU: There is some error log in dmesg:"
echo "QEMU: ##### Error Log ######"
dmesg | grep -i "error"
echo "QEMU: ##### End ######"
exit 1
else
echo "QEMU: No error log in dmesg"
exit 0
fi

View File

@ -0,0 +1,45 @@
#!/bin/bash
# rpm test script running in target
#
# Author: Jiajun Xu <jiajun.xu@intel.com>
#
# This file is licensed under the GNU General Public License,
# Version 2.
#
Target_Info()
{
echo -e "\tTARGET: $*"
}
Target_Err()
{
echo -e "\tTARGET: rpm command has issue when running, Pls. check the error log"
echo -e "\tTARGET: ##### Error Log #####"
$1
echo -e "\tTARGET: ##### End #####"
}
which rpm
if [ $? -ne 0 ]; then
Target_Info "No rpm command found"
exit 1
fi
if [ rpm > /dev/null 2>&1 ]; then
Target_Info "rpm command run without problem"
else
Target_Err rpm
exit 1
fi
# run rpm with specific command parsed to rpm_test.sh
rpm $* > /dev/null 2>&1
if [ $? -eq 0 ]; then
Target_Info "rpm $* work without problem"
exit 0
else
Target_Err rpm $*
exit 1
fi

View File

@ -0,0 +1,45 @@
#!/bin/bash
# zypper test script running in target
#
# Author: Jiajun Xu <jiajun.xu@intel.com>
#
# This file is licensed under the GNU General Public License,
# Version 2.
#
Target_Info()
{
echo -e "\tTARGET: $*"
}
Target_Err()
{
echo -e "\tTARGET: zypper command has issue when running, Pls. check the error log"
echo -e "\tTARGET: ##### Error Log #####"
$1
echo -e "\tTARGET: ##### End #####"
}
which zypper
if [ $? -ne 0 ]; then
Target_Info "No zypper command found"
exit 1
fi
if [ zypper > /dev/null 2>&1 ]; then
Target_Info "zypper command run without problem"
else
Target_Err zypper
exit 1
fi
# run zypper with specific command parsed to zypper_test.sh
zypper $* > /dev/null 2>&1
if [ $? -eq 0 ]; then
Target_Info "zypper $* work without problem"
exit 0
else
Target_Err zypper $*
exit 1
fi