help.txt 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. env GOGARBLE=*
  2. ! garble
  3. stderr 'Garble obfuscates Go code'
  4. stderr 'garble \[garble flags\] command'
  5. ! stderr 'usage: go build'
  6. ! stdout .
  7. ! garble -h
  8. stderr 'Garble obfuscates Go code'
  9. stderr 'garble \[garble flags\] command'
  10. ! stdout .
  11. ! garble help
  12. stderr 'Garble obfuscates Go code'
  13. stderr 'garble \[garble flags\] command'
  14. ! stdout .
  15. ! garble help foo bar
  16. stderr 'usage: garble help'
  17. ! stderr 'Garble obfuscates Go code'
  18. ! stdout .
  19. ! garble help -h
  20. stderr 'usage: garble help'
  21. ! stdout .
  22. ! garble build -h
  23. stderr 'garble \[garble flags\] build'
  24. stderr 'This command wraps "go build"'
  25. stderr 'usage: go build'
  26. stderr 'Run .go help build.'
  27. ! stderr 'Garble obfuscates Go code'
  28. ! stdout .
  29. ! garble test -h
  30. stderr 'garble \[garble flags\] test'
  31. stderr 'This command wraps "go test"'
  32. stderr 'usage: go test'
  33. stderr 'Run .go help test.'
  34. ! stderr 'Garble obfuscates Go code'
  35. ! stdout .
  36. ! garble reverse -h
  37. stderr 'garble \[garble flags\] reverse \[build flags\] package \[files\]'
  38. ! stderr 'usage: go '
  39. ! stdout .
  40. ! garble help reverse
  41. stderr 'garble \[garble flags\] reverse \[build flags\] package \[files\]'
  42. ! stderr 'usage: go '
  43. ! stdout .
  44. ! garble -badflag
  45. stderr 'flag provided but not defined'
  46. stderr 'garble \[garble flags\] command'
  47. ! stdout .
  48. ! garble badcmd
  49. stderr 'unknown command'
  50. ! garble build -badflag
  51. stderr 'usage: go build' # TODO: is this confusing?
  52. ! stdout .
  53. ! garble build -tiny
  54. stderr 'must precede command, like: garble -tiny build \./pkg'
  55. ! stdout .
  56. ! garble build -literals
  57. stderr 'must precede command, like: garble -literals build \./pkg'
  58. ! stdout .
  59. ! garble build -seed=random
  60. stderr 'must precede command, like: garble -seed=random build \./pkg'
  61. ! stdout .
  62. [!windows] ! garble /does/not/exist/compile
  63. [windows] ! garble C:\does\not\exist\compile
  64. stderr 'run "garble \[command\]"'
  65. ! garble build badpackage
  66. stderr 'package badpackage is not in GOROOT'
  67. ! stdout .
  68. ! garble build ./badpackage
  69. stderr 'directory not found'
  70. ! stdout .
  71. # Test the version command. Note that test binaries exclude VCS build info,
  72. # and we reuse the test binary for garble itself, so that's missing.
  73. # To avoid building another garble binary,
  74. # and to be able to use static VCS info, use an environment variable.
  75. # First, test without the information, and then with it.
  76. garble version
  77. stdout -count=1 'mvdan.cc/garble \(devel\)'
  78. stdout -count=1 'Build settings'
  79. stdout -count=3 '-compiler|GOOS|GOARCH'
  80. ! stdout 'vcs'
  81. # Obtained from a real build while developing.
  82. env GARBLE_TEST_BUILDSETTINGS='[{"Key":"vcs","Value":"git"},{"Key":"vcs.revision","Value":"91ea246349544769f5100c29f79cb0f173abfeea"},{"Key":"vcs.time","Value":"2022-03-18T13:45:11Z"},{"Key":"vcs.modified","Value":"true"}]'
  83. garble version
  84. stdout -count=1 'mvdan\.cc/garble v0\.0\.0-20220318134511-91ea24634954'
  85. stdout -count=1 'Build settings'
  86. stdout -count=3 '-compiler|GOOS|GOARCH'
  87. stdout -count=1 'vcs git'
  88. stdout -count=1 'vcs\.revision 91ea246349544769f5100c29f79cb0f173abfeea'
  89. stdout -count=1 'vcs\.time 2022-03-18T13:45:11Z'
  90. stdout -count=1 'vcs\.modified true'
  91. ! garble version -flag
  92. stderr 'usage: garble version'
  93. ! garble version arg
  94. stderr 'usage: garble version'
  95. # We need a dummy module for "garble build -badflag".
  96. -- go.mod --
  97. module dummy
  98. -- dummy.go --
  99. package dummy