Vagrantfile 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  1. require 'date'
  2. Vagrant.configure(2) do |config|
  3. # We use Ubuntu instead of Debian because the image comes with two-way
  4. # shared folder support by default.
  5. UBUNTU = 'hashicorp/bionic64'
  6. config.vm.define(:exa) do |config|
  7. config.vm.provider :virtualbox do |v|
  8. v.name = 'exa'
  9. v.memory = 2048
  10. v.cpus = `nproc`.chomp.to_i
  11. end
  12. config.vm.provider :vmware_desktop do |v|
  13. v.vmx['memsize'] = '2048'
  14. v.vmx['numvcpus'] = `nproc`.chomp
  15. end
  16. config.vm.box = UBUNTU
  17. config.vm.hostname = 'exa'
  18. # Make sure we know the VM image’s default user name. The ‘cassowary’ user
  19. # (specified later) is used for most of the test *output*, but we still
  20. # need to know where the ‘target’ and ‘.cargo’ directories go.
  21. developer = 'vagrant'
  22. # Install the dependencies needed for exa to build, as quietly as
  23. # apt can do.
  24. config.vm.provision :shell, privileged: true, inline: <<-EOF
  25. set -xe
  26. apt-get update
  27. apt-get install -qq -o=Dpkg::Use-Pty=0 -y \
  28. git cmake curl attr libgit2-dev zip \
  29. fish zsh bash bash-completion
  30. EOF
  31. # Guarantee that the timezone is UTC -- some of the tests
  32. # depend on this (for now).
  33. config.vm.provision :shell, privileged: true, inline:
  34. %[timedatectl set-timezone UTC]
  35. # Install Rust.
  36. # This is done as vagrant, not root, because it’s vagrant
  37. # who actually uses it. Sent to /dev/null because the progress
  38. # bar produces a ton of output.
  39. config.vm.provision :shell, privileged: false, inline: <<-EOF
  40. if hash rustc &>/dev/null; then
  41. echo "Rust is already installed"
  42. else
  43. set -xe
  44. curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
  45. cargo install cargo-hack
  46. fi
  47. EOF
  48. # Install Just, the command runner.
  49. config.vm.provision :shell, privileged: true, inline: <<-EOF
  50. if hash just &>/dev/null; then
  51. echo "just is already installed"
  52. else
  53. wget "https://github.com/casey/just/releases/download/v0.8.0/just-v0.8.0-x86_64-unknown-linux-musl.tar.gz"
  54. tar -xf "just-v0.8.0-x86_64-unknown-linux-musl.tar.gz"
  55. cp just /usr/local/bin
  56. fi
  57. EOF
  58. # Use a different ‘target’ directory on the VM than on the host.
  59. # By default it just uses the one in /vagrant/target, which can
  60. # cause problems if it has different permissions than the other
  61. # directories, or contains object files compiled for the host.
  62. config.vm.provision :shell, privileged: true, inline: <<-EOF
  63. echo 'PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/#{developer}/.cargo/bin"' > /etc/environment
  64. echo 'CARGO_TARGET_DIR="/home/#{developer}/target"' >> /etc/environment
  65. EOF
  66. # Create a variety of misc scripts.
  67. config.vm.provision :shell, privileged: true, inline: <<-EOF
  68. set -xe
  69. ln -sf /vagrant/devtools/dev-run-debug.sh /usr/bin/exa
  70. ln -sf /vagrant/devtools/dev-run-release.sh /usr/bin/rexa
  71. echo -e "#!/bin/sh\ncargo build --manifest-path /vagrant/Cargo.toml \\$@" > /usr/bin/build-exa
  72. ln -sf /usr/bin/build-exa /usr/bin/b
  73. echo -e "#!/bin/sh\ncargo test --manifest-path /vagrant/Cargo.toml \\$@ -- --quiet" > /usr/bin/test-exa
  74. ln -sf /usr/bin/test-exa /usr/bin/t
  75. echo -e "#!/bin/sh\n/vagrant/xtests/run.sh" > /usr/bin/run-xtests
  76. ln -sf /usr/bin/run-xtests /usr/bin/x
  77. echo -e "#!/bin/sh\nbuild-exa && test-exa && run-xtests" > /usr/bin/compile-exa
  78. ln -sf /usr/bin/compile-exa /usr/bin/c
  79. echo -e "#!/bin/sh\nbash /vagrant/devtools/dev-package-for-linux.sh \\$@" > /usr/bin/package-exa
  80. echo -e "#!/bin/sh\ncat /etc/motd" > /usr/bin/halp
  81. chmod +x /usr/bin/{exa,rexa,b,t,x,c,build-exa,test-exa,run-xtests,compile-exa,package-exa,halp}
  82. EOF
  83. # This fix is applied by changing the VM rather than changing the
  84. # Cargo.toml file so it works for everyone because it’s such a niche
  85. # build issue, it’s not worth specifying a non-crates.io dependency
  86. # and losing the ability to `cargo publish` the exa crate there!
  87. # It also isolates the hackiness to the one place I can test it
  88. # actually works.
  89. # Configure the welcoming text that gets shown.
  90. config.vm.provision :shell, privileged: true, inline: <<-EOF
  91. rm -f /etc/update-motd.d/*
  92. # Capture the help text so it gets displayed first
  93. bash /vagrant/devtools/dev-help.sh > /etc/motd
  94. # Tell bash to execute a bunch of stuff when a session starts
  95. echo "source /vagrant/devtools/dev-bash.sh" > /home/#{developer}/.bash_profile
  96. chown #{developer} /home/#{developer}/.bash_profile
  97. # Disable last login date in sshd
  98. sed -i '/PrintLastLog yes/c\PrintLastLog no' /etc/ssh/sshd_config
  99. systemctl restart sshd
  100. EOF
  101. # Link the completion files so they’re “installed”.
  102. config.vm.provision :shell, privileged: true, inline: <<-EOF
  103. set -xe
  104. test -h /etc/bash_completion.d/exa \
  105. || ln -s /vagrant/contrib/completions.bash /etc/bash_completion.d/exa
  106. test -h /usr/share/zsh/vendor-completions/_exa \
  107. || ln -s /vagrant/contrib/completions.zsh /usr/share/zsh/vendor-completions/_exa
  108. test -h /usr/share/fish/completions/exa.fish \
  109. || ln -s /vagrant/contrib/completions.fish /usr/share/fish/completions/exa.fish
  110. EOF
  111. # We create two users that own the test files.
  112. # The first one just owns the ordinary ones, because we don’t want the
  113. # test outputs to depend on “vagrant” or “ubuntu” existing.
  114. user = "cassowary"
  115. config.vm.provision :shell, privileged: true, inline:
  116. %[id -u #{user} &>/dev/null || useradd #{user}]
  117. # The second one has a long name, to test that the file owner column
  118. # widens correctly. The benefit of Vagrant is that we don’t need to
  119. # set this up on the *actual* system!
  120. longuser = "antidisestablishmentarienism"
  121. config.vm.provision :shell, privileged: true, inline:
  122. %[id -u #{longuser} &>/dev/null || useradd #{longuser}]
  123. # Because the timestamps are formatted differently depending on whether
  124. # they’re in the current year or not (see `details.rs`), we have to make
  125. # sure that the files are created in the current year, so they get shown
  126. # in the format we expect.
  127. current_year = Date.today.year
  128. some_date = "#{current_year}01011234.56" # 1st January, 12:34:56
  129. # We also need an UID and a GID that are guaranteed to not exist, to
  130. # test what happen when they don’t.
  131. invalid_uid = 666
  132. invalid_gid = 616
  133. # Delete old testcases if they exist already, then create a
  134. # directory to house new ones.
  135. test_dir = "/testcases"
  136. config.vm.provision :shell, privileged: true, inline: <<-EOF
  137. set -xe
  138. rm -rfv #{test_dir}
  139. mkdir #{test_dir}
  140. chmod 777 #{test_dir}
  141. EOF
  142. # Awkward file size testcases.
  143. # This needs sudo to set the files’ users at the very end.
  144. config.vm.provision :shell, privileged: false, inline: <<-EOF
  145. set -xe
  146. mkdir "#{test_dir}/files"
  147. for i in {1..13}; do
  148. fallocate -l "$i" "#{test_dir}/files/$i"_bytes
  149. fallocate -l "$i"KiB "#{test_dir}/files/$i"_KiB
  150. fallocate -l "$i"MiB "#{test_dir}/files/$i"_MiB
  151. done
  152. touch -t #{some_date} "#{test_dir}/files/"*
  153. chmod 644 "#{test_dir}/files/"*
  154. sudo chown #{user}:#{user} "#{test_dir}/files/"*
  155. EOF
  156. # File name extension testcases.
  157. # These aren’t tested in details view, but we set timestamps on them to
  158. # test that various sort options work.
  159. config.vm.provision :shell, privileged: false, inline: <<-EOF
  160. set -xe
  161. mkdir "#{test_dir}/file-names-exts"
  162. touch "#{test_dir}/file-names-exts/Makefile"
  163. touch "#{test_dir}/file-names-exts/IMAGE.PNG"
  164. touch "#{test_dir}/file-names-exts/image.svg"
  165. touch "#{test_dir}/file-names-exts/VIDEO.AVI"
  166. touch "#{test_dir}/file-names-exts/video.wmv"
  167. touch "#{test_dir}/file-names-exts/music.mp3"
  168. touch "#{test_dir}/file-names-exts/MUSIC.OGG"
  169. touch "#{test_dir}/file-names-exts/lossless.flac"
  170. touch "#{test_dir}/file-names-exts/lossless.wav"
  171. touch "#{test_dir}/file-names-exts/crypto.asc"
  172. touch "#{test_dir}/file-names-exts/crypto.signature"
  173. touch "#{test_dir}/file-names-exts/document.pdf"
  174. touch "#{test_dir}/file-names-exts/DOCUMENT.XLSX"
  175. touch "#{test_dir}/file-names-exts/COMPRESSED.ZIP"
  176. touch "#{test_dir}/file-names-exts/compressed.tar.gz"
  177. touch "#{test_dir}/file-names-exts/compressed.tgz"
  178. touch "#{test_dir}/file-names-exts/compressed.tar.xz"
  179. touch "#{test_dir}/file-names-exts/compressed.txz"
  180. touch "#{test_dir}/file-names-exts/compressed.deb"
  181. touch "#{test_dir}/file-names-exts/backup~"
  182. touch "#{test_dir}/file-names-exts/#SAVEFILE#"
  183. touch "#{test_dir}/file-names-exts/file.tmp"
  184. touch "#{test_dir}/file-names-exts/compiled.class"
  185. touch "#{test_dir}/file-names-exts/compiled.o"
  186. touch "#{test_dir}/file-names-exts/compiled.js"
  187. touch "#{test_dir}/file-names-exts/compiled.coffee"
  188. EOF
  189. # File name testcases.
  190. # bash really doesn’t want you to create a file with escaped characters
  191. # in its name, so we have to resort to the echo builtin and touch!
  192. #
  193. # The double backslashes are not strictly necessary; without them, Ruby
  194. # will interpolate them instead of bash, but because Vagrant prints out
  195. # each command it runs, your *own* terminal will go “ding” from the alarm!
  196. config.vm.provision :shell, privileged: false, inline: <<-EOF
  197. set -xe
  198. mkdir "#{test_dir}/file-names"
  199. echo -ne "#{test_dir}/file-names/ascii: hello" | xargs -0 touch
  200. echo -ne "#{test_dir}/file-names/emoji: [🆒]" | xargs -0 touch
  201. echo -ne "#{test_dir}/file-names/utf-8: pâté" | xargs -0 touch
  202. echo -ne "#{test_dir}/file-names/bell: [\\a]" | xargs -0 touch
  203. echo -ne "#{test_dir}/file-names/backspace: [\\b]" | xargs -0 touch
  204. echo -ne "#{test_dir}/file-names/form-feed: [\\f]" | xargs -0 touch
  205. echo -ne "#{test_dir}/file-names/new-line: [\\n]" | xargs -0 touch
  206. echo -ne "#{test_dir}/file-names/return: [\\r]" | xargs -0 touch
  207. echo -ne "#{test_dir}/file-names/tab: [\\t]" | xargs -0 touch
  208. echo -ne "#{test_dir}/file-names/vertical-tab: [\\v]" | xargs -0 touch
  209. echo -ne "#{test_dir}/file-names/escape: [\\033]" | xargs -0 touch
  210. echo -ne "#{test_dir}/file-names/ansi: [\\033[34mblue\\033[0m]" | xargs -0 touch
  211. echo -ne "#{test_dir}/file-names/invalid-utf8-1: [\\xFF]" | xargs -0 touch
  212. echo -ne "#{test_dir}/file-names/invalid-utf8-2: [\\xc3\\x28]" | xargs -0 touch
  213. echo -ne "#{test_dir}/file-names/invalid-utf8-3: [\\xe2\\x82\\x28]" | xargs -0 touch
  214. echo -ne "#{test_dir}/file-names/invalid-utf8-4: [\\xf0\\x28\\x8c\\x28]" | xargs -0 touch
  215. echo -ne "#{test_dir}/file-names/new-line-dir: [\\n]" | xargs -0 mkdir
  216. echo -ne "#{test_dir}/file-names/new-line-dir: [\\n]/subfile" | xargs -0 touch
  217. echo -ne "#{test_dir}/file-names/new-line-dir: [\\n]/another: [\\n]" | xargs -0 touch
  218. echo -ne "#{test_dir}/file-names/new-line-dir: [\\n]/broken" | xargs -0 touch
  219. mkdir "#{test_dir}/file-names/links"
  220. ln -s "#{test_dir}/file-names/new-line-dir"*/* "#{test_dir}/file-names/links"
  221. echo -ne "#{test_dir}/file-names/new-line-dir: [\\n]/broken" | xargs -0 rm
  222. EOF
  223. # Special file testcases.
  224. config.vm.provision :shell, privileged: false, inline: <<-EOF
  225. set -xe
  226. mkdir "#{test_dir}/specials"
  227. sudo mknod "#{test_dir}/specials/block-device" b 3 60
  228. sudo mknod "#{test_dir}/specials/char-device" c 14 40
  229. sudo mknod "#{test_dir}/specials/named-pipe" p
  230. sudo touch -t #{some_date} "#{test_dir}/specials/"*
  231. EOF
  232. # Awkward symlink testcases.
  233. config.vm.provision :shell, privileged: false, inline: <<-EOF
  234. set -xe
  235. mkdir "#{test_dir}/links"
  236. ln -s / "#{test_dir}/links/root"
  237. ln -s /usr "#{test_dir}/links/usr"
  238. ln -s nowhere "#{test_dir}/links/broken"
  239. ln -s /proc/1/root "#{test_dir}/links/forbidden"
  240. touch "#{test_dir}/links/some_file"
  241. ln -s "#{test_dir}/links/some_file" "#{test_dir}/links/some_file_absolute"
  242. (cd "#{test_dir}/links"; ln -s "some_file" "some_file_relative")
  243. (cd "#{test_dir}/links"; ln -s "." "current_dir")
  244. (cd "#{test_dir}/links"; ln -s ".." "parent_dir")
  245. (cd "#{test_dir}/links"; ln -s "itself" "itself")
  246. EOF
  247. # Awkward passwd testcases.
  248. # sudo is needed for these because we technically aren’t a member
  249. # of the groups (because they don’t exist), and chown and chgrp
  250. # are smart enough to disallow it!
  251. config.vm.provision :shell, privileged: false, inline: <<-EOF
  252. set -xe
  253. mkdir "#{test_dir}/passwd"
  254. touch -t #{some_date} "#{test_dir}/passwd/unknown-uid"
  255. chmod 644 "#{test_dir}/passwd/unknown-uid"
  256. sudo chown #{invalid_uid}:#{user} "#{test_dir}/passwd/unknown-uid"
  257. touch -t #{some_date} "#{test_dir}/passwd/unknown-gid"
  258. chmod 644 "#{test_dir}/passwd/unknown-gid"
  259. sudo chown #{user}:#{invalid_gid} "#{test_dir}/passwd/unknown-gid"
  260. EOF
  261. # Awkward permission testcases.
  262. # Differences in the way ‘chmod’ handles setting ‘setuid’ and ‘setgid’
  263. # when you don’t already own the file mean that we need to use ‘sudo’
  264. # to change permissions to those.
  265. config.vm.provision :shell, privileged: false, inline: <<-EOF
  266. set -xe
  267. mkdir "#{test_dir}/permissions"
  268. mkdir "#{test_dir}/permissions/forbidden-directory"
  269. chmod 000 "#{test_dir}/permissions/forbidden-directory"
  270. touch -t #{some_date} "#{test_dir}/permissions/forbidden-directory"
  271. sudo chown #{user}:#{user} "#{test_dir}/permissions/forbidden-directory"
  272. for perms in 000 001 002 004 010 020 040 100 200 400 644 755 777 1000 1001 2000 2010 4000 4100 7666 7777; do
  273. touch "#{test_dir}/permissions/$perms"
  274. sudo chown #{user}:#{user} "#{test_dir}/permissions/$perms"
  275. sudo chmod $perms "#{test_dir}/permissions/$perms"
  276. sudo touch -t #{some_date} "#{test_dir}/permissions/$perms"
  277. done
  278. EOF
  279. old = '200303030000.00'
  280. med = '200606152314.29' # the june gets used for fr_FR locale tests
  281. new = '200912221038.53' # and the december for ja_JP local tests
  282. # Awkward date and time testcases.
  283. config.vm.provision :shell, privileged: false, inline: <<-EOF
  284. set -xe
  285. mkdir "#{test_dir}/dates"
  286. # there's no way to touch the created date of a file...
  287. # so we have to do this the old-fashioned way!
  288. # (and make sure these don't actually get listed)
  289. touch -t #{old} "#{test_dir}/dates/peach"; sleep 1
  290. touch -t #{med} "#{test_dir}/dates/plum"; sleep 1
  291. touch -t #{new} "#{test_dir}/dates/pear"
  292. # modified dates
  293. touch -t #{old} -m "#{test_dir}/dates/pear"
  294. touch -t #{med} -m "#{test_dir}/dates/peach"
  295. touch -t #{new} -m "#{test_dir}/dates/plum"
  296. # accessed dates
  297. touch -t #{old} -a "#{test_dir}/dates/plum"
  298. touch -t #{med} -a "#{test_dir}/dates/pear"
  299. touch -t #{new} -a "#{test_dir}/dates/peach"
  300. sudo chown #{user}:#{user} -R "#{test_dir}/dates"
  301. EOF
  302. # Awkward extended attribute testcases.
  303. # We need to test combinations of various numbers of files *and*
  304. # extended attributes in directories. Turns out, the easiest way to
  305. # do this is to generate all combinations of files with “one-xattr”
  306. # or “two-xattrs” in their name and directories with “empty” or
  307. # “one-file” in their name, then just give the right number of
  308. # xattrs and children to those.
  309. config.vm.provision :shell, privileged: false, inline: <<-EOF
  310. set -xe
  311. mkdir "#{test_dir}/attributes"
  312. mkdir "#{test_dir}/attributes/files"
  313. touch "#{test_dir}/attributes/files/"{no-xattrs,one-xattr,two-xattrs}{,_forbidden}
  314. mkdir "#{test_dir}/attributes/dirs"
  315. mkdir "#{test_dir}/attributes/dirs/"{no-xattrs,one-xattr,two-xattrs}_{empty,one-file,two-files}{,_forbidden}
  316. setfattr -n user.greeting -v hello "#{test_dir}/attributes"/**/*{one-xattr,two-xattrs}*
  317. setfattr -n user.another_greeting -v hi "#{test_dir}/attributes"/**/*two-xattrs*
  318. for dir in "#{test_dir}/attributes/dirs/"*one-file*; do
  319. touch $dir/file-in-question
  320. done
  321. for dir in "#{test_dir}/attributes/dirs/"*two-files*; do
  322. touch $dir/this-file
  323. touch $dir/that-file
  324. done
  325. find "#{test_dir}/attributes" -exec touch {} -t #{some_date} \\;
  326. # I want to use the following to test,
  327. # but it only works on macos:
  328. #chmod +a "#{user} deny readextattr" "#{test_dir}/attributes"/**/*_forbidden
  329. sudo chmod 000 "#{test_dir}/attributes"/**/*_forbidden
  330. sudo chown #{user}:#{user} -R "#{test_dir}/attributes"
  331. EOF
  332. # A sample Git repository
  333. # This uses cd because it's easier than telling Git where to go each time
  334. config.vm.provision :shell, privileged: false, inline: <<-EOF
  335. set -xe
  336. mkdir "#{test_dir}/git"
  337. cd "#{test_dir}/git"
  338. git init
  339. mkdir edits additions moves
  340. echo "original content" | tee edits/{staged,unstaged,both}
  341. echo "this file gets moved" > moves/hither
  342. git add edits moves
  343. git config --global user.email "exa@exa.exa"
  344. git config --global user.name "Exa Exa"
  345. git commit -m "Automated test commit"
  346. echo "modifications!" | tee edits/{staged,both}
  347. touch additions/{staged,edited}
  348. mv moves/{hither,thither}
  349. git add edits moves additions
  350. echo "more modifications!" | tee edits/unstaged edits/both additions/edited
  351. touch additions/unstaged
  352. find "#{test_dir}/git" -exec touch {} -t #{some_date} \\;
  353. sudo chown #{user}:#{user} -R "#{test_dir}/git"
  354. EOF
  355. # A second Git repository
  356. # for testing two at once
  357. config.vm.provision :shell, privileged: false, inline: <<-EOF
  358. set -xe
  359. mkdir -p "#{test_dir}/git2/deeply/nested/directory"
  360. cd "#{test_dir}/git2"
  361. git init
  362. touch "deeply/nested/directory/upd8d"
  363. git add "deeply/nested/directory/upd8d"
  364. git commit -m "Automated test commit"
  365. echo "Now with contents" > "deeply/nested/directory/upd8d"
  366. touch "deeply/nested/directory/l8st"
  367. echo -e "target\n*.mp3" > ".gitignore"
  368. mkdir "ignoreds"
  369. touch "ignoreds/music.mp3"
  370. touch "ignoreds/music.m4a"
  371. mkdir "ignoreds/nested"
  372. touch "ignoreds/nested/70s grove.mp3"
  373. touch "ignoreds/nested/funky chicken.m4a"
  374. mkdir "target"
  375. touch "target/another ignored file"
  376. mkdir "deeply/nested/repository"
  377. cd "deeply/nested/repository"
  378. git init
  379. touch subfile
  380. find "#{test_dir}/git2" -exec touch {} -t #{some_date} \\;
  381. sudo chown #{user}:#{user} -R "#{test_dir}/git2"
  382. EOF
  383. # A third Git repository
  384. # Regression test for https://github.com/ogham/exa/issues/526
  385. config.vm.provision :shell, privileged: false, inline: <<-EOF
  386. set -xe
  387. mkdir -p "#{test_dir}/git3"
  388. cd "#{test_dir}/git3"
  389. git init
  390. # Create a symbolic link pointing to a non-existing file
  391. ln -s aaa/aaa/a b
  392. find "#{test_dir}/git3" -exec touch {} -t #{some_date} \\;
  393. sudo chown #{user}:#{user} -R "#{test_dir}/git3"
  394. EOF
  395. # Hidden and dot file testcases.
  396. # We need to set the permissions of `.` and `..` because they actually
  397. # get displayed in the output here, so this has to come last.
  398. config.vm.provision :shell, privileged: false, inline: <<-EOF
  399. set -xe
  400. shopt -u dotglob
  401. GLOBIGNORE=".:.."
  402. mkdir "#{test_dir}/hiddens"
  403. touch "#{test_dir}/hiddens/visible"
  404. touch "#{test_dir}/hiddens/.hidden"
  405. touch "#{test_dir}/hiddens/..extra-hidden"
  406. # ./hiddens/
  407. touch -t #{some_date} "#{test_dir}/hiddens/"*
  408. chmod 644 "#{test_dir}/hiddens/"*
  409. sudo chown #{user}:#{user} "#{test_dir}/hiddens/"*
  410. # .
  411. touch -t #{some_date} "#{test_dir}/hiddens"
  412. chmod 755 "#{test_dir}/hiddens"
  413. sudo chown #{user}:#{user} "#{test_dir}/hiddens"
  414. # ..
  415. sudo touch -t #{some_date} "#{test_dir}"
  416. sudo chmod 755 "#{test_dir}"
  417. sudo chown #{user}:#{user} "#{test_dir}"
  418. EOF
  419. # Set up some locales
  420. config.vm.provision :shell, privileged: false, inline: <<-EOF
  421. set -xe
  422. # uncomment these from the config file
  423. sudo sed -i '/fr_FR.UTF-8/s/^# //g' /etc/locale.gen
  424. sudo sed -i '/ja_JP.UTF-8/s/^# //g' /etc/locale.gen
  425. sudo locale-gen
  426. EOF
  427. # Install kcov for test coverage
  428. # This doesn’t run coverage over the xtests so it’s less useful for now
  429. if ENV.key?('INSTALL_KCOV')
  430. config.vm.provision :shell, privileged: false, inline: <<-EOF
  431. set -xe
  432. test -e ~/.cargo/bin/cargo-kcov \
  433. || cargo install cargo-kcov
  434. sudo apt-get install -qq -o=Dpkg::Use-Pty=0 -y \
  435. cmake g++ pkg-config \
  436. libcurl4-openssl-dev libdw-dev binutils-dev libiberty-dev
  437. cargo kcov --print-install-kcov-sh | sudo sh
  438. EOF
  439. end
  440. end
  441. end