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.
 
 
 
 
 

92 lines
2.4 KiB

  1. CC = gcc
  2. CFLAGS = -Wall
  3. LDFLAGS =
  4. tests = wiringpi_test1_sysfs wiringpi_test2_sysfs wiringpi_test3_device_wpi wiringpi_test4_device_phys wiringpi_test5_default wiringpi_test6_isr wiringpi_test7_version
  5. xotests = wiringpi_xotest_test1_spi
  6. i2ctests = wiringpi_i2c_test1_pcf8574
  7. all: $(tests) $(xotests) $(i2ctests)
  8. wiringpi_test1_sysfs:
  9. ${CC} ${CFLAGS} wiringpi_test1_sysfs.c -o wiringpi_test1_sysfs -lwiringPi
  10. wiringpi_test2_sysfs:
  11. ${CC} ${CFLAGS} wiringpi_test2_sysfs.c -o wiringpi_test2_sysfs -lwiringPi
  12. wiringpi_test3_device_wpi:
  13. ${CC} ${CFLAGS} wiringpi_test3_device_wpi.c -o wiringpi_test3_device_wpi -lwiringPi
  14. wiringpi_test4_device_phys:
  15. ${CC} ${CFLAGS} wiringpi_test4_device_phys.c -o wiringpi_test4_device_phys -lwiringPi
  16. wiringpi_test5_default:
  17. ${CC} ${CFLAGS} wiringpi_test5_default.c -o wiringpi_test5_default -lwiringPi
  18. wiringpi_test6_isr:
  19. ${CC} ${CFLAGS} wiringpi_test6_isr.c -o wiringpi_test6_isr -lwiringPi
  20. wiringpi_test7_version:
  21. ${CC} ${CFLAGS} wiringpi_test7_version.c -o wiringpi_test7_version -lwiringPi
  22. wiringpi_xotest_test1_spi:
  23. ${CC} ${CFLAGS} wiringpi_xotest_test1_spi.c -o wiringpi_xotest_test1_spi -lwiringPi
  24. wiringpi_i2c_test1_pcf8574:
  25. ${CC} ${CFLAGS} wiringpi_i2c_test1_pcf8574.c -o wiringpi_i2c_test1_pcf8574 -lwiringPi
  26. test:
  27. @error_state=false ; \
  28. for t in $(tests) ; do \
  29. echo === unit test: $${t} === ; \
  30. time ./$${t}; \
  31. if [ $$? -ne 0 ]; then \
  32. error_state=true ; \
  33. fi ; \
  34. echo ; echo ; \
  35. done ; \
  36. if [ "$$error_state" = true ]; then \
  37. echo "\n\e[5mSTD TEST FAILED\e[0m\n"; \
  38. else \
  39. echo "\n\e[5mSTD TEST SUCCESS\e[0m\n"; \
  40. fi
  41. xotest:
  42. @error_state=false ; \
  43. for t in $(tests) $(xotests) ; do \
  44. echo === XO unit test: $${t} === ; \
  45. time ./$${t} ; \
  46. if [ $$? -ne 0 ]; then \
  47. error_state=true ; \
  48. fi ; \
  49. echo ; echo ; \
  50. done
  51. if [ "$$error_state" = true ]; then \
  52. echo "\n\e[5mSTD/XO TEST FAILED\e[0m\n"; \
  53. else \
  54. echo "\n\e[5mSTD/XO TEST SUCCESS\e[0m\n"; \
  55. fi
  56. i2ctest:
  57. @error_state=false ; \
  58. for t in $(tests) $(i2ctests) ; do \
  59. echo === I2C unit test: $${t} === ; \
  60. time ./$${t} ; \
  61. if [ $$? -ne 0 ]; then \
  62. error_state=true ; \
  63. fi ; \
  64. echo ; echo ; \
  65. done
  66. if [ "$$error_state" = true ]; then \
  67. echo "\n\e[5mSTD/I2C TEST FAILED\e[0m\n"; \
  68. else \
  69. echo "\n\e[5mSTD/I2C TEST SUCCESS\e[0m\n"; \
  70. fi
  71. clean:
  72. for t in $(tests) $(xotests) $(i2ctests) ; do \
  73. rm -fv $${t} ; \
  74. done