You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

117 rivejä
3.3 KiB

  1. CC = gcc
  2. CFLAGS = -Wall
  3. LDFLAGS =
  4. # Need BCM19 <-> BCM26, +PWM: BCM12 <-> BCM13, BCM18 <-> BCM17 connected (1kOhm)
  5. tests = wiringpi_test1_sysfs wiringpi_test2_sysfs wiringpi_test3_device_wpi wiringpi_test4_device_phys wiringpi_test5_default wiringpi_test6_isr wiringpi_test7_version wiringpi_test8_pwm wiringpi_test9_pwm
  6. # Need XO hardware
  7. xotests = wiringpi_xotest_test1_spi wiringpi_i2c_test1_pcf8574 wiringpi_test8_pwm wiringpi_test9_pwm
  8. # Need PiFace hardware and BCM23 <-> BCM24 , BCM18 <-> BCM17 connected (1kOhm), and PiFace Out7<->In4, Out6<->In5, R0_NO<->In6, R0_NO<->In7, R_C<-100Ohm->GND
  9. pifacetests = wiringpi_piface_test1 wiringpi_test8_pwm wiringpi_test9_pwm
  10. all: $(tests) $(xotests) $(pifacetests)
  11. wiringpi_test1_sysfs:
  12. ${CC} ${CFLAGS} wiringpi_test1_sysfs.c -o wiringpi_test1_sysfs -lwiringPi
  13. wiringpi_test2_sysfs:
  14. ${CC} ${CFLAGS} wiringpi_test2_sysfs.c -o wiringpi_test2_sysfs -lwiringPi
  15. wiringpi_test3_device_wpi:
  16. ${CC} ${CFLAGS} wiringpi_test3_device_wpi.c -o wiringpi_test3_device_wpi -lwiringPi
  17. wiringpi_test4_device_phys:
  18. ${CC} ${CFLAGS} wiringpi_test4_device_phys.c -o wiringpi_test4_device_phys -lwiringPi
  19. wiringpi_test5_default:
  20. ${CC} ${CFLAGS} wiringpi_test5_default.c -o wiringpi_test5_default -lwiringPi
  21. wiringpi_test6_isr:
  22. ${CC} ${CFLAGS} wiringpi_test6_isr.c -o wiringpi_test6_isr -lwiringPi
  23. wiringpi_test7_version:
  24. ${CC} ${CFLAGS} wiringpi_test7_version.c -o wiringpi_test7_version -lwiringPi
  25. wiringpi_test8_pwm:
  26. ${CC} ${CFLAGS} wiringpi_test8_pwm.c -o wiringpi_test8_pwm -lwiringPi
  27. wiringpi_test9_pwm:
  28. ${CC} ${CFLAGS} wiringpi_test9_pwm.c -o wiringpi_test9_pwm -lwiringPi
  29. wiringpi_piface_test1:
  30. ${CC} ${CFLAGS} wiringpi_piface_test1.c -o wiringpi_piface_test1 -lwiringPi -lwiringPiDev
  31. wiringpi_xotest_test1_spi:
  32. ${CC} ${CFLAGS} wiringpi_xotest_test1_spi.c -o wiringpi_xotest_test1_spi -lwiringPi
  33. wiringpi_i2c_test1_pcf8574:
  34. ${CC} ${CFLAGS} wiringpi_i2c_test1_pcf8574.c -o wiringpi_i2c_test1_pcf8574 -lwiringPi
  35. test:
  36. @error_state=false ; \
  37. for t in $(tests) ; do \
  38. echo === unit test: $${t} === ; \
  39. if [ $${t} = *"8_pwm" ] || [ $${t} = *"9_pwm" ]; then \
  40. time sudo ./$${t} ; \
  41. else \
  42. time ./$${t} ; \
  43. fi ; \
  44. if [ $$? -ne 0 ]; then \
  45. error_state=true ; \
  46. fi ; \
  47. echo ; echo ; \
  48. done ; \
  49. if [ "$$error_state" = true ]; then \
  50. echo "\n\e[5mSTD TEST FAILED\e[0m\n"; \
  51. else \
  52. echo "\n\e[5mSTD TEST SUCCESS\e[0m\n"; \
  53. fi
  54. xotest:
  55. @error_state=false ; \
  56. for t in $(tests) $(xotests) ; do \
  57. echo === XO unit test: $${t} === ; \
  58. if [ $${t} = *"8_pwm" ] || [ $${t} = *"9_pwm" ]; then \
  59. time sudo ./$${t} ; \
  60. else \
  61. time ./$${t} ; \
  62. fi ; \
  63. if [ $$? -ne 0 ]; then \
  64. error_state=true ; \
  65. fi ; \
  66. echo ; echo ; \
  67. done
  68. if [ "$$error_state" = true ]; then \
  69. echo "\n\e[5mSTD/XO TEST FAILED\e[0m\n"; \
  70. else \
  71. echo "\n\e[5mSTD/XO TEST SUCCESS\e[0m\n"; \
  72. fi
  73. pifacetest:
  74. @error_state=false ; \
  75. for t in $(tests) $(pifacetests) ; do \
  76. echo === PiFace unit test: $${t} === ; \
  77. if [ $${t} = *"8_pwm" ] || [ $${t} = *"9_pwm" ]; then \
  78. time sudo ./$${t} ; \
  79. else \
  80. time ./$${t} ; \
  81. fi ; \
  82. if [ $$? -ne 0 ]; then \
  83. error_state=true ; \
  84. fi ; \
  85. echo ; echo ; \
  86. done
  87. if [ "$$error_state" = true ]; then \
  88. echo "\n\e[5mPIFACE TEST FAILED\e[0m\n"; \
  89. else \
  90. echo "\n\e[5mPIFACE TEST SUCCESS\e[0m\n"; \
  91. fi
  92. clean:
  93. for t in $(tests) $(xotests) $(pifacetests) ; do \
  94. rm -fv $${t} ; \
  95. done