aboutsummaryrefslogblamecommitdiff
path: root/ROMFS/px4fmu_test/init.d/rcS
blob: 2c5c0e559ba2f7c60f3c9e71c61f17fa1c71ea5f (plain) (tree)
1
2
3
4
5
6
7
8
9
10



                                         

                       
          


         
                                          


                                   




                                

                                     
    
                                              


                                        
                                        




                        









                                                    

              

                       


                                                                          

  

                       






                                           






                                                   

                                                                                          



                                          

                                                                                  



          

                                                                      
                                         


                   





                                                            

              
    



                                                                            

               
    



                                                                              

              
    



                                                                         
         



             
 

            

                                                                           

  






                                                               
  

       
#!nsh
#
# PX4FMU startup script for test hackery.
#
set unit_test_failure 0

uorb start

if sercon
then
	echo "[i] USB interface connected"

	# Try to get an USB console
	nshterm /dev/ttyACM0 &
fi

#
# Try to mount the microSD card.
#
mount -t vfat /dev/mmcsd0 /fs/microsd
if [ $? == 0 ]
then
	echo "[i] card mounted at /fs/microsd"
	# Start playing the startup tune
	tone_alarm start
else
	echo "[i] no microSD card found"
	# Play SOS
	tone_alarm error
fi

#
# Start a minimal system
#

if [ -f /etc/extras/px4io-v2_default.bin ]
then
	set io_file /etc/extras/px4io-v2_default.bin
else
	set io_file /etc/extras/px4io-v1_default.bin
fi

px4io start
if [ $? == 0 ]
then
	echo "PX4IO OK"
else
	set unit_test_failure 1
	set unit_test_failure_list "${unit_test_failure_list} px4io_start"
fi

px4io checkcrc $io_file
if [ $? == 0 ]
then
	echo "PX4IO CRC OK"
else
	echo "PX4IO CRC failure"
	tone_alarm MBABGP
	if px4io forceupdate 14662 $io_file
	then
		if px4io start
		then
			echo "PX4IO restart OK"
			tone_alarm MSPAA
		else
			echo "PX4IO restart failed"
			tone_alarm MNGGG
			set unit_test_failure 1
			set unit_test_failure_list "${unit_test_failure_list} px4io_flash"
		fi
	else
		echo "PX4IO update failed"
		tone_alarm MNGGG
		set unit_test_failure 1
		set unit_test_failure_list "${unit_test_failure_list} px4io_flash"
	fi
fi

#
# The presence of this file suggests we're running a mount stress test
#
if [ -f /fs/microsd/mount_test_cmds.txt ]
then
	tests mount
fi

#
# Run unit tests at board boot, reporting failure as needed.
# Add new unit tests using the same pattern as below.
#

mavlink_tests
if [ $? != 0 ]
then
	set unit_test_failure 1
	set unit_test_failure_list "${unit_test_failure_list} mavlink_tests"
fi

commander_tests
if [ $? != 0 ]
then
	set unit_test_failure 1
	set unit_test_failure_list "${unit_test_failure_list} commander_tests"
fi

uorb test
if [ $? != 0 ]
then
	set unit_test_failure 1
	set unit_test_failure_list "${unit_test_failure_list} uorb_tests"
fi

adc start
ms5611 start
mpu6000 start
lsm303d start
l3gd20 start

if tests all
then
	set unit_test_failure 1
	set unit_test_failure_list "${unit_test_failure_list} system_tests"
fi

if [ $unit_test_failure == 0 ]
then
	echo
	echo "All Unit Tests PASSED"
else
	echo
	echo "Some Unit Tests FAILED:${unit_test_failure_list}"
fi

ver all