test_ucilua.t 1019 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. set LUA_CPATH and ucilua for convenience:
  2. $ export LC_ALL=C
  3. $ [ -n "$UCI_LUA" ] && export LUA_CPATH="$(dirname "$UCI_LUA")/?.so"
  4. $ alias ucilua="valgrind --quiet --leak-check=full lua -luci"
  5. check available methods:
  6. $ ucilua -e 'table.foreach(uci,function(m) print(m) end)'
  7. add_history
  8. add_delta
  9. close
  10. set_confdir
  11. save
  12. cursor
  13. get_all
  14. foreach
  15. __gc
  16. delete
  17. set_savedir
  18. set
  19. revert
  20. get_savedir
  21. changes
  22. reorder
  23. get_confdir
  24. list_configs
  25. commit
  26. unload
  27. rename
  28. add
  29. load
  30. get
  31. run basic Lua tests:
  32. $ cp -R "$TESTDIR/config" .
  33. $ export CONFIG_DIR=$(pwd)/config
  34. $ ucilua $TESTDIR/lua/basic.lua
  35. ---------------
  36. enabled: off
  37. .anonymous: false
  38. ipaddr: 2.3.4.5
  39. .index: 2
  40. .name: lan
  41. test: 123
  42. .type: interface
  43. ifname: eth0
  44. proto: static
  45. ---------------
  46. .name: wan
  47. .type: interface
  48. .index: 3
  49. enabled: on
  50. ifname: eth1
  51. proto: dhcp
  52. .anonymous: false
  53. aliases: c d
  54. nil\tuci: Parse error (EOF with unterminated ') at line 1, byte 18 (esc)