mt-libuv 4.1.01 → 4.1.02

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2091) hide show
  1. checksums.yaml +4 -4
  2. data/ext/gyp/.gitignore +1 -0
  3. data/ext/gyp/AUTHORS +17 -0
  4. data/ext/gyp/DEPS +23 -0
  5. data/ext/gyp/LICENSE +27 -0
  6. data/ext/gyp/OWNERS +1 -0
  7. data/ext/gyp/PRESUBMIT.py +125 -0
  8. data/ext/gyp/README.md +5 -0
  9. data/ext/gyp/buildbot/buildbot_run.py +138 -0
  10. data/ext/gyp/buildbot/commit_queue/OWNERS +6 -0
  11. data/ext/gyp/buildbot/commit_queue/README +3 -0
  12. data/ext/gyp/buildbot/commit_queue/cq_config.json +15 -0
  13. data/ext/gyp/buildbot/travis-checkout.sh +27 -0
  14. data/ext/gyp/buildbot/travis-test.sh +12 -0
  15. data/ext/gyp/codereview.settings +6 -0
  16. data/ext/gyp/data/win/large-pdb-shim.cc +12 -0
  17. data/ext/gyp/gyp +8 -0
  18. data/ext/gyp/gyp.bat +5 -0
  19. data/ext/gyp/gyp_main.py +16 -0
  20. data/ext/gyp/gyptest.py +243 -0
  21. data/ext/gyp/pylib/gyp/MSVSNew.py +353 -0
  22. data/ext/gyp/pylib/gyp/MSVSProject.py +208 -0
  23. data/ext/gyp/pylib/gyp/MSVSSettings.py +1106 -0
  24. data/ext/gyp/pylib/gyp/MSVSSettings_test.py +1486 -0
  25. data/ext/gyp/pylib/gyp/MSVSToolFile.py +58 -0
  26. data/ext/gyp/pylib/gyp/MSVSUserFile.py +147 -0
  27. data/ext/gyp/pylib/gyp/MSVSUtil.py +271 -0
  28. data/ext/gyp/pylib/gyp/MSVSVersion.py +504 -0
  29. data/ext/gyp/pylib/gyp/__init__.py +555 -0
  30. data/ext/gyp/pylib/gyp/common.py +619 -0
  31. data/ext/gyp/pylib/gyp/common_test.py +73 -0
  32. data/ext/gyp/pylib/gyp/easy_xml.py +170 -0
  33. data/ext/gyp/pylib/gyp/easy_xml_test.py +106 -0
  34. data/ext/gyp/pylib/gyp/flock_tool.py +54 -0
  35. data/ext/gyp/pylib/gyp/generator/__init__.py +0 -0
  36. data/ext/gyp/pylib/gyp/generator/analyzer.py +744 -0
  37. data/ext/gyp/pylib/gyp/generator/cmake.py +1256 -0
  38. data/ext/gyp/pylib/gyp/generator/dump_dependency_json.py +101 -0
  39. data/ext/gyp/pylib/gyp/generator/eclipse.py +425 -0
  40. data/ext/gyp/pylib/gyp/generator/gypd.py +94 -0
  41. data/ext/gyp/pylib/gyp/generator/gypsh.py +56 -0
  42. data/ext/gyp/pylib/gyp/generator/make.py +2260 -0
  43. data/ext/gyp/pylib/gyp/generator/msvs.py +3537 -0
  44. data/ext/gyp/pylib/gyp/generator/msvs_test.py +40 -0
  45. data/ext/gyp/pylib/gyp/generator/ninja.py +2500 -0
  46. data/ext/gyp/pylib/gyp/generator/ninja_test.py +46 -0
  47. data/ext/gyp/pylib/gyp/generator/xcode.py +1302 -0
  48. data/ext/gyp/pylib/gyp/generator/xcode_test.py +23 -0
  49. data/ext/gyp/pylib/gyp/input.py +2908 -0
  50. data/ext/gyp/pylib/gyp/input_test.py +90 -0
  51. data/ext/gyp/pylib/gyp/mac_tool.py +721 -0
  52. data/ext/gyp/pylib/gyp/msvs_emulation.py +1112 -0
  53. data/ext/gyp/pylib/gyp/ninja_syntax.py +168 -0
  54. data/ext/gyp/pylib/gyp/simple_copy.py +57 -0
  55. data/ext/gyp/pylib/gyp/win_tool.py +326 -0
  56. data/ext/gyp/pylib/gyp/xcode_emulation.py +1800 -0
  57. data/ext/gyp/pylib/gyp/xcode_ninja.py +289 -0
  58. data/ext/gyp/pylib/gyp/xcodeproj_file.py +2995 -0
  59. data/ext/gyp/pylib/gyp/xml_fix.py +68 -0
  60. data/ext/gyp/samples/samples +83 -0
  61. data/ext/gyp/samples/samples.bat +5 -0
  62. data/ext/gyp/setup.py +19 -0
  63. data/ext/gyp/test/actions/generated-header/action.py +11 -0
  64. data/ext/gyp/test/actions/generated-header/main.cc +7 -0
  65. data/ext/gyp/test/actions/generated-header/test.gyp +34 -0
  66. data/ext/gyp/test/actions/gyptest-all.py +101 -0
  67. data/ext/gyp/test/actions/gyptest-default.py +68 -0
  68. data/ext/gyp/test/actions/gyptest-errors.py +24 -0
  69. data/ext/gyp/test/actions/gyptest-generated-header.py +38 -0
  70. data/ext/gyp/test/actions/src/action_missing_name.gyp +24 -0
  71. data/ext/gyp/test/actions/src/actions.gyp +114 -0
  72. data/ext/gyp/test/actions/src/confirm-dep-files.py +21 -0
  73. data/ext/gyp/test/actions/src/subdir1/counter.py +44 -0
  74. data/ext/gyp/test/actions/src/subdir1/executable.gyp +74 -0
  75. data/ext/gyp/test/actions/src/subdir1/make-prog1.py +20 -0
  76. data/ext/gyp/test/actions/src/subdir1/make-prog2.py +20 -0
  77. data/ext/gyp/test/actions/src/subdir1/program.c +12 -0
  78. data/ext/gyp/test/actions/src/subdir2/make-file.py +11 -0
  79. data/ext/gyp/test/actions/src/subdir2/none.gyp +33 -0
  80. data/ext/gyp/test/actions/src/subdir3/generate_main.py +21 -0
  81. data/ext/gyp/test/actions/src/subdir3/null_input.gyp +29 -0
  82. data/ext/gyp/test/actions-bare/gyptest-bare.py +24 -0
  83. data/ext/gyp/test/actions-bare/src/bare.gyp +25 -0
  84. data/ext/gyp/test/actions-bare/src/bare.py +11 -0
  85. data/ext/gyp/test/actions-depfile/depfile.gyp +42 -0
  86. data/ext/gyp/test/actions-depfile/gyptest-all.py +30 -0
  87. data/ext/gyp/test/actions-depfile/input.txt +1 -0
  88. data/ext/gyp/test/actions-depfile/touch.py +18 -0
  89. data/ext/gyp/test/actions-multiple/gyptest-all.py +72 -0
  90. data/ext/gyp/test/actions-multiple/src/actions.gyp +226 -0
  91. data/ext/gyp/test/actions-multiple/src/copyfile.py +9 -0
  92. data/ext/gyp/test/actions-multiple/src/filter.py +12 -0
  93. data/ext/gyp/test/actions-multiple/src/foo.c +11 -0
  94. data/ext/gyp/test/actions-multiple/src/input.txt +1 -0
  95. data/ext/gyp/test/actions-multiple/src/main.c +22 -0
  96. data/ext/gyp/test/actions-multiple-outputs/gyptest-multiple-outputs.py +45 -0
  97. data/ext/gyp/test/actions-multiple-outputs/src/multiple-outputs.gyp +23 -0
  98. data/ext/gyp/test/actions-multiple-outputs/src/touch.py +16 -0
  99. data/ext/gyp/test/actions-multiple-outputs-with-dependencies/gyptest-action.py +45 -0
  100. data/ext/gyp/test/actions-multiple-outputs-with-dependencies/src/action.gyp +28 -0
  101. data/ext/gyp/test/actions-multiple-outputs-with-dependencies/src/rcopy.py +20 -0
  102. data/ext/gyp/test/actions-none/gyptest-none.py +24 -0
  103. data/ext/gyp/test/actions-none/src/fake_cross.py +12 -0
  104. data/ext/gyp/test/actions-none/src/foo.cc +1 -0
  105. data/ext/gyp/test/actions-none/src/none_with_source_files.gyp +35 -0
  106. data/ext/gyp/test/actions-subdir/gyptest-action.py +26 -0
  107. data/ext/gyp/test/actions-subdir/src/make-file.py +11 -0
  108. data/ext/gyp/test/actions-subdir/src/none.gyp +31 -0
  109. data/ext/gyp/test/actions-subdir/src/subdir/make-subdir-file.py +11 -0
  110. data/ext/gyp/test/actions-subdir/src/subdir/subdir.gyp +28 -0
  111. data/ext/gyp/test/additional-targets/gyptest-additional.py +63 -0
  112. data/ext/gyp/test/additional-targets/src/all.gyp +13 -0
  113. data/ext/gyp/test/additional-targets/src/dir1/actions.gyp +56 -0
  114. data/ext/gyp/test/additional-targets/src/dir1/emit.py +11 -0
  115. data/ext/gyp/test/additional-targets/src/dir1/lib1.c +6 -0
  116. data/ext/gyp/test/analyzer/common.gypi +6 -0
  117. data/ext/gyp/test/analyzer/gyptest-analyzer.py +427 -0
  118. data/ext/gyp/test/analyzer/static_library_test.gyp +34 -0
  119. data/ext/gyp/test/analyzer/subdir/subdir.gyp +36 -0
  120. data/ext/gyp/test/analyzer/subdir/subdir2/subdir2.gyp +15 -0
  121. data/ext/gyp/test/analyzer/subdir2/subdir.gyp +18 -0
  122. data/ext/gyp/test/analyzer/subdir2/subdir.includes.gypi +9 -0
  123. data/ext/gyp/test/analyzer/test.gyp +114 -0
  124. data/ext/gyp/test/analyzer/test2.gyp +25 -0
  125. data/ext/gyp/test/analyzer/test2.includes.gypi +13 -0
  126. data/ext/gyp/test/analyzer/test2.includes.includes.gypi +9 -0
  127. data/ext/gyp/test/analyzer/test2.toplevel_includes.gypi +15 -0
  128. data/ext/gyp/test/analyzer/test3.gyp +77 -0
  129. data/ext/gyp/test/analyzer/test4.gyp +80 -0
  130. data/ext/gyp/test/analyzer/test5.gyp +25 -0
  131. data/ext/gyp/test/arflags/gyptest-arflags.py +26 -0
  132. data/ext/gyp/test/arflags/lib.cc +0 -0
  133. data/ext/gyp/test/arflags/test.gyp +10 -0
  134. data/ext/gyp/test/assembly/gyptest-assembly.py +31 -0
  135. data/ext/gyp/test/assembly/gyptest-override.py +24 -0
  136. data/ext/gyp/test/assembly/src/as.bat +4 -0
  137. data/ext/gyp/test/assembly/src/assembly.gyp +62 -0
  138. data/ext/gyp/test/assembly/src/lib1.S +15 -0
  139. data/ext/gyp/test/assembly/src/lib1.c +3 -0
  140. data/ext/gyp/test/assembly/src/override.gyp +34 -0
  141. data/ext/gyp/test/assembly/src/override_asm.asm +8 -0
  142. data/ext/gyp/test/assembly/src/program.c +12 -0
  143. data/ext/gyp/test/build-option/gyptest-build.py +27 -0
  144. data/ext/gyp/test/build-option/hello.c +13 -0
  145. data/ext/gyp/test/build-option/hello.gyp +15 -0
  146. data/ext/gyp/test/builddir/gyptest-all.py +85 -0
  147. data/ext/gyp/test/builddir/gyptest-default.py +85 -0
  148. data/ext/gyp/test/builddir/src/builddir.gypi +18 -0
  149. data/ext/gyp/test/builddir/src/func1.c +6 -0
  150. data/ext/gyp/test/builddir/src/func2.c +6 -0
  151. data/ext/gyp/test/builddir/src/func3.c +6 -0
  152. data/ext/gyp/test/builddir/src/func4.c +6 -0
  153. data/ext/gyp/test/builddir/src/func5.c +6 -0
  154. data/ext/gyp/test/builddir/src/prog1.c +10 -0
  155. data/ext/gyp/test/builddir/src/prog1.gyp +30 -0
  156. data/ext/gyp/test/builddir/src/subdir2/prog2.c +10 -0
  157. data/ext/gyp/test/builddir/src/subdir2/prog2.gyp +19 -0
  158. data/ext/gyp/test/builddir/src/subdir2/subdir3/prog3.c +10 -0
  159. data/ext/gyp/test/builddir/src/subdir2/subdir3/prog3.gyp +19 -0
  160. data/ext/gyp/test/builddir/src/subdir2/subdir3/subdir4/prog4.c +10 -0
  161. data/ext/gyp/test/builddir/src/subdir2/subdir3/subdir4/prog4.gyp +19 -0
  162. data/ext/gyp/test/builddir/src/subdir2/subdir3/subdir4/subdir5/prog5.c +10 -0
  163. data/ext/gyp/test/builddir/src/subdir2/subdir3/subdir4/subdir5/prog5.gyp +19 -0
  164. data/ext/gyp/test/cflags/cflags.c +15 -0
  165. data/ext/gyp/test/cflags/cflags.gyp +23 -0
  166. data/ext/gyp/test/cflags/gyptest-cflags.py +75 -0
  167. data/ext/gyp/test/compilable/gyptest-headers.py +29 -0
  168. data/ext/gyp/test/compilable/src/headers.gyp +26 -0
  169. data/ext/gyp/test/compilable/src/lib1.cpp +7 -0
  170. data/ext/gyp/test/compilable/src/lib1.hpp +6 -0
  171. data/ext/gyp/test/compilable/src/program.cpp +9 -0
  172. data/ext/gyp/test/compiler-override/compiler-exe.gyp +16 -0
  173. data/ext/gyp/test/compiler-override/compiler-global-settings.gyp.in +34 -0
  174. data/ext/gyp/test/compiler-override/compiler-host.gyp +17 -0
  175. data/ext/gyp/test/compiler-override/compiler-shared-lib.gyp +16 -0
  176. data/ext/gyp/test/compiler-override/cxxtest.cc +7 -0
  177. data/ext/gyp/test/compiler-override/gyptest-compiler-env-toolchain.py +78 -0
  178. data/ext/gyp/test/compiler-override/gyptest-compiler-env.py +110 -0
  179. data/ext/gyp/test/compiler-override/gyptest-compiler-global-settings.py +82 -0
  180. data/ext/gyp/test/compiler-override/my_cc.py +7 -0
  181. data/ext/gyp/test/compiler-override/my_cxx.py +7 -0
  182. data/ext/gyp/test/compiler-override/my_ld.py +7 -0
  183. data/ext/gyp/test/compiler-override/my_nm.py +9 -0
  184. data/ext/gyp/test/compiler-override/my_readelf.py +9 -0
  185. data/ext/gyp/test/compiler-override/test.c +7 -0
  186. data/ext/gyp/test/conditions/elseif/elseif.gyp +43 -0
  187. data/ext/gyp/test/conditions/elseif/elseif_bad1.gyp +20 -0
  188. data/ext/gyp/test/conditions/elseif/elseif_bad2.gyp +22 -0
  189. data/ext/gyp/test/conditions/elseif/elseif_bad3.gyp +23 -0
  190. data/ext/gyp/test/conditions/elseif/elseif_conditions.gypi +15 -0
  191. data/ext/gyp/test/conditions/elseif/gyptest_elseif.py +33 -0
  192. data/ext/gyp/test/conditions/elseif/program.cc +10 -0
  193. data/ext/gyp/test/configurations/basics/configurations.c +15 -0
  194. data/ext/gyp/test/configurations/basics/configurations.gyp +32 -0
  195. data/ext/gyp/test/configurations/basics/gyptest-configurations.py +29 -0
  196. data/ext/gyp/test/configurations/inheritance/configurations.c +21 -0
  197. data/ext/gyp/test/configurations/inheritance/configurations.gyp +40 -0
  198. data/ext/gyp/test/configurations/inheritance/duplicates.gyp +27 -0
  199. data/ext/gyp/test/configurations/inheritance/duplicates.gypd.golden +12 -0
  200. data/ext/gyp/test/configurations/inheritance/gyptest-duplicates.py +36 -0
  201. data/ext/gyp/test/configurations/inheritance/gyptest-inheritance.py +33 -0
  202. data/ext/gyp/test/configurations/invalid/actions.gyp +18 -0
  203. data/ext/gyp/test/configurations/invalid/all_dependent_settings.gyp +18 -0
  204. data/ext/gyp/test/configurations/invalid/configurations.gyp +18 -0
  205. data/ext/gyp/test/configurations/invalid/dependencies.gyp +18 -0
  206. data/ext/gyp/test/configurations/invalid/direct_dependent_settings.gyp +18 -0
  207. data/ext/gyp/test/configurations/invalid/gyptest-configurations.py +36 -0
  208. data/ext/gyp/test/configurations/invalid/libraries.gyp +18 -0
  209. data/ext/gyp/test/configurations/invalid/link_settings.gyp +18 -0
  210. data/ext/gyp/test/configurations/invalid/sources.gyp +18 -0
  211. data/ext/gyp/test/configurations/invalid/standalone_static_library.gyp +17 -0
  212. data/ext/gyp/test/configurations/invalid/target_name.gyp +18 -0
  213. data/ext/gyp/test/configurations/invalid/type.gyp +18 -0
  214. data/ext/gyp/test/configurations/target_platform/configurations.gyp +58 -0
  215. data/ext/gyp/test/configurations/target_platform/front.c +8 -0
  216. data/ext/gyp/test/configurations/target_platform/gyptest-target_platform.py +40 -0
  217. data/ext/gyp/test/configurations/target_platform/left.c +3 -0
  218. data/ext/gyp/test/configurations/target_platform/right.c +3 -0
  219. data/ext/gyp/test/configurations/x64/configurations.c +12 -0
  220. data/ext/gyp/test/configurations/x64/configurations.gyp +38 -0
  221. data/ext/gyp/test/configurations/x64/gyptest-x86.py +31 -0
  222. data/ext/gyp/test/copies/gyptest-all.py +42 -0
  223. data/ext/gyp/test/copies/gyptest-attribs.py +41 -0
  224. data/ext/gyp/test/copies/gyptest-default.py +42 -0
  225. data/ext/gyp/test/copies/gyptest-samedir.py +28 -0
  226. data/ext/gyp/test/copies/gyptest-slash.py +39 -0
  227. data/ext/gyp/test/copies/gyptest-sourceless-shared-lib.py +20 -0
  228. data/ext/gyp/test/copies/gyptest-updir.py +32 -0
  229. data/ext/gyp/test/copies/src/copies-attribs.gyp +20 -0
  230. data/ext/gyp/test/copies/src/copies-samedir.gyp +37 -0
  231. data/ext/gyp/test/copies/src/copies-slash.gyp +36 -0
  232. data/ext/gyp/test/copies/src/copies-sourceless-shared-lib.gyp +27 -0
  233. data/ext/gyp/test/copies/src/copies-updir.gyp +21 -0
  234. data/ext/gyp/test/copies/src/copies.gyp +70 -0
  235. data/ext/gyp/test/copies/src/directory/file3 +1 -0
  236. data/ext/gyp/test/copies/src/directory/file4 +1 -0
  237. data/ext/gyp/test/copies/src/directory/subdir/file5 +1 -0
  238. data/ext/gyp/test/copies/src/executable-file.sh +3 -0
  239. data/ext/gyp/test/copies/src/file1 +1 -0
  240. data/ext/gyp/test/copies/src/file2 +1 -0
  241. data/ext/gyp/test/copies/src/foo.c +13 -0
  242. data/ext/gyp/test/copies/src/parentdir/subdir/file6 +1 -0
  243. data/ext/gyp/test/custom-generator/gyptest-custom-generator.py +18 -0
  244. data/ext/gyp/test/custom-generator/mygenerator.py +14 -0
  245. data/ext/gyp/test/custom-generator/test.gyp +15 -0
  246. data/ext/gyp/test/cxxflags/cxxflags.cc +15 -0
  247. data/ext/gyp/test/cxxflags/cxxflags.gyp +15 -0
  248. data/ext/gyp/test/cxxflags/gyptest-cxxflags.py +45 -0
  249. data/ext/gyp/test/defines/defines-env.gyp +22 -0
  250. data/ext/gyp/test/defines/defines.c +23 -0
  251. data/ext/gyp/test/defines/defines.gyp +38 -0
  252. data/ext/gyp/test/defines/gyptest-define-override.py +43 -0
  253. data/ext/gyp/test/defines/gyptest-defines-env-regyp.py +51 -0
  254. data/ext/gyp/test/defines/gyptest-defines-env.py +85 -0
  255. data/ext/gyp/test/defines/gyptest-defines.py +39 -0
  256. data/ext/gyp/test/defines-escaping/defines-escaping.c +11 -0
  257. data/ext/gyp/test/defines-escaping/defines-escaping.gyp +19 -0
  258. data/ext/gyp/test/defines-escaping/gyptest-defines-escaping.py +184 -0
  259. data/ext/gyp/test/dependencies/a.c +9 -0
  260. data/ext/gyp/test/dependencies/adso/all_dependent_settings_order.gyp +45 -0
  261. data/ext/gyp/test/dependencies/adso/write_args.py +11 -0
  262. data/ext/gyp/test/dependencies/b/b.c +3 -0
  263. data/ext/gyp/test/dependencies/b/b.gyp +22 -0
  264. data/ext/gyp/test/dependencies/b/b3.c +9 -0
  265. data/ext/gyp/test/dependencies/c/c.c +4 -0
  266. data/ext/gyp/test/dependencies/c/c.gyp +22 -0
  267. data/ext/gyp/test/dependencies/c/d.c +3 -0
  268. data/ext/gyp/test/dependencies/double_dependency.gyp +23 -0
  269. data/ext/gyp/test/dependencies/double_dependent.gyp +12 -0
  270. data/ext/gyp/test/dependencies/extra_targets.gyp +18 -0
  271. data/ext/gyp/test/dependencies/gyptest-all-dependent-settings-order.py +19 -0
  272. data/ext/gyp/test/dependencies/gyptest-double-dependency.py +19 -0
  273. data/ext/gyp/test/dependencies/gyptest-extra-targets.py +22 -0
  274. data/ext/gyp/test/dependencies/gyptest-indirect-module-dependency.py +22 -0
  275. data/ext/gyp/test/dependencies/gyptest-lib-only.py +39 -0
  276. data/ext/gyp/test/dependencies/gyptest-none-traversal.py +25 -0
  277. data/ext/gyp/test/dependencies/gyptest-sharedlib-linksettings.py +21 -0
  278. data/ext/gyp/test/dependencies/lib_only.gyp +16 -0
  279. data/ext/gyp/test/dependencies/main.c +14 -0
  280. data/ext/gyp/test/dependencies/module-dep/a.cc +7 -0
  281. data/ext/gyp/test/dependencies/module-dep/dll.cc +9 -0
  282. data/ext/gyp/test/dependencies/module-dep/exe.cc +7 -0
  283. data/ext/gyp/test/dependencies/module-dep/indirect-module-dependency.gyp +37 -0
  284. data/ext/gyp/test/dependencies/none_traversal.gyp +46 -0
  285. data/ext/gyp/test/dependencies/sharedlib-linksettings/program.c +25 -0
  286. data/ext/gyp/test/dependencies/sharedlib-linksettings/sharedlib.c +16 -0
  287. data/ext/gyp/test/dependencies/sharedlib-linksettings/staticlib.c +24 -0
  288. data/ext/gyp/test/dependencies/sharedlib-linksettings/test.gyp +37 -0
  289. data/ext/gyp/test/dependency-copy/gyptest-copy.py +26 -0
  290. data/ext/gyp/test/dependency-copy/src/copies.gyp +25 -0
  291. data/ext/gyp/test/dependency-copy/src/file1.c +7 -0
  292. data/ext/gyp/test/dependency-copy/src/file2.c +7 -0
  293. data/ext/gyp/test/dependent-settings/nested-dependent-settings/all-dependent-settings.gyp +19 -0
  294. data/ext/gyp/test/dependent-settings/nested-dependent-settings/direct-dependent-settings.gyp +19 -0
  295. data/ext/gyp/test/dependent-settings/nested-dependent-settings/gyptest-nested-dependent-settings.py +18 -0
  296. data/ext/gyp/test/determinism/determinism.gyp +59 -0
  297. data/ext/gyp/test/determinism/empty-targets.gyp +32 -0
  298. data/ext/gyp/test/determinism/gyptest-determinism.py +30 -0
  299. data/ext/gyp/test/determinism/gyptest-empty-target-names.py +30 -0
  300. data/ext/gyp/test/determinism/gyptest-needed-variables.py +30 -0
  301. data/ext/gyp/test/determinism/gyptest-solibs.py +37 -0
  302. data/ext/gyp/test/determinism/main.cc +5 -0
  303. data/ext/gyp/test/determinism/needed-variables.gyp +33 -0
  304. data/ext/gyp/test/determinism/rule.py +8 -0
  305. data/ext/gyp/test/determinism/solib.cc +8 -0
  306. data/ext/gyp/test/determinism/solibs.gyp +32 -0
  307. data/ext/gyp/test/empty-target/empty-target.gyp +12 -0
  308. data/ext/gyp/test/empty-target/gyptest-empty-target.py +18 -0
  309. data/ext/gyp/test/errors/dependency_cycle.gyp +23 -0
  310. data/ext/gyp/test/errors/duplicate_basenames.gyp +13 -0
  311. data/ext/gyp/test/errors/duplicate_node.gyp +12 -0
  312. data/ext/gyp/test/errors/duplicate_rule.gyp +22 -0
  313. data/ext/gyp/test/errors/duplicate_targets.gyp +14 -0
  314. data/ext/gyp/test/errors/error_command.gyp +12 -0
  315. data/ext/gyp/test/errors/file_cycle0.gyp +17 -0
  316. data/ext/gyp/test/errors/file_cycle1.gyp +13 -0
  317. data/ext/gyp/test/errors/gyptest-errors.py +80 -0
  318. data/ext/gyp/test/errors/missing_command.gyp +12 -0
  319. data/ext/gyp/test/errors/missing_dep.gyp +15 -0
  320. data/ext/gyp/test/errors/missing_targets.gyp +8 -0
  321. data/ext/gyp/test/escaping/colon/test.gyp +21 -0
  322. data/ext/gyp/test/escaping/gyptest-colon.py +51 -0
  323. data/ext/gyp/test/exclusion/exclusion.gyp +23 -0
  324. data/ext/gyp/test/exclusion/gyptest-exclusion.py +22 -0
  325. data/ext/gyp/test/exclusion/hello.c +15 -0
  326. data/ext/gyp/test/external-cross-compile/gyptest-cross.py +31 -0
  327. data/ext/gyp/test/external-cross-compile/src/bogus1.cc +1 -0
  328. data/ext/gyp/test/external-cross-compile/src/bogus2.c +1 -0
  329. data/ext/gyp/test/external-cross-compile/src/cross.gyp +83 -0
  330. data/ext/gyp/test/external-cross-compile/src/cross_compile.gypi +23 -0
  331. data/ext/gyp/test/external-cross-compile/src/fake_cross.py +18 -0
  332. data/ext/gyp/test/external-cross-compile/src/program.cc +16 -0
  333. data/ext/gyp/test/external-cross-compile/src/test1.cc +1 -0
  334. data/ext/gyp/test/external-cross-compile/src/test2.c +1 -0
  335. data/ext/gyp/test/external-cross-compile/src/test3.cc +1 -0
  336. data/ext/gyp/test/external-cross-compile/src/test4.c +1 -0
  337. data/ext/gyp/test/external-cross-compile/src/tochar.py +13 -0
  338. data/ext/gyp/test/generator-output/actions/actions.gyp +16 -0
  339. data/ext/gyp/test/generator-output/actions/build/README.txt +4 -0
  340. data/ext/gyp/test/generator-output/actions/subdir1/actions-out/README.txt +4 -0
  341. data/ext/gyp/test/generator-output/actions/subdir1/build/README.txt +4 -0
  342. data/ext/gyp/test/generator-output/actions/subdir1/executable.gyp +44 -0
  343. data/ext/gyp/test/generator-output/actions/subdir1/make-prog1.py +20 -0
  344. data/ext/gyp/test/generator-output/actions/subdir1/make-prog2.py +20 -0
  345. data/ext/gyp/test/generator-output/actions/subdir1/program.c +12 -0
  346. data/ext/gyp/test/generator-output/actions/subdir2/actions-out/README.txt +4 -0
  347. data/ext/gyp/test/generator-output/actions/subdir2/build/README.txt +4 -0
  348. data/ext/gyp/test/generator-output/actions/subdir2/make-file.py +11 -0
  349. data/ext/gyp/test/generator-output/actions/subdir2/none.gyp +31 -0
  350. data/ext/gyp/test/generator-output/copies/build/README.txt +4 -0
  351. data/ext/gyp/test/generator-output/copies/copies-out/README.txt +4 -0
  352. data/ext/gyp/test/generator-output/copies/copies.gyp +50 -0
  353. data/ext/gyp/test/generator-output/copies/file1 +1 -0
  354. data/ext/gyp/test/generator-output/copies/file2 +1 -0
  355. data/ext/gyp/test/generator-output/copies/subdir/build/README.txt +4 -0
  356. data/ext/gyp/test/generator-output/copies/subdir/copies-out/README.txt +4 -0
  357. data/ext/gyp/test/generator-output/copies/subdir/file3 +1 -0
  358. data/ext/gyp/test/generator-output/copies/subdir/file4 +1 -0
  359. data/ext/gyp/test/generator-output/copies/subdir/subdir.gyp +32 -0
  360. data/ext/gyp/test/generator-output/gyptest-actions.py +57 -0
  361. data/ext/gyp/test/generator-output/gyptest-copies.py +59 -0
  362. data/ext/gyp/test/generator-output/gyptest-depth.py +58 -0
  363. data/ext/gyp/test/generator-output/gyptest-mac-bundle.py +33 -0
  364. data/ext/gyp/test/generator-output/gyptest-relocate.py +59 -0
  365. data/ext/gyp/test/generator-output/gyptest-rules.py +58 -0
  366. data/ext/gyp/test/generator-output/gyptest-subdir2-deep.py +36 -0
  367. data/ext/gyp/test/generator-output/gyptest-symlink.py +44 -0
  368. data/ext/gyp/test/generator-output/gyptest-top-all.py +53 -0
  369. data/ext/gyp/test/generator-output/mac-bundle/Info.plist +32 -0
  370. data/ext/gyp/test/generator-output/mac-bundle/app.order +1 -0
  371. data/ext/gyp/test/generator-output/mac-bundle/header.h +1 -0
  372. data/ext/gyp/test/generator-output/mac-bundle/main.c +1 -0
  373. data/ext/gyp/test/generator-output/mac-bundle/resource.sb +1 -0
  374. data/ext/gyp/test/generator-output/mac-bundle/test.gyp +25 -0
  375. data/ext/gyp/test/generator-output/rules/build/README.txt +4 -0
  376. data/ext/gyp/test/generator-output/rules/copy-file.py +12 -0
  377. data/ext/gyp/test/generator-output/rules/rules.gyp +16 -0
  378. data/ext/gyp/test/generator-output/rules/subdir1/build/README.txt +4 -0
  379. data/ext/gyp/test/generator-output/rules/subdir1/define3.in0 +1 -0
  380. data/ext/gyp/test/generator-output/rules/subdir1/define4.in0 +1 -0
  381. data/ext/gyp/test/generator-output/rules/subdir1/executable.gyp +59 -0
  382. data/ext/gyp/test/generator-output/rules/subdir1/function1.in1 +6 -0
  383. data/ext/gyp/test/generator-output/rules/subdir1/function2.in1 +6 -0
  384. data/ext/gyp/test/generator-output/rules/subdir1/program.c +18 -0
  385. data/ext/gyp/test/generator-output/rules/subdir2/build/README.txt +4 -0
  386. data/ext/gyp/test/generator-output/rules/subdir2/file1.in0 +1 -0
  387. data/ext/gyp/test/generator-output/rules/subdir2/file2.in0 +1 -0
  388. data/ext/gyp/test/generator-output/rules/subdir2/file3.in1 +1 -0
  389. data/ext/gyp/test/generator-output/rules/subdir2/file4.in1 +1 -0
  390. data/ext/gyp/test/generator-output/rules/subdir2/none.gyp +49 -0
  391. data/ext/gyp/test/generator-output/rules/subdir2/rules-out/README.txt +4 -0
  392. data/ext/gyp/test/generator-output/src/build/README.txt +4 -0
  393. data/ext/gyp/test/generator-output/src/inc.h +1 -0
  394. data/ext/gyp/test/generator-output/src/inc1/include1.h +1 -0
  395. data/ext/gyp/test/generator-output/src/prog1.c +18 -0
  396. data/ext/gyp/test/generator-output/src/prog1.gyp +28 -0
  397. data/ext/gyp/test/generator-output/src/subdir2/build/README.txt +4 -0
  398. data/ext/gyp/test/generator-output/src/subdir2/deeper/build/README.txt +4 -0
  399. data/ext/gyp/test/generator-output/src/subdir2/deeper/deeper.c +7 -0
  400. data/ext/gyp/test/generator-output/src/subdir2/deeper/deeper.gyp +18 -0
  401. data/ext/gyp/test/generator-output/src/subdir2/deeper/deeper.h +1 -0
  402. data/ext/gyp/test/generator-output/src/subdir2/inc2/include2.h +1 -0
  403. data/ext/gyp/test/generator-output/src/subdir2/prog2.c +18 -0
  404. data/ext/gyp/test/generator-output/src/subdir2/prog2.gyp +28 -0
  405. data/ext/gyp/test/generator-output/src/subdir3/build/README.txt +4 -0
  406. data/ext/gyp/test/generator-output/src/subdir3/inc3/include3.h +1 -0
  407. data/ext/gyp/test/generator-output/src/subdir3/prog3.c +18 -0
  408. data/ext/gyp/test/generator-output/src/subdir3/prog3.gyp +25 -0
  409. data/ext/gyp/test/generator-output/src/symroot.gypi +16 -0
  410. data/ext/gyp/test/gyp-defines/defines.gyp +26 -0
  411. data/ext/gyp/test/gyp-defines/echo.py +11 -0
  412. data/ext/gyp/test/gyp-defines/gyptest-multiple-values.py +36 -0
  413. data/ext/gyp/test/gyp-defines/gyptest-regyp.py +40 -0
  414. data/ext/gyp/test/hard_dependency/gyptest-exported-hard-dependency.py +37 -0
  415. data/ext/gyp/test/hard_dependency/gyptest-no-exported-hard-dependency.py +36 -0
  416. data/ext/gyp/test/hard_dependency/src/a.c +9 -0
  417. data/ext/gyp/test/hard_dependency/src/a.h +12 -0
  418. data/ext/gyp/test/hard_dependency/src/b.c +9 -0
  419. data/ext/gyp/test/hard_dependency/src/b.h +12 -0
  420. data/ext/gyp/test/hard_dependency/src/c.c +10 -0
  421. data/ext/gyp/test/hard_dependency/src/c.h +10 -0
  422. data/ext/gyp/test/hard_dependency/src/d.c +9 -0
  423. data/ext/gyp/test/hard_dependency/src/emit.py +11 -0
  424. data/ext/gyp/test/hard_dependency/src/hard_dependency.gyp +78 -0
  425. data/ext/gyp/test/hello/gyptest-all.py +24 -0
  426. data/ext/gyp/test/hello/gyptest-default.py +24 -0
  427. data/ext/gyp/test/hello/gyptest-disable-regyp.py +32 -0
  428. data/ext/gyp/test/hello/gyptest-regyp-output.py +36 -0
  429. data/ext/gyp/test/hello/gyptest-regyp.py +32 -0
  430. data/ext/gyp/test/hello/gyptest-target.py +24 -0
  431. data/ext/gyp/test/hello/hello.c +11 -0
  432. data/ext/gyp/test/hello/hello.gyp +15 -0
  433. data/ext/gyp/test/hello/hello2.c +11 -0
  434. data/ext/gyp/test/hello/hello2.gyp +15 -0
  435. data/ext/gyp/test/home_dot_gyp/gyptest-home-includes-config-arg.py +31 -0
  436. data/ext/gyp/test/home_dot_gyp/gyptest-home-includes-config-env.py +33 -0
  437. data/ext/gyp/test/home_dot_gyp/gyptest-home-includes-regyp.py +44 -0
  438. data/ext/gyp/test/home_dot_gyp/gyptest-home-includes.py +30 -0
  439. data/ext/gyp/test/home_dot_gyp/home/.gyp/include.gypi +5 -0
  440. data/ext/gyp/test/home_dot_gyp/home2/.gyp/include.gypi +5 -0
  441. data/ext/gyp/test/home_dot_gyp/home2/.gyp_new/include.gypi +5 -0
  442. data/ext/gyp/test/home_dot_gyp/src/all.gyp +22 -0
  443. data/ext/gyp/test/home_dot_gyp/src/printfoo.c +7 -0
  444. data/ext/gyp/test/include_dirs/gyptest-all.py +43 -0
  445. data/ext/gyp/test/include_dirs/gyptest-default.py +43 -0
  446. data/ext/gyp/test/include_dirs/src/inc.h +1 -0
  447. data/ext/gyp/test/include_dirs/src/inc1/include1.h +1 -0
  448. data/ext/gyp/test/include_dirs/src/includes.c +19 -0
  449. data/ext/gyp/test/include_dirs/src/includes.gyp +27 -0
  450. data/ext/gyp/test/include_dirs/src/shadow1/shadow.h +1 -0
  451. data/ext/gyp/test/include_dirs/src/shadow2/shadow.h +1 -0
  452. data/ext/gyp/test/include_dirs/src/subdir/inc.h +1 -0
  453. data/ext/gyp/test/include_dirs/src/subdir/inc2/include2.h +1 -0
  454. data/ext/gyp/test/include_dirs/src/subdir/subdir_includes.c +14 -0
  455. data/ext/gyp/test/include_dirs/src/subdir/subdir_includes.gyp +20 -0
  456. data/ext/gyp/test/intermediate_dir/gyptest-intermediate-dir.py +44 -0
  457. data/ext/gyp/test/intermediate_dir/src/script.py +22 -0
  458. data/ext/gyp/test/intermediate_dir/src/shared_infile.txt +1 -0
  459. data/ext/gyp/test/intermediate_dir/src/test.gyp +42 -0
  460. data/ext/gyp/test/intermediate_dir/src/test2.gyp +42 -0
  461. data/ext/gyp/test/ios/app-bundle/TestApp/English.lproj/InfoPlist-error.strings +3 -0
  462. data/ext/gyp/test/ios/app-bundle/TestApp/English.lproj/InfoPlist.strings +3 -0
  463. data/ext/gyp/test/ios/app-bundle/TestApp/English.lproj/LanguageMap.plist +8 -0
  464. data/ext/gyp/test/ios/app-bundle/TestApp/English.lproj/MainMenu.xib +17 -0
  465. data/ext/gyp/test/ios/app-bundle/TestApp/English.lproj/Main_iPhone.storyboard +27 -0
  466. data/ext/gyp/test/ios/app-bundle/TestApp/Images.xcassets/AppIcon.appiconset/Contents.json +58 -0
  467. data/ext/gyp/test/ios/app-bundle/TestApp/Images.xcassets/image.imageset/Contents.json +23 -0
  468. data/ext/gyp/test/ios/app-bundle/TestApp/Images.xcassets/image.imageset/super_sylvain.png +0 -0
  469. data/ext/gyp/test/ios/app-bundle/TestApp/Images.xcassets/image.imageset/super_sylvain@2x.png +0 -0
  470. data/ext/gyp/test/ios/app-bundle/TestApp/Images.xcassets/image.imageset/super_sylvain@3x.png +0 -0
  471. data/ext/gyp/test/ios/app-bundle/TestApp/TestApp-Info.plist +28 -0
  472. data/ext/gyp/test/ios/app-bundle/TestApp/check_no_signature.py +13 -0
  473. data/ext/gyp/test/ios/app-bundle/TestApp/main.m +13 -0
  474. data/ext/gyp/test/ios/app-bundle/TestApp/only-compile-in-32-bits.m +7 -0
  475. data/ext/gyp/test/ios/app-bundle/TestApp/only-compile-in-64-bits.m +7 -0
  476. data/ext/gyp/test/ios/app-bundle/test-archs.gyp +109 -0
  477. data/ext/gyp/test/ios/app-bundle/test-assets-catalog.gyp +45 -0
  478. data/ext/gyp/test/ios/app-bundle/test-crosscompile.gyp +47 -0
  479. data/ext/gyp/test/ios/app-bundle/test-device.gyp +109 -0
  480. data/ext/gyp/test/ios/app-bundle/test.gyp +75 -0
  481. data/ext/gyp/test/ios/app-bundle/tool_main.cc +7 -0
  482. data/ext/gyp/test/ios/copies-with-xcode-envvars/Info.plist +24 -0
  483. data/ext/gyp/test/ios/copies-with-xcode-envvars/copies-with-xcode-envvars.gyp +97 -0
  484. data/ext/gyp/test/ios/copies-with-xcode-envvars/empty.c +1 -0
  485. data/ext/gyp/test/ios/copies-with-xcode-envvars/file0 +1 -0
  486. data/ext/gyp/test/ios/copies-with-xcode-envvars/file1 +1 -0
  487. data/ext/gyp/test/ios/copies-with-xcode-envvars/file10 +1 -0
  488. data/ext/gyp/test/ios/copies-with-xcode-envvars/file11 +1 -0
  489. data/ext/gyp/test/ios/copies-with-xcode-envvars/file2 +1 -0
  490. data/ext/gyp/test/ios/copies-with-xcode-envvars/file3 +1 -0
  491. data/ext/gyp/test/ios/copies-with-xcode-envvars/file4 +1 -0
  492. data/ext/gyp/test/ios/copies-with-xcode-envvars/file5 +1 -0
  493. data/ext/gyp/test/ios/copies-with-xcode-envvars/file6 +1 -0
  494. data/ext/gyp/test/ios/copies-with-xcode-envvars/file7 +1 -0
  495. data/ext/gyp/test/ios/copies-with-xcode-envvars/file8 +1 -0
  496. data/ext/gyp/test/ios/copies-with-xcode-envvars/file9 +1 -0
  497. data/ext/gyp/test/ios/deployment-target/check-version-min.c +33 -0
  498. data/ext/gyp/test/ios/deployment-target/deployment-target.gyp +34 -0
  499. data/ext/gyp/test/ios/extension/ActionExtension/ActionViewController.h +9 -0
  500. data/ext/gyp/test/ios/extension/ActionExtension/ActionViewController.m +31 -0
  501. data/ext/gyp/test/ios/extension/ActionExtension/Info.plist +42 -0
  502. data/ext/gyp/test/ios/extension/ActionExtension/MainInterface.storyboard +63 -0
  503. data/ext/gyp/test/ios/extension/ExtensionContainer/AppDelegate.h +12 -0
  504. data/ext/gyp/test/ios/extension/ExtensionContainer/AppDelegate.m +19 -0
  505. data/ext/gyp/test/ios/extension/ExtensionContainer/Base.lproj/Main.storyboard +25 -0
  506. data/ext/gyp/test/ios/extension/ExtensionContainer/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
  507. data/ext/gyp/test/ios/extension/ExtensionContainer/Images.xcassets/LaunchImage.launchimage/Contents.json +51 -0
  508. data/ext/gyp/test/ios/extension/ExtensionContainer/Info.plist +32 -0
  509. data/ext/gyp/test/ios/extension/ExtensionContainer/ViewController.h +11 -0
  510. data/ext/gyp/test/ios/extension/ExtensionContainer/ViewController.m +24 -0
  511. data/ext/gyp/test/ios/extension/ExtensionContainer/main.m +13 -0
  512. data/ext/gyp/test/ios/extension/extension.gyp +91 -0
  513. data/ext/gyp/test/ios/framework/framework.gyp +43 -0
  514. data/ext/gyp/test/ios/framework/iOSFramework/Info.plist +26 -0
  515. data/ext/gyp/test/ios/framework/iOSFramework/Thing.h +10 -0
  516. data/ext/gyp/test/ios/framework/iOSFramework/Thing.m +22 -0
  517. data/ext/gyp/test/ios/framework/iOSFramework/iOSFramework.h +9 -0
  518. data/ext/gyp/test/ios/gyptest-app-ios-assets-catalog.py +57 -0
  519. data/ext/gyp/test/ios/gyptest-app-ios.py +76 -0
  520. data/ext/gyp/test/ios/gyptest-archs.py +62 -0
  521. data/ext/gyp/test/ios/gyptest-copies-with-xcode-envvars.py +65 -0
  522. data/ext/gyp/test/ios/gyptest-crosscompile.py +34 -0
  523. data/ext/gyp/test/ios/gyptest-deployment-target.py +23 -0
  524. data/ext/gyp/test/ios/gyptest-extension.py +51 -0
  525. data/ext/gyp/test/ios/gyptest-framework.py +37 -0
  526. data/ext/gyp/test/ios/gyptest-per-config-settings.py +190 -0
  527. data/ext/gyp/test/ios/gyptest-watch.py +44 -0
  528. data/ext/gyp/test/ios/gyptest-xcode-ninja.py +25 -0
  529. data/ext/gyp/test/ios/watch/WatchApp/Images.xcassets/AppIcon.appiconset/Contents.json +62 -0
  530. data/ext/gyp/test/ios/watch/WatchApp/Images.xcassets/LaunchImage.launchimage/Contents.json +24 -0
  531. data/ext/gyp/test/ios/watch/WatchApp/Info.plist +35 -0
  532. data/ext/gyp/test/ios/watch/WatchApp/Interface.storyboard +15 -0
  533. data/ext/gyp/test/ios/watch/WatchContainer/AppDelegate.h +12 -0
  534. data/ext/gyp/test/ios/watch/WatchContainer/AppDelegate.m +19 -0
  535. data/ext/gyp/test/ios/watch/WatchContainer/Base.lproj/Main.storyboard +25 -0
  536. data/ext/gyp/test/ios/watch/WatchContainer/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
  537. data/ext/gyp/test/ios/watch/WatchContainer/Images.xcassets/LaunchImage.launchimage/Contents.json +51 -0
  538. data/ext/gyp/test/ios/watch/WatchContainer/Info.plist +32 -0
  539. data/ext/gyp/test/ios/watch/WatchContainer/ViewController.h +11 -0
  540. data/ext/gyp/test/ios/watch/WatchContainer/ViewController.m +24 -0
  541. data/ext/gyp/test/ios/watch/WatchContainer/main.m +13 -0
  542. data/ext/gyp/test/ios/watch/WatchKitExtension/Images.xcassets/MyImage.imageset/Contents.json +20 -0
  543. data/ext/gyp/test/ios/watch/WatchKitExtension/Info.plist +38 -0
  544. data/ext/gyp/test/ios/watch/WatchKitExtension/InterfaceController.h +10 -0
  545. data/ext/gyp/test/ios/watch/WatchKitExtension/InterfaceController.m +25 -0
  546. data/ext/gyp/test/ios/watch/WatchKitExtension/MainInterface.storyboard +63 -0
  547. data/ext/gyp/test/ios/watch/watch.gyp +105 -0
  548. data/ext/gyp/test/ios/xctests/App/AppDelegate.h +11 -0
  549. data/ext/gyp/test/ios/xctests/App/AppDelegate.m +18 -0
  550. data/ext/gyp/test/ios/xctests/App/Base.lproj/LaunchScreen.xib +41 -0
  551. data/ext/gyp/test/ios/xctests/App/Base.lproj/Main.storyboard +25 -0
  552. data/ext/gyp/test/ios/xctests/App/Images.xcassets/AppIcon.appiconset/Contents.json +68 -0
  553. data/ext/gyp/test/ios/xctests/App/Info.plist +47 -0
  554. data/ext/gyp/test/ios/xctests/App/ViewController.h +9 -0
  555. data/ext/gyp/test/ios/xctests/App/ViewController.m +21 -0
  556. data/ext/gyp/test/ios/xctests/App/main.m +13 -0
  557. data/ext/gyp/test/ios/xctests/AppTests/AppTests.m +31 -0
  558. data/ext/gyp/test/ios/xctests/AppTests/Info.plist +24 -0
  559. data/ext/gyp/test/ios/xctests/gyptest-xctests.py +49 -0
  560. data/ext/gyp/test/ios/xctests/xctests.gyp +74 -0
  561. data/ext/gyp/test/lib/README.txt +17 -0
  562. data/ext/gyp/test/lib/TestCmd.py +1597 -0
  563. data/ext/gyp/test/lib/TestCommon.py +591 -0
  564. data/ext/gyp/test/lib/TestGyp.py +1259 -0
  565. data/ext/gyp/test/lib/TestMac.py +76 -0
  566. data/ext/gyp/test/lib/TestWin.py +101 -0
  567. data/ext/gyp/test/library/gyptest-shared-obj-install-path.py +39 -0
  568. data/ext/gyp/test/library/gyptest-shared.py +84 -0
  569. data/ext/gyp/test/library/gyptest-static.py +84 -0
  570. data/ext/gyp/test/library/src/lib1.c +10 -0
  571. data/ext/gyp/test/library/src/lib1_moveable.c +10 -0
  572. data/ext/gyp/test/library/src/lib2.c +10 -0
  573. data/ext/gyp/test/library/src/lib2_moveable.c +10 -0
  574. data/ext/gyp/test/library/src/library.gyp +58 -0
  575. data/ext/gyp/test/library/src/program.c +15 -0
  576. data/ext/gyp/test/library/src/shared_dependency.gyp +33 -0
  577. data/ext/gyp/test/library_dirs/gyptest-library-dirs.py +50 -0
  578. data/ext/gyp/test/library_dirs/subdir/README.txt +1 -0
  579. data/ext/gyp/test/library_dirs/subdir/hello.cc +11 -0
  580. data/ext/gyp/test/library_dirs/subdir/mylib.cc +9 -0
  581. data/ext/gyp/test/library_dirs/subdir/mylib.h +12 -0
  582. data/ext/gyp/test/library_dirs/subdir/test-win.gyp +60 -0
  583. data/ext/gyp/test/library_dirs/subdir/test.gyp +68 -0
  584. data/ext/gyp/test/link-dependency/gyptest-link-dependency.py +23 -0
  585. data/ext/gyp/test/link-dependency/main.c +7 -0
  586. data/ext/gyp/test/link-dependency/mymalloc.c +12 -0
  587. data/ext/gyp/test/link-dependency/test.gyp +37 -0
  588. data/ext/gyp/test/link-objects/base.c +6 -0
  589. data/ext/gyp/test/link-objects/extra.c +5 -0
  590. data/ext/gyp/test/link-objects/gyptest-all.py +28 -0
  591. data/ext/gyp/test/link-objects/link-objects.gyp +24 -0
  592. data/ext/gyp/test/linux/gyptest-implicit-rpath.py +48 -0
  593. data/ext/gyp/test/linux/gyptest-ldflags-duplicates.py +22 -0
  594. data/ext/gyp/test/linux/gyptest-ldflags-from-environment.py +45 -0
  595. data/ext/gyp/test/linux/gyptest-target-rpath.py +43 -0
  596. data/ext/gyp/test/linux/implicit-rpath/file.c +1 -0
  597. data/ext/gyp/test/linux/implicit-rpath/main.c +1 -0
  598. data/ext/gyp/test/linux/implicit-rpath/test.gyp +47 -0
  599. data/ext/gyp/test/linux/ldflags-duplicates/check-ldflags.py +28 -0
  600. data/ext/gyp/test/linux/ldflags-duplicates/lib1.c +6 -0
  601. data/ext/gyp/test/linux/ldflags-duplicates/lib2.c +6 -0
  602. data/ext/gyp/test/linux/ldflags-duplicates/main.c +7 -0
  603. data/ext/gyp/test/linux/ldflags-duplicates/test.gyp +45 -0
  604. data/ext/gyp/test/linux/ldflags-from-environment/main.c +7 -0
  605. data/ext/gyp/test/linux/ldflags-from-environment/test.gyp +23 -0
  606. data/ext/gyp/test/linux/target-rpath/file.c +1 -0
  607. data/ext/gyp/test/linux/target-rpath/main.c +1 -0
  608. data/ext/gyp/test/linux/target-rpath/test.gyp +47 -0
  609. data/ext/gyp/test/mac/action-envvars/action/action.gyp +34 -0
  610. data/ext/gyp/test/mac/action-envvars/action/action.sh +8 -0
  611. data/ext/gyp/test/mac/app-bundle/TestApp/English.lproj/InfoPlist-error.strings +3 -0
  612. data/ext/gyp/test/mac/app-bundle/TestApp/English.lproj/InfoPlist.strings +3 -0
  613. data/ext/gyp/test/mac/app-bundle/TestApp/English.lproj/MainMenu.xib +4119 -0
  614. data/ext/gyp/test/mac/app-bundle/TestApp/English.lproj/utf-16be.strings +0 -0
  615. data/ext/gyp/test/mac/app-bundle/TestApp/English.lproj/utf-16le.strings +0 -0
  616. data/ext/gyp/test/mac/app-bundle/TestApp/Images.xcassets/AppIcon.appiconset/Contents.json +58 -0
  617. data/ext/gyp/test/mac/app-bundle/TestApp/Images.xcassets/image.imageset/Contents.json +23 -0
  618. data/ext/gyp/test/mac/app-bundle/TestApp/Images.xcassets/image.imageset/super_sylvain.png +0 -0
  619. data/ext/gyp/test/mac/app-bundle/TestApp/Images.xcassets/image.imageset/super_sylvain@2x.png +0 -0
  620. data/ext/gyp/test/mac/app-bundle/TestApp/Images.xcassets/image.imageset/super_sylvain@3x.png +0 -0
  621. data/ext/gyp/test/mac/app-bundle/TestApp/TestApp-Info.plist +34 -0
  622. data/ext/gyp/test/mac/app-bundle/TestApp/TestAppAppDelegate.h +13 -0
  623. data/ext/gyp/test/mac/app-bundle/TestApp/TestAppAppDelegate.m +15 -0
  624. data/ext/gyp/test/mac/app-bundle/TestApp/main.m +10 -0
  625. data/ext/gyp/test/mac/app-bundle/empty.c +0 -0
  626. data/ext/gyp/test/mac/app-bundle/test-assets-catalog.gyp +43 -0
  627. data/ext/gyp/test/mac/app-bundle/test-error.gyp +31 -0
  628. data/ext/gyp/test/mac/app-bundle/test.gyp +41 -0
  629. data/ext/gyp/test/mac/archs/empty_main.cc +1 -0
  630. data/ext/gyp/test/mac/archs/file.mm +1 -0
  631. data/ext/gyp/test/mac/archs/file_a.cc +8 -0
  632. data/ext/gyp/test/mac/archs/file_a.h +10 -0
  633. data/ext/gyp/test/mac/archs/file_b.cc +8 -0
  634. data/ext/gyp/test/mac/archs/file_b.h +10 -0
  635. data/ext/gyp/test/mac/archs/file_c.cc +11 -0
  636. data/ext/gyp/test/mac/archs/file_d.cc +11 -0
  637. data/ext/gyp/test/mac/archs/header.h +1 -0
  638. data/ext/gyp/test/mac/archs/my_file.cc +4 -0
  639. data/ext/gyp/test/mac/archs/my_main_file.cc +9 -0
  640. data/ext/gyp/test/mac/archs/test-archs-multiarch.gyp +92 -0
  641. data/ext/gyp/test/mac/archs/test-archs-x86_64.gyp +27 -0
  642. data/ext/gyp/test/mac/archs/test-dependencies.gyp +92 -0
  643. data/ext/gyp/test/mac/archs/test-no-archs.gyp +21 -0
  644. data/ext/gyp/test/mac/archs/test-valid-archs.gyp +28 -0
  645. data/ext/gyp/test/mac/bundle-resources/change.sh +3 -0
  646. data/ext/gyp/test/mac/bundle-resources/executable-file.sh +3 -0
  647. data/ext/gyp/test/mac/bundle-resources/secret.txt +1 -0
  648. data/ext/gyp/test/mac/bundle-resources/test.gyp +59 -0
  649. data/ext/gyp/test/mac/cflags/ccfile.cc +7 -0
  650. data/ext/gyp/test/mac/cflags/ccfile_withcflags.cc +7 -0
  651. data/ext/gyp/test/mac/cflags/cfile.c +7 -0
  652. data/ext/gyp/test/mac/cflags/cppfile.cpp +7 -0
  653. data/ext/gyp/test/mac/cflags/cppfile_withcflags.cpp +7 -0
  654. data/ext/gyp/test/mac/cflags/cxxfile.cxx +7 -0
  655. data/ext/gyp/test/mac/cflags/cxxfile_withcflags.cxx +7 -0
  656. data/ext/gyp/test/mac/cflags/mfile.m +7 -0
  657. data/ext/gyp/test/mac/cflags/mmfile.mm +7 -0
  658. data/ext/gyp/test/mac/cflags/mmfile_withcflags.mm +7 -0
  659. data/ext/gyp/test/mac/cflags/test.gyp +132 -0
  660. data/ext/gyp/test/mac/clang-cxx-language-standard/c++11.cc +8 -0
  661. data/ext/gyp/test/mac/clang-cxx-language-standard/c++98.cc +24 -0
  662. data/ext/gyp/test/mac/clang-cxx-language-standard/clang-cxx-language-standard.gyp +30 -0
  663. data/ext/gyp/test/mac/clang-cxx-library/clang-cxx-library.gyp +32 -0
  664. data/ext/gyp/test/mac/clang-cxx-library/libc++.cc +11 -0
  665. data/ext/gyp/test/mac/clang-cxx-library/libstdc++.cc +11 -0
  666. data/ext/gyp/test/mac/copies-with-xcode-envvars/copies-with-xcode-envvars.gyp +87 -0
  667. data/ext/gyp/test/mac/copies-with-xcode-envvars/empty.c +1 -0
  668. data/ext/gyp/test/mac/copies-with-xcode-envvars/file0 +1 -0
  669. data/ext/gyp/test/mac/copies-with-xcode-envvars/file1 +1 -0
  670. data/ext/gyp/test/mac/copies-with-xcode-envvars/file10 +1 -0
  671. data/ext/gyp/test/mac/copies-with-xcode-envvars/file11 +1 -0
  672. data/ext/gyp/test/mac/copies-with-xcode-envvars/file2 +1 -0
  673. data/ext/gyp/test/mac/copies-with-xcode-envvars/file3 +1 -0
  674. data/ext/gyp/test/mac/copies-with-xcode-envvars/file4 +1 -0
  675. data/ext/gyp/test/mac/copies-with-xcode-envvars/file5 +1 -0
  676. data/ext/gyp/test/mac/copies-with-xcode-envvars/file6 +1 -0
  677. data/ext/gyp/test/mac/copies-with-xcode-envvars/file7 +1 -0
  678. data/ext/gyp/test/mac/copies-with-xcode-envvars/file8 +1 -0
  679. data/ext/gyp/test/mac/copies-with-xcode-envvars/file9 +1 -0
  680. data/ext/gyp/test/mac/copy-dylib/empty.c +1 -0
  681. data/ext/gyp/test/mac/copy-dylib/test.gyp +31 -0
  682. data/ext/gyp/test/mac/debuginfo/file.c +6 -0
  683. data/ext/gyp/test/mac/debuginfo/test.gyp +82 -0
  684. data/ext/gyp/test/mac/depend-on-bundle/English.lproj/InfoPlist.strings +1 -0
  685. data/ext/gyp/test/mac/depend-on-bundle/Info.plist +28 -0
  686. data/ext/gyp/test/mac/depend-on-bundle/bundle.c +1 -0
  687. data/ext/gyp/test/mac/depend-on-bundle/executable.c +4 -0
  688. data/ext/gyp/test/mac/depend-on-bundle/test.gyp +28 -0
  689. data/ext/gyp/test/mac/deployment-target/check-version-min.c +33 -0
  690. data/ext/gyp/test/mac/deployment-target/deployment-target.gyp +28 -0
  691. data/ext/gyp/test/mac/framework/TestFramework/English.lproj/InfoPlist.strings +2 -0
  692. data/ext/gyp/test/mac/framework/TestFramework/Info.plist +28 -0
  693. data/ext/gyp/test/mac/framework/TestFramework/ObjCVector.h +28 -0
  694. data/ext/gyp/test/mac/framework/TestFramework/ObjCVector.mm +63 -0
  695. data/ext/gyp/test/mac/framework/TestFramework/ObjCVectorInternal.h +9 -0
  696. data/ext/gyp/test/mac/framework/TestFramework/TestFramework_Prefix.pch +7 -0
  697. data/ext/gyp/test/mac/framework/empty.c +0 -0
  698. data/ext/gyp/test/mac/framework/framework.gyp +108 -0
  699. data/ext/gyp/test/mac/framework-dirs/calculate.c +15 -0
  700. data/ext/gyp/test/mac/framework-dirs/framework-dirs.gyp +21 -0
  701. data/ext/gyp/test/mac/framework-headers/myframework.h +8 -0
  702. data/ext/gyp/test/mac/framework-headers/myframework.m +8 -0
  703. data/ext/gyp/test/mac/framework-headers/test.gyp +44 -0
  704. data/ext/gyp/test/mac/global-settings/src/dir1/dir1.gyp +11 -0
  705. data/ext/gyp/test/mac/global-settings/src/dir2/dir2.gyp +22 -0
  706. data/ext/gyp/test/mac/global-settings/src/dir2/file.txt +1 -0
  707. data/ext/gyp/test/mac/gyptest-action-envvars.py +36 -0
  708. data/ext/gyp/test/mac/gyptest-app-assets-catalog.py +125 -0
  709. data/ext/gyp/test/mac/gyptest-app-error.py +49 -0
  710. data/ext/gyp/test/mac/gyptest-app.py +122 -0
  711. data/ext/gyp/test/mac/gyptest-archs.py +96 -0
  712. data/ext/gyp/test/mac/gyptest-bundle-resources.py +64 -0
  713. data/ext/gyp/test/mac/gyptest-cflags.py +21 -0
  714. data/ext/gyp/test/mac/gyptest-clang-cxx-language-standard.py +25 -0
  715. data/ext/gyp/test/mac/gyptest-clang-cxx-library.py +32 -0
  716. data/ext/gyp/test/mac/gyptest-copies-with-xcode-envvars.py +65 -0
  717. data/ext/gyp/test/mac/gyptest-copies.py +62 -0
  718. data/ext/gyp/test/mac/gyptest-copy-dylib.py +25 -0
  719. data/ext/gyp/test/mac/gyptest-debuginfo.py +36 -0
  720. data/ext/gyp/test/mac/gyptest-depend-on-bundle.py +45 -0
  721. data/ext/gyp/test/mac/gyptest-deployment-target.py +27 -0
  722. data/ext/gyp/test/mac/gyptest-framework-dirs.py +23 -0
  723. data/ext/gyp/test/mac/gyptest-framework-headers.py +38 -0
  724. data/ext/gyp/test/mac/gyptest-framework.py +80 -0
  725. data/ext/gyp/test/mac/gyptest-global-settings.py +33 -0
  726. data/ext/gyp/test/mac/gyptest-identical-name.py +45 -0
  727. data/ext/gyp/test/mac/gyptest-infoplist-process.py +56 -0
  728. data/ext/gyp/test/mac/gyptest-installname.py +85 -0
  729. data/ext/gyp/test/mac/gyptest-kext.py +27 -0
  730. data/ext/gyp/test/mac/gyptest-ldflags-passed-to-libtool.py +37 -0
  731. data/ext/gyp/test/mac/gyptest-ldflags.py +74 -0
  732. data/ext/gyp/test/mac/gyptest-libraries.py +30 -0
  733. data/ext/gyp/test/mac/gyptest-libtool-zero.py +26 -0
  734. data/ext/gyp/test/mac/gyptest-loadable-module-bundle-product-extension.py +31 -0
  735. data/ext/gyp/test/mac/gyptest-loadable-module.py +54 -0
  736. data/ext/gyp/test/mac/gyptest-lto.py +66 -0
  737. data/ext/gyp/test/mac/gyptest-missing-cfbundlesignature.py +34 -0
  738. data/ext/gyp/test/mac/gyptest-non-strs-flattened-to-env.py +38 -0
  739. data/ext/gyp/test/mac/gyptest-objc-arc.py +27 -0
  740. data/ext/gyp/test/mac/gyptest-objc-gc.py +51 -0
  741. data/ext/gyp/test/mac/gyptest-postbuild-copy-bundle.py +75 -0
  742. data/ext/gyp/test/mac/gyptest-postbuild-defaults.py +34 -0
  743. data/ext/gyp/test/mac/gyptest-postbuild-fail.py +71 -0
  744. data/ext/gyp/test/mac/gyptest-postbuild-multiple-configurations.py +26 -0
  745. data/ext/gyp/test/mac/gyptest-postbuild-static-library.py +28 -0
  746. data/ext/gyp/test/mac/gyptest-postbuild.py +53 -0
  747. data/ext/gyp/test/mac/gyptest-prefixheader.py +20 -0
  748. data/ext/gyp/test/mac/gyptest-rebuild.py +46 -0
  749. data/ext/gyp/test/mac/gyptest-rpath.py +50 -0
  750. data/ext/gyp/test/mac/gyptest-sdkroot.py +56 -0
  751. data/ext/gyp/test/mac/gyptest-sourceless-module.py +77 -0
  752. data/ext/gyp/test/mac/gyptest-strip-default.py +97 -0
  753. data/ext/gyp/test/mac/gyptest-strip.py +66 -0
  754. data/ext/gyp/test/mac/gyptest-swift-library.py +67 -0
  755. data/ext/gyp/test/mac/gyptest-type-envvars.py +26 -0
  756. data/ext/gyp/test/mac/gyptest-unicode-settings.py +20 -0
  757. data/ext/gyp/test/mac/gyptest-xcode-env-order.py +95 -0
  758. data/ext/gyp/test/mac/gyptest-xcode-gcc-clang.py +40 -0
  759. data/ext/gyp/test/mac/gyptest-xcode-gcc.py +60 -0
  760. data/ext/gyp/test/mac/gyptest-xcode-support-actions.py +25 -0
  761. data/ext/gyp/test/mac/gyptest-xctest.py +41 -0
  762. data/ext/gyp/test/mac/gyptest-xcuitest.py +39 -0
  763. data/ext/gyp/test/mac/identical-name/proxy/proxy.cc +2 -0
  764. data/ext/gyp/test/mac/identical-name/proxy/proxy.gyp +9 -0
  765. data/ext/gyp/test/mac/identical-name/proxy/testlib/testlib.cc +2 -0
  766. data/ext/gyp/test/mac/identical-name/proxy/testlib/testlib.gyp +8 -0
  767. data/ext/gyp/test/mac/identical-name/test-should-fail.gyp +10 -0
  768. data/ext/gyp/test/mac/identical-name/test.gyp +11 -0
  769. data/ext/gyp/test/mac/identical-name/test.gypi +7 -0
  770. data/ext/gyp/test/mac/identical-name/testlib/main.cc +3 -0
  771. data/ext/gyp/test/mac/identical-name/testlib/testlib.gyp +14 -0
  772. data/ext/gyp/test/mac/identical-name/testlib/void.cc +2 -0
  773. data/ext/gyp/test/mac/infoplist-process/Info.plist +36 -0
  774. data/ext/gyp/test/mac/infoplist-process/main.c +7 -0
  775. data/ext/gyp/test/mac/infoplist-process/test1.gyp +25 -0
  776. data/ext/gyp/test/mac/infoplist-process/test2.gyp +25 -0
  777. data/ext/gyp/test/mac/infoplist-process/test3.gyp +25 -0
  778. data/ext/gyp/test/mac/installname/Info.plist +28 -0
  779. data/ext/gyp/test/mac/installname/file.c +1 -0
  780. data/ext/gyp/test/mac/installname/main.c +1 -0
  781. data/ext/gyp/test/mac/installname/test.gyp +93 -0
  782. data/ext/gyp/test/mac/kext/GypKext/GypKext-Info.plist +35 -0
  783. data/ext/gyp/test/mac/kext/GypKext/GypKext.c +16 -0
  784. data/ext/gyp/test/mac/kext/kext.gyp +18 -0
  785. data/ext/gyp/test/mac/ldflags/subdirectory/Info.plist +8 -0
  786. data/ext/gyp/test/mac/ldflags/subdirectory/file.c +2 -0
  787. data/ext/gyp/test/mac/ldflags/subdirectory/symbol_list.def +1 -0
  788. data/ext/gyp/test/mac/ldflags/subdirectory/test.gyp +66 -0
  789. data/ext/gyp/test/mac/ldflags-libtool/file.c +1 -0
  790. data/ext/gyp/test/mac/ldflags-libtool/test.gyp +17 -0
  791. data/ext/gyp/test/mac/libraries/subdir/README.txt +1 -0
  792. data/ext/gyp/test/mac/libraries/subdir/hello.cc +10 -0
  793. data/ext/gyp/test/mac/libraries/subdir/mylib.c +7 -0
  794. data/ext/gyp/test/mac/libraries/subdir/test.gyp +65 -0
  795. data/ext/gyp/test/mac/libtool-zero/mylib.c +7 -0
  796. data/ext/gyp/test/mac/libtool-zero/test.gyp +18 -0
  797. data/ext/gyp/test/mac/loadable-module/Info.plist +26 -0
  798. data/ext/gyp/test/mac/loadable-module/module.c +11 -0
  799. data/ext/gyp/test/mac/loadable-module/test.gyp +18 -0
  800. data/ext/gyp/test/mac/loadable-module-bundle-product-extension/src.cc +7 -0
  801. data/ext/gyp/test/mac/loadable-module-bundle-product-extension/test.gyp +24 -0
  802. data/ext/gyp/test/mac/lto/asmfile.S +2 -0
  803. data/ext/gyp/test/mac/lto/ccfile.cc +1 -0
  804. data/ext/gyp/test/mac/lto/cfile.c +1 -0
  805. data/ext/gyp/test/mac/lto/mfile.m +1 -0
  806. data/ext/gyp/test/mac/lto/mmfile.mm +1 -0
  807. data/ext/gyp/test/mac/lto/test.gyp +35 -0
  808. data/ext/gyp/test/mac/missing-cfbundlesignature/Info.plist +10 -0
  809. data/ext/gyp/test/mac/missing-cfbundlesignature/Other-Info.plist +12 -0
  810. data/ext/gyp/test/mac/missing-cfbundlesignature/Third-Info.plist +12 -0
  811. data/ext/gyp/test/mac/missing-cfbundlesignature/file.c +1 -0
  812. data/ext/gyp/test/mac/missing-cfbundlesignature/test.gyp +34 -0
  813. data/ext/gyp/test/mac/non-strs-flattened-to-env/Info.plist +15 -0
  814. data/ext/gyp/test/mac/non-strs-flattened-to-env/main.c +7 -0
  815. data/ext/gyp/test/mac/non-strs-flattened-to-env/test.gyp +27 -0
  816. data/ext/gyp/test/mac/objc-arc/c-file.c +5 -0
  817. data/ext/gyp/test/mac/objc-arc/cc-file.cc +5 -0
  818. data/ext/gyp/test/mac/objc-arc/m-file-arc-weak.m +9 -0
  819. data/ext/gyp/test/mac/objc-arc/m-file-no-arc.m +9 -0
  820. data/ext/gyp/test/mac/objc-arc/m-file.m +9 -0
  821. data/ext/gyp/test/mac/objc-arc/mm-file-arc-weak.mm +9 -0
  822. data/ext/gyp/test/mac/objc-arc/mm-file-no-arc.mm +9 -0
  823. data/ext/gyp/test/mac/objc-arc/mm-file.mm +9 -0
  824. data/ext/gyp/test/mac/objc-arc/test.gyp +53 -0
  825. data/ext/gyp/test/mac/objc-gc/c-file.c +1 -0
  826. data/ext/gyp/test/mac/objc-gc/cc-file.cc +1 -0
  827. data/ext/gyp/test/mac/objc-gc/main.m +6 -0
  828. data/ext/gyp/test/mac/objc-gc/needs-gc-mm.mm +1 -0
  829. data/ext/gyp/test/mac/objc-gc/needs-gc.m +1 -0
  830. data/ext/gyp/test/mac/objc-gc/test.gyp +102 -0
  831. data/ext/gyp/test/mac/postbuild-copy-bundle/Framework-Info.plist +30 -0
  832. data/ext/gyp/test/mac/postbuild-copy-bundle/TestApp-Info.plist +32 -0
  833. data/ext/gyp/test/mac/postbuild-copy-bundle/copied.txt +1 -0
  834. data/ext/gyp/test/mac/postbuild-copy-bundle/empty.c +0 -0
  835. data/ext/gyp/test/mac/postbuild-copy-bundle/main.c +4 -0
  836. data/ext/gyp/test/mac/postbuild-copy-bundle/postbuild-copy-framework.sh +9 -0
  837. data/ext/gyp/test/mac/postbuild-copy-bundle/resource_file.sb +1 -0
  838. data/ext/gyp/test/mac/postbuild-copy-bundle/test.gyp +49 -0
  839. data/ext/gyp/test/mac/postbuild-defaults/Info.plist +13 -0
  840. data/ext/gyp/test/mac/postbuild-defaults/main.c +7 -0
  841. data/ext/gyp/test/mac/postbuild-defaults/postbuild-defaults.sh +15 -0
  842. data/ext/gyp/test/mac/postbuild-defaults/test.gyp +26 -0
  843. data/ext/gyp/test/mac/postbuild-fail/file.c +6 -0
  844. data/ext/gyp/test/mac/postbuild-fail/postbuild-fail.sh +6 -0
  845. data/ext/gyp/test/mac/postbuild-fail/test.gyp +38 -0
  846. data/ext/gyp/test/mac/postbuild-fail/touch-dynamic.sh +7 -0
  847. data/ext/gyp/test/mac/postbuild-fail/touch-static.sh +7 -0
  848. data/ext/gyp/test/mac/postbuild-multiple-configurations/main.c +4 -0
  849. data/ext/gyp/test/mac/postbuild-multiple-configurations/postbuild-touch-file.sh +7 -0
  850. data/ext/gyp/test/mac/postbuild-multiple-configurations/test.gyp +26 -0
  851. data/ext/gyp/test/mac/postbuild-static-library/empty.c +4 -0
  852. data/ext/gyp/test/mac/postbuild-static-library/postbuild-touch-file.sh +7 -0
  853. data/ext/gyp/test/mac/postbuild-static-library/test.gyp +34 -0
  854. data/ext/gyp/test/mac/postbuilds/copy.sh +3 -0
  855. data/ext/gyp/test/mac/postbuilds/file.c +4 -0
  856. data/ext/gyp/test/mac/postbuilds/file_g.c +4 -0
  857. data/ext/gyp/test/mac/postbuilds/file_h.c +4 -0
  858. data/ext/gyp/test/mac/postbuilds/script/shared_library_postbuild.sh +23 -0
  859. data/ext/gyp/test/mac/postbuilds/script/static_library_postbuild.sh +23 -0
  860. data/ext/gyp/test/mac/postbuilds/subdirectory/copied_file.txt +1 -0
  861. data/ext/gyp/test/mac/postbuilds/subdirectory/nested_target.gyp +53 -0
  862. data/ext/gyp/test/mac/postbuilds/test.gyp +93 -0
  863. data/ext/gyp/test/mac/prefixheader/file.c +1 -0
  864. data/ext/gyp/test/mac/prefixheader/file.cc +1 -0
  865. data/ext/gyp/test/mac/prefixheader/file.m +1 -0
  866. data/ext/gyp/test/mac/prefixheader/file.mm +1 -0
  867. data/ext/gyp/test/mac/prefixheader/header.h +1 -0
  868. data/ext/gyp/test/mac/prefixheader/test.gyp +82 -0
  869. data/ext/gyp/test/mac/rebuild/TestApp-Info.plist +32 -0
  870. data/ext/gyp/test/mac/rebuild/delay-touch.sh +6 -0
  871. data/ext/gyp/test/mac/rebuild/empty.c +0 -0
  872. data/ext/gyp/test/mac/rebuild/main.c +1 -0
  873. data/ext/gyp/test/mac/rebuild/test.gyp +56 -0
  874. data/ext/gyp/test/mac/rpath/file.c +1 -0
  875. data/ext/gyp/test/mac/rpath/main.c +1 -0
  876. data/ext/gyp/test/mac/rpath/test.gyp +48 -0
  877. data/ext/gyp/test/mac/sdkroot/file.cc +5 -0
  878. data/ext/gyp/test/mac/sdkroot/test.gyp +35 -0
  879. data/ext/gyp/test/mac/sdkroot/test_shorthand.sh +20 -0
  880. data/ext/gyp/test/mac/sourceless-module/empty.c +1 -0
  881. data/ext/gyp/test/mac/sourceless-module/empty.txt +2 -0
  882. data/ext/gyp/test/mac/sourceless-module/fun.c +1 -0
  883. data/ext/gyp/test/mac/sourceless-module/test.gyp +96 -0
  884. data/ext/gyp/test/mac/strip/file.c +22 -0
  885. data/ext/gyp/test/mac/strip/main.c +25 -0
  886. data/ext/gyp/test/mac/strip/strip.saves +5 -0
  887. data/ext/gyp/test/mac/strip/subdirectory/nested_file.c +1 -0
  888. data/ext/gyp/test/mac/strip/subdirectory/nested_strip.saves +5 -0
  889. data/ext/gyp/test/mac/strip/subdirectory/subdirectory.gyp +38 -0
  890. data/ext/gyp/test/mac/strip/subdirectory/test_reading_save_file_from_postbuild.sh +5 -0
  891. data/ext/gyp/test/mac/strip/test-defaults.gyp +51 -0
  892. data/ext/gyp/test/mac/strip/test.gyp +119 -0
  893. data/ext/gyp/test/mac/swift-library/Info.plist +28 -0
  894. data/ext/gyp/test/mac/swift-library/file.swift +9 -0
  895. data/ext/gyp/test/mac/swift-library/test.gyp +21 -0
  896. data/ext/gyp/test/mac/type_envvars/file.c +6 -0
  897. data/ext/gyp/test/mac/type_envvars/test.gyp +100 -0
  898. data/ext/gyp/test/mac/type_envvars/test_bundle_executable.sh +30 -0
  899. data/ext/gyp/test/mac/type_envvars/test_bundle_loadable_module.sh +35 -0
  900. data/ext/gyp/test/mac/type_envvars/test_bundle_shared_library.sh +38 -0
  901. data/ext/gyp/test/mac/type_envvars/test_check_sdkroot.sh +47 -0
  902. data/ext/gyp/test/mac/type_envvars/test_nonbundle_executable.sh +33 -0
  903. data/ext/gyp/test/mac/type_envvars/test_nonbundle_loadable_module.sh +31 -0
  904. data/ext/gyp/test/mac/type_envvars/test_nonbundle_none.sh +32 -0
  905. data/ext/gyp/test/mac/type_envvars/test_nonbundle_shared_library.sh +31 -0
  906. data/ext/gyp/test/mac/type_envvars/test_nonbundle_static_library.sh +31 -0
  907. data/ext/gyp/test/mac/unicode-settings/file.cc +2 -0
  908. data/ext/gyp/test/mac/unicode-settings/test.gyp +23 -0
  909. data/ext/gyp/test/mac/unicode-settings/test_bundle_display_name.sh +7 -0
  910. data/ext/gyp/test/mac/xcode-env-order/Info.plist +56 -0
  911. data/ext/gyp/test/mac/xcode-env-order/file.ext1 +0 -0
  912. data/ext/gyp/test/mac/xcode-env-order/file.ext2 +0 -0
  913. data/ext/gyp/test/mac/xcode-env-order/file.ext3 +0 -0
  914. data/ext/gyp/test/mac/xcode-env-order/main.c +7 -0
  915. data/ext/gyp/test/mac/xcode-env-order/test.gyp +121 -0
  916. data/ext/gyp/test/mac/xcode-gcc/aliasing.cc +13 -0
  917. data/ext/gyp/test/mac/xcode-gcc/test-clang.gyp +42 -0
  918. data/ext/gyp/test/mac/xcode-gcc/test.gyp +60 -0
  919. data/ext/gyp/test/mac/xcode-gcc/valid_c.c +8 -0
  920. data/ext/gyp/test/mac/xcode-gcc/valid_cc.cc +8 -0
  921. data/ext/gyp/test/mac/xcode-gcc/valid_m.m +8 -0
  922. data/ext/gyp/test/mac/xcode-gcc/valid_mm.mm +8 -0
  923. data/ext/gyp/test/mac/xcode-gcc/warn_about_invalid_offsetof_macro.cc +15 -0
  924. data/ext/gyp/test/mac/xcode-gcc/warn_about_missing_newline.c +8 -0
  925. data/ext/gyp/test/mac/xcode-support-actions/source.c +0 -0
  926. data/ext/gyp/test/mac/xcode-support-actions/test.gyp +26 -0
  927. data/ext/gyp/test/mac/xctest/MyClass.h +8 -0
  928. data/ext/gyp/test/mac/xctest/MyClass.m +8 -0
  929. data/ext/gyp/test/mac/xctest/TestCase.m +16 -0
  930. data/ext/gyp/test/mac/xctest/resource.txt +1 -0
  931. data/ext/gyp/test/mac/xctest/test.gyp +47 -0
  932. data/ext/gyp/test/mac/xctest/test.xcodeproj/xcshareddata/xcschemes/classes.xcscheme +69 -0
  933. data/ext/gyp/test/mac/xcuitest/Info.plist +28 -0
  934. data/ext/gyp/test/mac/xcuitest/MyAppDelegate.h +8 -0
  935. data/ext/gyp/test/mac/xcuitest/MyAppDelegate.m +19 -0
  936. data/ext/gyp/test/mac/xcuitest/TestCase.m +15 -0
  937. data/ext/gyp/test/mac/xcuitest/main.m +15 -0
  938. data/ext/gyp/test/mac/xcuitest/resource.txt +1 -0
  939. data/ext/gyp/test/mac/xcuitest/test.gyp +69 -0
  940. data/ext/gyp/test/make/dependencies.gyp +15 -0
  941. data/ext/gyp/test/make/gyptest-dependencies.py +26 -0
  942. data/ext/gyp/test/make/gyptest-noload.py +57 -0
  943. data/ext/gyp/test/make/main.cc +12 -0
  944. data/ext/gyp/test/make/main.h +0 -0
  945. data/ext/gyp/test/make/noload/all.gyp +18 -0
  946. data/ext/gyp/test/make/noload/lib/shared.c +3 -0
  947. data/ext/gyp/test/make/noload/lib/shared.gyp +16 -0
  948. data/ext/gyp/test/make/noload/lib/shared.h +1 -0
  949. data/ext/gyp/test/make/noload/main.c +9 -0
  950. data/ext/gyp/test/make_global_settings/ar/gyptest-make_global_settings_ar.py +126 -0
  951. data/ext/gyp/test/make_global_settings/ar/make_global_settings_ar.gyp +29 -0
  952. data/ext/gyp/test/make_global_settings/basics/gyptest-make_global_settings.py +51 -0
  953. data/ext/gyp/test/make_global_settings/basics/make_global_settings.gyp +17 -0
  954. data/ext/gyp/test/make_global_settings/env-wrapper/gyptest-wrapper.py +51 -0
  955. data/ext/gyp/test/make_global_settings/env-wrapper/wrapper.gyp +17 -0
  956. data/ext/gyp/test/make_global_settings/full-toolchain/bar.cc +1 -0
  957. data/ext/gyp/test/make_global_settings/full-toolchain/foo.c +1 -0
  958. data/ext/gyp/test/make_global_settings/full-toolchain/gyptest-make_global_settings.py +53 -0
  959. data/ext/gyp/test/make_global_settings/full-toolchain/make_global_settings.gyp +22 -0
  960. data/ext/gyp/test/make_global_settings/full-toolchain/my_nm.py +9 -0
  961. data/ext/gyp/test/make_global_settings/full-toolchain/my_readelf.py +9 -0
  962. data/ext/gyp/test/make_global_settings/ld/gyptest-make_global_settings_ld.py +130 -0
  963. data/ext/gyp/test/make_global_settings/ld/make_global_settings_ld.gyp +29 -0
  964. data/ext/gyp/test/make_global_settings/wrapper/gyptest-wrapper.py +52 -0
  965. data/ext/gyp/test/make_global_settings/wrapper/wrapper.gyp +21 -0
  966. data/ext/gyp/test/many-actions/file0 +0 -0
  967. data/ext/gyp/test/many-actions/file1 +0 -0
  968. data/ext/gyp/test/many-actions/file2 +0 -0
  969. data/ext/gyp/test/many-actions/file3 +0 -0
  970. data/ext/gyp/test/many-actions/file4 +0 -0
  971. data/ext/gyp/test/many-actions/gyptest-many-actions-unsorted.py +43 -0
  972. data/ext/gyp/test/many-actions/gyptest-many-actions.py +29 -0
  973. data/ext/gyp/test/many-actions/many-actions-unsorted.gyp +154 -0
  974. data/ext/gyp/test/many-actions/many-actions.gyp +1817 -0
  975. data/ext/gyp/test/module/gyptest-default.py +28 -0
  976. data/ext/gyp/test/module/src/lib1.c +10 -0
  977. data/ext/gyp/test/module/src/lib2.c +10 -0
  978. data/ext/gyp/test/module/src/module.gyp +53 -0
  979. data/ext/gyp/test/module/src/program.c +111 -0
  980. data/ext/gyp/test/msvs/buildevents/buildevents.gyp +14 -0
  981. data/ext/gyp/test/msvs/buildevents/gyptest-msbuild-supports-prepostbuild.py +24 -0
  982. data/ext/gyp/test/msvs/buildevents/gyptest-ninja-warnings.py +29 -0
  983. data/ext/gyp/test/msvs/buildevents/main.cc +5 -0
  984. data/ext/gyp/test/msvs/config_attrs/gyptest-config_attrs.py +41 -0
  985. data/ext/gyp/test/msvs/config_attrs/hello.c +11 -0
  986. data/ext/gyp/test/msvs/config_attrs/hello.gyp +21 -0
  987. data/ext/gyp/test/msvs/express/base/base.gyp +22 -0
  988. data/ext/gyp/test/msvs/express/express.gyp +19 -0
  989. data/ext/gyp/test/msvs/express/gyptest-express.py +29 -0
  990. data/ext/gyp/test/msvs/external_builder/external.gyp +68 -0
  991. data/ext/gyp/test/msvs/external_builder/external_builder.py +9 -0
  992. data/ext/gyp/test/msvs/external_builder/gyptest-all.py +59 -0
  993. data/ext/gyp/test/msvs/external_builder/hello.cpp +10 -0
  994. data/ext/gyp/test/msvs/external_builder/hello.z +6 -0
  995. data/ext/gyp/test/msvs/external_builder/msbuild_action.py +9 -0
  996. data/ext/gyp/test/msvs/external_builder/msbuild_rule.py +11 -0
  997. data/ext/gyp/test/msvs/filters/filters.gyp +47 -0
  998. data/ext/gyp/test/msvs/filters/gyptest-filters-2008.py +68 -0
  999. data/ext/gyp/test/msvs/filters/gyptest-filters-2010.py +57 -0
  1000. data/ext/gyp/test/msvs/list_excluded/gyptest-all.py +51 -0
  1001. data/ext/gyp/test/msvs/list_excluded/hello.cpp +10 -0
  1002. data/ext/gyp/test/msvs/list_excluded/hello_exclude.gyp +19 -0
  1003. data/ext/gyp/test/msvs/list_excluded/hello_mac.cpp +10 -0
  1004. data/ext/gyp/test/msvs/missing_sources/gyptest-missing.py +43 -0
  1005. data/ext/gyp/test/msvs/missing_sources/hello_missing.gyp +15 -0
  1006. data/ext/gyp/test/msvs/multiple_actions_error_handling/action_fail.py +7 -0
  1007. data/ext/gyp/test/msvs/multiple_actions_error_handling/action_succeed.py +7 -0
  1008. data/ext/gyp/test/msvs/multiple_actions_error_handling/actions.gyp +40 -0
  1009. data/ext/gyp/test/msvs/multiple_actions_error_handling/gyptest.py +26 -0
  1010. data/ext/gyp/test/msvs/props/AppName.props +14 -0
  1011. data/ext/gyp/test/msvs/props/AppName.vsprops +11 -0
  1012. data/ext/gyp/test/msvs/props/gyptest-props.py +22 -0
  1013. data/ext/gyp/test/msvs/props/hello.c +11 -0
  1014. data/ext/gyp/test/msvs/props/hello.gyp +22 -0
  1015. data/ext/gyp/test/msvs/rules_stdout_stderr/dummy.bar +5 -0
  1016. data/ext/gyp/test/msvs/rules_stdout_stderr/dummy.foo +5 -0
  1017. data/ext/gyp/test/msvs/rules_stdout_stderr/gyptest-rules-stdout-stderr.py +29 -0
  1018. data/ext/gyp/test/msvs/rules_stdout_stderr/rule_stderr.py +8 -0
  1019. data/ext/gyp/test/msvs/rules_stdout_stderr/rule_stdout.py +7 -0
  1020. data/ext/gyp/test/msvs/rules_stdout_stderr/rules-stdout-stderr.gyp +52 -0
  1021. data/ext/gyp/test/msvs/shared_output/common.gypi +17 -0
  1022. data/ext/gyp/test/msvs/shared_output/gyptest-shared_output.py +41 -0
  1023. data/ext/gyp/test/msvs/shared_output/hello.c +12 -0
  1024. data/ext/gyp/test/msvs/shared_output/hello.gyp +21 -0
  1025. data/ext/gyp/test/msvs/shared_output/there/there.c +12 -0
  1026. data/ext/gyp/test/msvs/shared_output/there/there.gyp +16 -0
  1027. data/ext/gyp/test/msvs/uldi2010/gyptest-all.py +20 -0
  1028. data/ext/gyp/test/msvs/uldi2010/hello.c +13 -0
  1029. data/ext/gyp/test/msvs/uldi2010/hello.gyp +26 -0
  1030. data/ext/gyp/test/msvs/uldi2010/hello2.c +10 -0
  1031. data/ext/gyp/test/multiple-targets/gyptest-all.py +30 -0
  1032. data/ext/gyp/test/multiple-targets/gyptest-default.py +30 -0
  1033. data/ext/gyp/test/multiple-targets/src/common.c +7 -0
  1034. data/ext/gyp/test/multiple-targets/src/multiple.gyp +24 -0
  1035. data/ext/gyp/test/multiple-targets/src/prog1.c +10 -0
  1036. data/ext/gyp/test/multiple-targets/src/prog2.c +10 -0
  1037. data/ext/gyp/test/ninja/action-rule-hash/gyptest-action-rule-hash.py +32 -0
  1038. data/ext/gyp/test/ninja/action-rule-hash/subdir/action-rule-hash.gyp +29 -0
  1039. data/ext/gyp/test/ninja/action-rule-hash/subdir/emit.py +13 -0
  1040. data/ext/gyp/test/ninja/action_dependencies/gyptest-action-dependencies.py +64 -0
  1041. data/ext/gyp/test/ninja/action_dependencies/src/a.c +10 -0
  1042. data/ext/gyp/test/ninja/action_dependencies/src/a.h +13 -0
  1043. data/ext/gyp/test/ninja/action_dependencies/src/action_dependencies.gyp +88 -0
  1044. data/ext/gyp/test/ninja/action_dependencies/src/b.c +18 -0
  1045. data/ext/gyp/test/ninja/action_dependencies/src/b.h +13 -0
  1046. data/ext/gyp/test/ninja/action_dependencies/src/c.c +10 -0
  1047. data/ext/gyp/test/ninja/action_dependencies/src/c.h +13 -0
  1048. data/ext/gyp/test/ninja/action_dependencies/src/emit.py +11 -0
  1049. data/ext/gyp/test/ninja/chained-dependency/chained-dependency.gyp +53 -0
  1050. data/ext/gyp/test/ninja/chained-dependency/chained.c +5 -0
  1051. data/ext/gyp/test/ninja/chained-dependency/gyptest-chained-dependency.py +30 -0
  1052. data/ext/gyp/test/ninja/empty-and-non-empty-duplicate-name/gyptest-empty-and-non-empty-duplicate-name.py +23 -0
  1053. data/ext/gyp/test/ninja/empty-and-non-empty-duplicate-name/subdir/included.gyp +19 -0
  1054. data/ext/gyp/test/ninja/empty-and-non-empty-duplicate-name/test.gyp +19 -0
  1055. data/ext/gyp/test/ninja/normalize-paths-win/gyptest-normalize-paths.py +46 -0
  1056. data/ext/gyp/test/ninja/normalize-paths-win/hello.cc +7 -0
  1057. data/ext/gyp/test/ninja/normalize-paths-win/normalize-paths.gyp +68 -0
  1058. data/ext/gyp/test/ninja/s-needs-no-depfiles/empty.s +1 -0
  1059. data/ext/gyp/test/ninja/s-needs-no-depfiles/gyptest-s-needs-no-depfiles.py +42 -0
  1060. data/ext/gyp/test/ninja/s-needs-no-depfiles/s-needs-no-depfiles.gyp +13 -0
  1061. data/ext/gyp/test/ninja/solibs_avoid_relinking/gyptest-solibs-avoid-relinking.py +48 -0
  1062. data/ext/gyp/test/ninja/solibs_avoid_relinking/main.cc +5 -0
  1063. data/ext/gyp/test/ninja/solibs_avoid_relinking/solib.cc +8 -0
  1064. data/ext/gyp/test/ninja/solibs_avoid_relinking/solibs_avoid_relinking.gyp +38 -0
  1065. data/ext/gyp/test/ninja/use-console/foo.bar +5 -0
  1066. data/ext/gyp/test/ninja/use-console/gyptest-use-console.py +29 -0
  1067. data/ext/gyp/test/ninja/use-console/use-console.gyp +60 -0
  1068. data/ext/gyp/test/ninja/use-custom-environment-files/gyptest-use-custom-environment-files.py +28 -0
  1069. data/ext/gyp/test/ninja/use-custom-environment-files/use-custom-environment-files.cc +7 -0
  1070. data/ext/gyp/test/ninja/use-custom-environment-files/use-custom-environment-files.gyp +15 -0
  1071. data/ext/gyp/test/no-cpp/gyptest-no-cpp.py +53 -0
  1072. data/ext/gyp/test/no-cpp/src/call-f-main.c +2 -0
  1073. data/ext/gyp/test/no-cpp/src/empty-main.c +1 -0
  1074. data/ext/gyp/test/no-cpp/src/f.cc +3 -0
  1075. data/ext/gyp/test/no-cpp/src/test.gyp +25 -0
  1076. data/ext/gyp/test/no-output/gyptest-no-output.py +21 -0
  1077. data/ext/gyp/test/no-output/src/nooutput.gyp +17 -0
  1078. data/ext/gyp/test/product/gyptest-product.py +43 -0
  1079. data/ext/gyp/test/product/hello.c +15 -0
  1080. data/ext/gyp/test/product/product.gyp +128 -0
  1081. data/ext/gyp/test/prune_targets/gyptest-prune-targets.py +66 -0
  1082. data/ext/gyp/test/prune_targets/lib1.cc +6 -0
  1083. data/ext/gyp/test/prune_targets/lib2.cc +6 -0
  1084. data/ext/gyp/test/prune_targets/lib3.cc +6 -0
  1085. data/ext/gyp/test/prune_targets/lib_indirect.cc +6 -0
  1086. data/ext/gyp/test/prune_targets/program.cc +7 -0
  1087. data/ext/gyp/test/prune_targets/test1.gyp +26 -0
  1088. data/ext/gyp/test/prune_targets/test2.gyp +30 -0
  1089. data/ext/gyp/test/relative/foo/a/a.cc +9 -0
  1090. data/ext/gyp/test/relative/foo/a/a.gyp +13 -0
  1091. data/ext/gyp/test/relative/foo/a/c/c.cc +9 -0
  1092. data/ext/gyp/test/relative/foo/a/c/c.gyp +12 -0
  1093. data/ext/gyp/test/relative/foo/b/b.cc +9 -0
  1094. data/ext/gyp/test/relative/foo/b/b.gyp +9 -0
  1095. data/ext/gyp/test/relative/gyptest-default.py +25 -0
  1096. data/ext/gyp/test/rename/filecase/file.c +1 -0
  1097. data/ext/gyp/test/rename/filecase/test-casesensitive.gyp +15 -0
  1098. data/ext/gyp/test/rename/filecase/test.gyp +14 -0
  1099. data/ext/gyp/test/rename/gyptest-filecase.py +35 -0
  1100. data/ext/gyp/test/restat/gyptest-restat.py +31 -0
  1101. data/ext/gyp/test/restat/src/create_intermediate.py +17 -0
  1102. data/ext/gyp/test/restat/src/restat.gyp +50 -0
  1103. data/ext/gyp/test/restat/src/touch.py +16 -0
  1104. data/ext/gyp/test/rules/gyptest-all.py +84 -0
  1105. data/ext/gyp/test/rules/gyptest-default.py +70 -0
  1106. data/ext/gyp/test/rules/gyptest-input-root.py +26 -0
  1107. data/ext/gyp/test/rules/gyptest-special-variables.py +18 -0
  1108. data/ext/gyp/test/rules/src/actions.gyp +23 -0
  1109. data/ext/gyp/test/rules/src/an_asm.S +6 -0
  1110. data/ext/gyp/test/rules/src/as.bat +7 -0
  1111. data/ext/gyp/test/rules/src/copy-file.py +11 -0
  1112. data/ext/gyp/test/rules/src/external/external.gyp +66 -0
  1113. data/ext/gyp/test/rules/src/external/file1.in +1 -0
  1114. data/ext/gyp/test/rules/src/external/file2.in +1 -0
  1115. data/ext/gyp/test/rules/src/input-root.gyp +24 -0
  1116. data/ext/gyp/test/rules/src/noaction/file1.in +1 -0
  1117. data/ext/gyp/test/rules/src/noaction/no_action_with_rules_fails.gyp +37 -0
  1118. data/ext/gyp/test/rules/src/rule.py +17 -0
  1119. data/ext/gyp/test/rules/src/somefile.ext +0 -0
  1120. data/ext/gyp/test/rules/src/special-variables.gyp +34 -0
  1121. data/ext/gyp/test/rules/src/subdir1/executable.gyp +37 -0
  1122. data/ext/gyp/test/rules/src/subdir1/function1.in +6 -0
  1123. data/ext/gyp/test/rules/src/subdir1/function2.in +6 -0
  1124. data/ext/gyp/test/rules/src/subdir1/program.c +12 -0
  1125. data/ext/gyp/test/rules/src/subdir2/both_rule_and_action_input.gyp +50 -0
  1126. data/ext/gyp/test/rules/src/subdir2/file1.in +1 -0
  1127. data/ext/gyp/test/rules/src/subdir2/file2.in +1 -0
  1128. data/ext/gyp/test/rules/src/subdir2/never_used.gyp +31 -0
  1129. data/ext/gyp/test/rules/src/subdir2/no_action.gyp +38 -0
  1130. data/ext/gyp/test/rules/src/subdir2/no_inputs.gyp +32 -0
  1131. data/ext/gyp/test/rules/src/subdir2/none.gyp +33 -0
  1132. data/ext/gyp/test/rules/src/subdir2/program.c +12 -0
  1133. data/ext/gyp/test/rules/src/subdir3/executable2.gyp +37 -0
  1134. data/ext/gyp/test/rules/src/subdir3/function3.in +6 -0
  1135. data/ext/gyp/test/rules/src/subdir3/program.c +10 -0
  1136. data/ext/gyp/test/rules/src/subdir4/asm-function.assem +10 -0
  1137. data/ext/gyp/test/rules/src/subdir4/build-asm.gyp +49 -0
  1138. data/ext/gyp/test/rules/src/subdir4/program.c +19 -0
  1139. data/ext/gyp/test/rules-dirname/gyptest-dirname.py +57 -0
  1140. data/ext/gyp/test/rules-dirname/src/actions.gyp +15 -0
  1141. data/ext/gyp/test/rules-dirname/src/copy-file.py +11 -0
  1142. data/ext/gyp/test/rules-dirname/src/subdir/a/b/c.gencc +8 -0
  1143. data/ext/gyp/test/rules-dirname/src/subdir/a/b/c.printvars +1 -0
  1144. data/ext/gyp/test/rules-dirname/src/subdir/foo/bar/baz.gencc +8 -0
  1145. data/ext/gyp/test/rules-dirname/src/subdir/foo/bar/baz.printvars +1 -0
  1146. data/ext/gyp/test/rules-dirname/src/subdir/input-rule-dirname.gyp +140 -0
  1147. data/ext/gyp/test/rules-dirname/src/subdir/main.cc +14 -0
  1148. data/ext/gyp/test/rules-dirname/src/subdir/nodir.gencc +8 -0
  1149. data/ext/gyp/test/rules-dirname/src/subdir/printvars.py +14 -0
  1150. data/ext/gyp/test/rules-rebuild/gyptest-all.py +70 -0
  1151. data/ext/gyp/test/rules-rebuild/gyptest-default.py +91 -0
  1152. data/ext/gyp/test/rules-rebuild/src/main.c +12 -0
  1153. data/ext/gyp/test/rules-rebuild/src/make-sources.py +19 -0
  1154. data/ext/gyp/test/rules-rebuild/src/prog1.in +7 -0
  1155. data/ext/gyp/test/rules-rebuild/src/prog2.in +7 -0
  1156. data/ext/gyp/test/rules-rebuild/src/same_target.gyp +31 -0
  1157. data/ext/gyp/test/rules-use-built-dependencies/gyptest-use-built-dependencies.py +23 -0
  1158. data/ext/gyp/test/rules-use-built-dependencies/src/main.cc +17 -0
  1159. data/ext/gyp/test/rules-use-built-dependencies/src/use-built-dependencies-rule.gyp +42 -0
  1160. data/ext/gyp/test/rules-variables/gyptest-rules-variables.py +35 -0
  1161. data/ext/gyp/test/rules-variables/src/input_ext.c +9 -0
  1162. data/ext/gyp/test/rules-variables/src/input_name/test.c +9 -0
  1163. data/ext/gyp/test/rules-variables/src/input_path/subdir/test.c +9 -0
  1164. data/ext/gyp/test/rules-variables/src/subdir/input_dirname.c +9 -0
  1165. data/ext/gyp/test/rules-variables/src/subdir/test.c +18 -0
  1166. data/ext/gyp/test/rules-variables/src/test.input_root.c +9 -0
  1167. data/ext/gyp/test/rules-variables/src/variables.gyp +40 -0
  1168. data/ext/gyp/test/same-gyp-name/gyptest-all.py +38 -0
  1169. data/ext/gyp/test/same-gyp-name/gyptest-default.py +38 -0
  1170. data/ext/gyp/test/same-gyp-name/gyptest-library.py +20 -0
  1171. data/ext/gyp/test/same-gyp-name/library/one/sub.gyp +11 -0
  1172. data/ext/gyp/test/same-gyp-name/library/test.gyp +15 -0
  1173. data/ext/gyp/test/same-gyp-name/library/two/sub.gyp +11 -0
  1174. data/ext/gyp/test/same-gyp-name/src/all.gyp +16 -0
  1175. data/ext/gyp/test/same-gyp-name/src/subdir1/executable.gyp +15 -0
  1176. data/ext/gyp/test/same-gyp-name/src/subdir1/main1.cc +6 -0
  1177. data/ext/gyp/test/same-gyp-name/src/subdir2/executable.gyp +15 -0
  1178. data/ext/gyp/test/same-gyp-name/src/subdir2/main2.cc +6 -0
  1179. data/ext/gyp/test/same-rule-output-file-name/gyptest-all.py +23 -0
  1180. data/ext/gyp/test/same-rule-output-file-name/src/subdir1/subdir1.gyp +30 -0
  1181. data/ext/gyp/test/same-rule-output-file-name/src/subdir2/subdir2.gyp +30 -0
  1182. data/ext/gyp/test/same-rule-output-file-name/src/subdirs.gyp +16 -0
  1183. data/ext/gyp/test/same-rule-output-file-name/src/touch.py +11 -0
  1184. data/ext/gyp/test/same-source-file-name/gyptest-all.py +34 -0
  1185. data/ext/gyp/test/same-source-file-name/gyptest-default.py +34 -0
  1186. data/ext/gyp/test/same-source-file-name/gyptest-pass-executable.py +33 -0
  1187. data/ext/gyp/test/same-source-file-name/gyptest-pass-shared.py +18 -0
  1188. data/ext/gyp/test/same-source-file-name/gyptest-static.py +34 -0
  1189. data/ext/gyp/test/same-source-file-name/src/all.gyp +30 -0
  1190. data/ext/gyp/test/same-source-file-name/src/double-executable.gyp +21 -0
  1191. data/ext/gyp/test/same-source-file-name/src/double-shared.gyp +27 -0
  1192. data/ext/gyp/test/same-source-file-name/src/double-static.gyp +22 -0
  1193. data/ext/gyp/test/same-source-file-name/src/func.c +6 -0
  1194. data/ext/gyp/test/same-source-file-name/src/prog1.c +16 -0
  1195. data/ext/gyp/test/same-source-file-name/src/prog2.c +16 -0
  1196. data/ext/gyp/test/same-source-file-name/src/prog3.c +18 -0
  1197. data/ext/gyp/test/same-source-file-name/src/subdir1/func.c +6 -0
  1198. data/ext/gyp/test/same-source-file-name/src/subdir2/func.c +6 -0
  1199. data/ext/gyp/test/same-target-name/gyptest-same-target-name.py +18 -0
  1200. data/ext/gyp/test/same-target-name/src/all.gyp +16 -0
  1201. data/ext/gyp/test/same-target-name/src/executable1.gyp +15 -0
  1202. data/ext/gyp/test/same-target-name/src/executable2.gyp +15 -0
  1203. data/ext/gyp/test/same-target-name-different-directory/gyptest-all.py +41 -0
  1204. data/ext/gyp/test/same-target-name-different-directory/src/subdir1/subdir1.gyp +66 -0
  1205. data/ext/gyp/test/same-target-name-different-directory/src/subdir2/subdir2.gyp +66 -0
  1206. data/ext/gyp/test/same-target-name-different-directory/src/subdirs.gyp +16 -0
  1207. data/ext/gyp/test/same-target-name-different-directory/src/touch.py +11 -0
  1208. data/ext/gyp/test/sanitize-rule-names/blah.S +0 -0
  1209. data/ext/gyp/test/sanitize-rule-names/gyptest-sanitize-rule-names.py +17 -0
  1210. data/ext/gyp/test/sanitize-rule-names/hello.cc +7 -0
  1211. data/ext/gyp/test/sanitize-rule-names/sanitize-rule-names.gyp +27 -0
  1212. data/ext/gyp/test/sanitize-rule-names/script.py +10 -0
  1213. data/ext/gyp/test/self-dependency/common.gypi +13 -0
  1214. data/ext/gyp/test/self-dependency/dep.gyp +23 -0
  1215. data/ext/gyp/test/self-dependency/gyptest-self-dependency.py +19 -0
  1216. data/ext/gyp/test/self-dependency/self_dependency.gyp +15 -0
  1217. data/ext/gyp/test/sibling/gyptest-all.py +42 -0
  1218. data/ext/gyp/test/sibling/gyptest-relocate.py +44 -0
  1219. data/ext/gyp/test/sibling/src/build/all.gyp +16 -0
  1220. data/ext/gyp/test/sibling/src/prog1/prog1.c +7 -0
  1221. data/ext/gyp/test/sibling/src/prog1/prog1.gyp +15 -0
  1222. data/ext/gyp/test/sibling/src/prog2/prog2.c +7 -0
  1223. data/ext/gyp/test/sibling/src/prog2/prog2.gyp +15 -0
  1224. data/ext/gyp/test/small/gyptest-small.py +56 -0
  1225. data/ext/gyp/test/standalone/gyptest-standalone.py +35 -0
  1226. data/ext/gyp/test/standalone/standalone.gyp +12 -0
  1227. data/ext/gyp/test/standalone-static-library/gyptest-standalone-static-library.py +50 -0
  1228. data/ext/gyp/test/standalone-static-library/invalid.gyp +16 -0
  1229. data/ext/gyp/test/standalone-static-library/mylib.c +7 -0
  1230. data/ext/gyp/test/standalone-static-library/mylib.gyp +26 -0
  1231. data/ext/gyp/test/standalone-static-library/prog.c +7 -0
  1232. data/ext/gyp/test/subdirectory/gyptest-SYMROOT-all.py +36 -0
  1233. data/ext/gyp/test/subdirectory/gyptest-SYMROOT-default.py +37 -0
  1234. data/ext/gyp/test/subdirectory/gyptest-subdir-all.py +34 -0
  1235. data/ext/gyp/test/subdirectory/gyptest-subdir-default.py +34 -0
  1236. data/ext/gyp/test/subdirectory/gyptest-subdir2-deep.py +25 -0
  1237. data/ext/gyp/test/subdirectory/gyptest-top-all.py +43 -0
  1238. data/ext/gyp/test/subdirectory/gyptest-top-default.py +43 -0
  1239. data/ext/gyp/test/subdirectory/src/prog1.c +7 -0
  1240. data/ext/gyp/test/subdirectory/src/prog1.gyp +21 -0
  1241. data/ext/gyp/test/subdirectory/src/subdir/prog2.c +7 -0
  1242. data/ext/gyp/test/subdirectory/src/subdir/prog2.gyp +18 -0
  1243. data/ext/gyp/test/subdirectory/src/subdir/subdir2/prog3.c +7 -0
  1244. data/ext/gyp/test/subdirectory/src/subdir/subdir2/prog3.gyp +18 -0
  1245. data/ext/gyp/test/subdirectory/src/symroot.gypi +16 -0
  1246. data/ext/gyp/test/symlinks/gyptest-symlinks.py +66 -0
  1247. data/ext/gyp/test/symlinks/hello.c +12 -0
  1248. data/ext/gyp/test/symlinks/hello.gyp +15 -0
  1249. data/ext/gyp/test/target/gyptest-target.py +37 -0
  1250. data/ext/gyp/test/target/hello.c +7 -0
  1251. data/ext/gyp/test/target/target.gyp +24 -0
  1252. data/ext/gyp/test/toolsets/gyptest-toolsets.py +31 -0
  1253. data/ext/gyp/test/toolsets/main.cc +13 -0
  1254. data/ext/gyp/test/toolsets/toolsets.cc +11 -0
  1255. data/ext/gyp/test/toolsets/toolsets.gyp +62 -0
  1256. data/ext/gyp/test/toolsets/toolsets_shared.cc +11 -0
  1257. data/ext/gyp/test/toplevel-dir/gyptest-toplevel-dir.py +31 -0
  1258. data/ext/gyp/test/toplevel-dir/src/sub1/main.gyp +18 -0
  1259. data/ext/gyp/test/toplevel-dir/src/sub1/prog1.c +7 -0
  1260. data/ext/gyp/test/toplevel-dir/src/sub2/prog2.c +7 -0
  1261. data/ext/gyp/test/toplevel-dir/src/sub2/prog2.gyp +15 -0
  1262. data/ext/gyp/test/variables/commands/commands-repeated.gyp +128 -0
  1263. data/ext/gyp/test/variables/commands/commands-repeated.gyp.stdout +136 -0
  1264. data/ext/gyp/test/variables/commands/commands-repeated.gypd.golden +77 -0
  1265. data/ext/gyp/test/variables/commands/commands.gyp +91 -0
  1266. data/ext/gyp/test/variables/commands/commands.gyp.ignore-env.stdout +96 -0
  1267. data/ext/gyp/test/variables/commands/commands.gyp.stdout +96 -0
  1268. data/ext/gyp/test/variables/commands/commands.gypd.golden +66 -0
  1269. data/ext/gyp/test/variables/commands/commands.gypi +23 -0
  1270. data/ext/gyp/test/variables/commands/gyptest-commands-ignore-env.py +47 -0
  1271. data/ext/gyp/test/variables/commands/gyptest-commands-repeated-multidir.py +23 -0
  1272. data/ext/gyp/test/variables/commands/gyptest-commands-repeated.py +40 -0
  1273. data/ext/gyp/test/variables/commands/gyptest-commands.py +40 -0
  1274. data/ext/gyp/test/variables/commands/repeated_multidir/dir_1/test_1.gyp +13 -0
  1275. data/ext/gyp/test/variables/commands/repeated_multidir/dir_2/test_2.gyp +13 -0
  1276. data/ext/gyp/test/variables/commands/repeated_multidir/main.gyp +16 -0
  1277. data/ext/gyp/test/variables/commands/repeated_multidir/print_cwd_basename.py +11 -0
  1278. data/ext/gyp/test/variables/commands/repeated_multidir/repeated_command_common.gypi +25 -0
  1279. data/ext/gyp/test/variables/commands/test.py +7 -0
  1280. data/ext/gyp/test/variables/commands/update_golden +11 -0
  1281. data/ext/gyp/test/variables/empty/empty.gyp +13 -0
  1282. data/ext/gyp/test/variables/empty/empty.gypi +9 -0
  1283. data/ext/gyp/test/variables/empty/gyptest-empty.py +19 -0
  1284. data/ext/gyp/test/variables/filelist/filelist.gyp.stdout +26 -0
  1285. data/ext/gyp/test/variables/filelist/filelist.gypd.golden +43 -0
  1286. data/ext/gyp/test/variables/filelist/gyptest-filelist-golden.py +53 -0
  1287. data/ext/gyp/test/variables/filelist/gyptest-filelist.py +29 -0
  1288. data/ext/gyp/test/variables/filelist/src/dummy.py +5 -0
  1289. data/ext/gyp/test/variables/filelist/src/filelist.gyp +93 -0
  1290. data/ext/gyp/test/variables/filelist/src/filelist2.gyp +40 -0
  1291. data/ext/gyp/test/variables/filelist/update_golden +8 -0
  1292. data/ext/gyp/test/variables/latelate/gyptest-latelate.py +25 -0
  1293. data/ext/gyp/test/variables/latelate/src/latelate.gyp +34 -0
  1294. data/ext/gyp/test/variables/latelate/src/program.cc +13 -0
  1295. data/ext/gyp/test/variables/variable-in-path/C1/hello.cc +7 -0
  1296. data/ext/gyp/test/variables/variable-in-path/gyptest-variable-in-path.py +23 -0
  1297. data/ext/gyp/test/variables/variable-in-path/variable-in-path.gyp +31 -0
  1298. data/ext/gyp/test/win/asm-files/asm-files.gyp +17 -0
  1299. data/ext/gyp/test/win/asm-files/b.s +0 -0
  1300. data/ext/gyp/test/win/asm-files/c.S +0 -0
  1301. data/ext/gyp/test/win/asm-files/hello.cc +7 -0
  1302. data/ext/gyp/test/win/batch-file-action/batch-file-action.gyp +21 -0
  1303. data/ext/gyp/test/win/batch-file-action/infile +1 -0
  1304. data/ext/gyp/test/win/batch-file-action/somecmd.bat +5 -0
  1305. data/ext/gyp/test/win/command-quote/a.S +0 -0
  1306. data/ext/gyp/test/win/command-quote/bat with spaces.bat +7 -0
  1307. data/ext/gyp/test/win/command-quote/command-quote.gyp +79 -0
  1308. data/ext/gyp/test/win/command-quote/go.bat +7 -0
  1309. data/ext/gyp/test/win/command-quote/subdir/and/another/in-subdir.gyp +27 -0
  1310. data/ext/gyp/test/win/compiler-flags/additional-include-dirs.cc +10 -0
  1311. data/ext/gyp/test/win/compiler-flags/additional-include-dirs.gyp +20 -0
  1312. data/ext/gyp/test/win/compiler-flags/additional-options.cc +10 -0
  1313. data/ext/gyp/test/win/compiler-flags/additional-options.gyp +31 -0
  1314. data/ext/gyp/test/win/compiler-flags/analysis.gyp +40 -0
  1315. data/ext/gyp/test/win/compiler-flags/buffer-security-check.gyp +51 -0
  1316. data/ext/gyp/test/win/compiler-flags/buffer-security.cc +12 -0
  1317. data/ext/gyp/test/win/compiler-flags/calling-convention-cdecl.def +6 -0
  1318. data/ext/gyp/test/win/compiler-flags/calling-convention-fastcall.def +6 -0
  1319. data/ext/gyp/test/win/compiler-flags/calling-convention-stdcall.def +6 -0
  1320. data/ext/gyp/test/win/compiler-flags/calling-convention-vectorcall.def +6 -0
  1321. data/ext/gyp/test/win/compiler-flags/calling-convention.cc +6 -0
  1322. data/ext/gyp/test/win/compiler-flags/calling-convention.gyp +66 -0
  1323. data/ext/gyp/test/win/compiler-flags/character-set-mbcs.cc +11 -0
  1324. data/ext/gyp/test/win/compiler-flags/character-set-unicode.cc +15 -0
  1325. data/ext/gyp/test/win/compiler-flags/character-set.gyp +35 -0
  1326. data/ext/gyp/test/win/compiler-flags/compile-as-managed.cc +9 -0
  1327. data/ext/gyp/test/win/compiler-flags/compile-as-managed.gyp +29 -0
  1328. data/ext/gyp/test/win/compiler-flags/compile-as-winrt.cc +12 -0
  1329. data/ext/gyp/test/win/compiler-flags/compile-as-winrt.gyp +20 -0
  1330. data/ext/gyp/test/win/compiler-flags/debug-format.gyp +48 -0
  1331. data/ext/gyp/test/win/compiler-flags/default-char-is-unsigned.cc +15 -0
  1332. data/ext/gyp/test/win/compiler-flags/default-char-is-unsigned.gyp +20 -0
  1333. data/ext/gyp/test/win/compiler-flags/disable-specific-warnings.cc +9 -0
  1334. data/ext/gyp/test/win/compiler-flags/disable-specific-warnings.gyp +29 -0
  1335. data/ext/gyp/test/win/compiler-flags/enable-enhanced-instruction-set.cc +28 -0
  1336. data/ext/gyp/test/win/compiler-flags/enable-enhanced-instruction-set.gyp +68 -0
  1337. data/ext/gyp/test/win/compiler-flags/exception-handling-on.cc +24 -0
  1338. data/ext/gyp/test/win/compiler-flags/exception-handling.gyp +46 -0
  1339. data/ext/gyp/test/win/compiler-flags/floating-point-model-fast.cc +19 -0
  1340. data/ext/gyp/test/win/compiler-flags/floating-point-model-precise.cc +19 -0
  1341. data/ext/gyp/test/win/compiler-flags/floating-point-model-strict.cc +19 -0
  1342. data/ext/gyp/test/win/compiler-flags/floating-point-model.gyp +43 -0
  1343. data/ext/gyp/test/win/compiler-flags/force-include-files-with-precompiled.cc +10 -0
  1344. data/ext/gyp/test/win/compiler-flags/force-include-files.cc +8 -0
  1345. data/ext/gyp/test/win/compiler-flags/force-include-files.gyp +36 -0
  1346. data/ext/gyp/test/win/compiler-flags/function-level-linking.cc +11 -0
  1347. data/ext/gyp/test/win/compiler-flags/function-level-linking.gyp +28 -0
  1348. data/ext/gyp/test/win/compiler-flags/hello.cc +7 -0
  1349. data/ext/gyp/test/win/compiler-flags/optimizations.gyp +207 -0
  1350. data/ext/gyp/test/win/compiler-flags/pdbname-override.gyp +26 -0
  1351. data/ext/gyp/test/win/compiler-flags/pdbname.cc +7 -0
  1352. data/ext/gyp/test/win/compiler-flags/pdbname.gyp +24 -0
  1353. data/ext/gyp/test/win/compiler-flags/precomp.cc +6 -0
  1354. data/ext/gyp/test/win/compiler-flags/rtti-on.cc +11 -0
  1355. data/ext/gyp/test/win/compiler-flags/rtti.gyp +37 -0
  1356. data/ext/gyp/test/win/compiler-flags/runtime-checks.cc +11 -0
  1357. data/ext/gyp/test/win/compiler-flags/runtime-checks.gyp +29 -0
  1358. data/ext/gyp/test/win/compiler-flags/runtime-library-md.cc +19 -0
  1359. data/ext/gyp/test/win/compiler-flags/runtime-library-mdd.cc +19 -0
  1360. data/ext/gyp/test/win/compiler-flags/runtime-library-mt.cc +19 -0
  1361. data/ext/gyp/test/win/compiler-flags/runtime-library-mtd.cc +19 -0
  1362. data/ext/gyp/test/win/compiler-flags/runtime-library.gyp +48 -0
  1363. data/ext/gyp/test/win/compiler-flags/subdir/header.h +0 -0
  1364. data/ext/gyp/test/win/compiler-flags/treat-wchar-t-as-built-in-type.gyp +33 -0
  1365. data/ext/gyp/test/win/compiler-flags/treat-wchar-t-as-built-in-type1.cc +11 -0
  1366. data/ext/gyp/test/win/compiler-flags/treat-wchar-t-as-built-in-type2.cc +11 -0
  1367. data/ext/gyp/test/win/compiler-flags/uninit.cc +13 -0
  1368. data/ext/gyp/test/win/compiler-flags/warning-as-error.cc +9 -0
  1369. data/ext/gyp/test/win/compiler-flags/warning-as-error.gyp +37 -0
  1370. data/ext/gyp/test/win/compiler-flags/warning-level.gyp +115 -0
  1371. data/ext/gyp/test/win/compiler-flags/warning-level1.cc +8 -0
  1372. data/ext/gyp/test/win/compiler-flags/warning-level2.cc +14 -0
  1373. data/ext/gyp/test/win/compiler-flags/warning-level3.cc +11 -0
  1374. data/ext/gyp/test/win/compiler-flags/warning-level4.cc +10 -0
  1375. data/ext/gyp/test/win/enable-winrt/dllmain.cc +30 -0
  1376. data/ext/gyp/test/win/enable-winrt/enable-winrt.gyp +39 -0
  1377. data/ext/gyp/test/win/generator-output-different-drive/gyptest-generator-output-different-drive.py +44 -0
  1378. data/ext/gyp/test/win/generator-output-different-drive/prog.c +10 -0
  1379. data/ext/gyp/test/win/generator-output-different-drive/prog.gyp +15 -0
  1380. data/ext/gyp/test/win/gyptest-asm-files.py +26 -0
  1381. data/ext/gyp/test/win/gyptest-cl-additional-include-dirs.py +22 -0
  1382. data/ext/gyp/test/win/gyptest-cl-additional-options.py +28 -0
  1383. data/ext/gyp/test/win/gyptest-cl-analysis.py +30 -0
  1384. data/ext/gyp/test/win/gyptest-cl-buffer-security-check.py +53 -0
  1385. data/ext/gyp/test/win/gyptest-cl-calling-convention.py +22 -0
  1386. data/ext/gyp/test/win/gyptest-cl-character-set.py +22 -0
  1387. data/ext/gyp/test/win/gyptest-cl-compile-as-managed.py +24 -0
  1388. data/ext/gyp/test/win/gyptest-cl-compile-as-winrt.py +20 -0
  1389. data/ext/gyp/test/win/gyptest-cl-debug-format.py +43 -0
  1390. data/ext/gyp/test/win/gyptest-cl-default-char-is-unsigned.py +22 -0
  1391. data/ext/gyp/test/win/gyptest-cl-disable-specific-warnings.py +32 -0
  1392. data/ext/gyp/test/win/gyptest-cl-enable-enhanced-instruction-set.py +49 -0
  1393. data/ext/gyp/test/win/gyptest-cl-exception-handling.py +33 -0
  1394. data/ext/gyp/test/win/gyptest-cl-floating-point-model.py +22 -0
  1395. data/ext/gyp/test/win/gyptest-cl-force-include-files.py +22 -0
  1396. data/ext/gyp/test/win/gyptest-cl-function-level-linking.py +54 -0
  1397. data/ext/gyp/test/win/gyptest-cl-optimizations.py +105 -0
  1398. data/ext/gyp/test/win/gyptest-cl-pdbname-override.py +27 -0
  1399. data/ext/gyp/test/win/gyptest-cl-pdbname.py +30 -0
  1400. data/ext/gyp/test/win/gyptest-cl-rtti.py +30 -0
  1401. data/ext/gyp/test/win/gyptest-cl-runtime-checks.py +30 -0
  1402. data/ext/gyp/test/win/gyptest-cl-runtime-library.py +22 -0
  1403. data/ext/gyp/test/win/gyptest-cl-treat-wchar-t-as-built-in-type.py +22 -0
  1404. data/ext/gyp/test/win/gyptest-cl-warning-as-error.py +30 -0
  1405. data/ext/gyp/test/win/gyptest-cl-warning-level.py +41 -0
  1406. data/ext/gyp/test/win/gyptest-command-quote.py +42 -0
  1407. data/ext/gyp/test/win/gyptest-crosscompile-ar.py +29 -0
  1408. data/ext/gyp/test/win/gyptest-lib-ltcg.py +22 -0
  1409. data/ext/gyp/test/win/gyptest-link-additional-deps.py +22 -0
  1410. data/ext/gyp/test/win/gyptest-link-additional-options.py +22 -0
  1411. data/ext/gyp/test/win/gyptest-link-aslr.py +35 -0
  1412. data/ext/gyp/test/win/gyptest-link-base-address.py +62 -0
  1413. data/ext/gyp/test/win/gyptest-link-debug-info.py +26 -0
  1414. data/ext/gyp/test/win/gyptest-link-default-libs.py +22 -0
  1415. data/ext/gyp/test/win/gyptest-link-deffile.py +43 -0
  1416. data/ext/gyp/test/win/gyptest-link-defrelink.py +56 -0
  1417. data/ext/gyp/test/win/gyptest-link-delay-load-dlls.py +35 -0
  1418. data/ext/gyp/test/win/gyptest-link-embed-manifest.py +100 -0
  1419. data/ext/gyp/test/win/gyptest-link-enable-uac.py +104 -0
  1420. data/ext/gyp/test/win/gyptest-link-enable-winrt-app-revision.py +43 -0
  1421. data/ext/gyp/test/win/gyptest-link-enable-winrt-target-platform-version.py +47 -0
  1422. data/ext/gyp/test/win/gyptest-link-enable-winrt.py +37 -0
  1423. data/ext/gyp/test/win/gyptest-link-entrypointsymbol.py +24 -0
  1424. data/ext/gyp/test/win/gyptest-link-fixed-base.py +40 -0
  1425. data/ext/gyp/test/win/gyptest-link-force-symbol-reference.py +26 -0
  1426. data/ext/gyp/test/win/gyptest-link-generate-manifest.py +127 -0
  1427. data/ext/gyp/test/win/gyptest-link-incremental.py +37 -0
  1428. data/ext/gyp/test/win/gyptest-link-large-address-aware.py +35 -0
  1429. data/ext/gyp/test/win/gyptest-link-large-pdb.py +76 -0
  1430. data/ext/gyp/test/win/gyptest-link-library-adjust.py +21 -0
  1431. data/ext/gyp/test/win/gyptest-link-library-directories.py +35 -0
  1432. data/ext/gyp/test/win/gyptest-link-ltcg.py +44 -0
  1433. data/ext/gyp/test/win/gyptest-link-mapfile.py +44 -0
  1434. data/ext/gyp/test/win/gyptest-link-nodefaultlib.py +24 -0
  1435. data/ext/gyp/test/win/gyptest-link-noimportlib.py +30 -0
  1436. data/ext/gyp/test/win/gyptest-link-nxcompat.py +37 -0
  1437. data/ext/gyp/test/win/gyptest-link-opt-icf.py +41 -0
  1438. data/ext/gyp/test/win/gyptest-link-opt-ref.py +40 -0
  1439. data/ext/gyp/test/win/gyptest-link-ordering.py +103 -0
  1440. data/ext/gyp/test/win/gyptest-link-outputfile.py +28 -0
  1441. data/ext/gyp/test/win/gyptest-link-pdb-no-output.py +25 -0
  1442. data/ext/gyp/test/win/gyptest-link-pdb-output.py +33 -0
  1443. data/ext/gyp/test/win/gyptest-link-pdb.py +35 -0
  1444. data/ext/gyp/test/win/gyptest-link-pgo.py +75 -0
  1445. data/ext/gyp/test/win/gyptest-link-profile.py +37 -0
  1446. data/ext/gyp/test/win/gyptest-link-restat-importlib.py +47 -0
  1447. data/ext/gyp/test/win/gyptest-link-safeseh.py +46 -0
  1448. data/ext/gyp/test/win/gyptest-link-shard.py +30 -0
  1449. data/ext/gyp/test/win/gyptest-link-stacksize.py +62 -0
  1450. data/ext/gyp/test/win/gyptest-link-subsystem.py +38 -0
  1451. data/ext/gyp/test/win/gyptest-link-target-machine.py +28 -0
  1452. data/ext/gyp/test/win/gyptest-link-tsaware.py +33 -0
  1453. data/ext/gyp/test/win/gyptest-link-uldi-depending-on-module.py +24 -0
  1454. data/ext/gyp/test/win/gyptest-link-uldi.py +28 -0
  1455. data/ext/gyp/test/win/gyptest-link-unsupported-manifest.py +27 -0
  1456. data/ext/gyp/test/win/gyptest-link-update-manifest.py +104 -0
  1457. data/ext/gyp/test/win/gyptest-link-warnings-as-errors.py +24 -0
  1458. data/ext/gyp/test/win/gyptest-long-command-line.py +23 -0
  1459. data/ext/gyp/test/win/gyptest-macro-projectname.py +24 -0
  1460. data/ext/gyp/test/win/gyptest-macro-targetext.py +26 -0
  1461. data/ext/gyp/test/win/gyptest-macro-targetfilename.py +37 -0
  1462. data/ext/gyp/test/win/gyptest-macro-targetname.py +29 -0
  1463. data/ext/gyp/test/win/gyptest-macro-targetpath.py +30 -0
  1464. data/ext/gyp/test/win/gyptest-macro-vcinstalldir.py +24 -0
  1465. data/ext/gyp/test/win/gyptest-macros-containing-gyp.py +21 -0
  1466. data/ext/gyp/test/win/gyptest-macros-in-inputs-and-outputs.py +27 -0
  1467. data/ext/gyp/test/win/gyptest-midl-excluded.py +22 -0
  1468. data/ext/gyp/test/win/gyptest-midl-includedirs.py +21 -0
  1469. data/ext/gyp/test/win/gyptest-midl-rules.py +28 -0
  1470. data/ext/gyp/test/win/gyptest-ml-safeseh.py +22 -0
  1471. data/ext/gyp/test/win/gyptest-quoting-commands.py +25 -0
  1472. data/ext/gyp/test/win/gyptest-rc-build.py +29 -0
  1473. data/ext/gyp/test/win/gyptest-sys.py +27 -0
  1474. data/ext/gyp/test/win/gyptest-system-include.py +21 -0
  1475. data/ext/gyp/test/win/idl-excluded/bad.idl +6 -0
  1476. data/ext/gyp/test/win/idl-excluded/copy-file.py +11 -0
  1477. data/ext/gyp/test/win/idl-excluded/idl-excluded.gyp +58 -0
  1478. data/ext/gyp/test/win/idl-excluded/program.cc +7 -0
  1479. data/ext/gyp/test/win/idl-includedirs/hello.cc +7 -0
  1480. data/ext/gyp/test/win/idl-includedirs/idl-includedirs.gyp +26 -0
  1481. data/ext/gyp/test/win/idl-includedirs/subdir/bar.idl +13 -0
  1482. data/ext/gyp/test/win/idl-includedirs/subdir/foo.idl +14 -0
  1483. data/ext/gyp/test/win/idl-rules/Window.idl +9 -0
  1484. data/ext/gyp/test/win/idl-rules/basic-idl.gyp +67 -0
  1485. data/ext/gyp/test/win/idl-rules/history_indexer.idl +17 -0
  1486. data/ext/gyp/test/win/idl-rules/history_indexer_user.cc +15 -0
  1487. data/ext/gyp/test/win/idl-rules/idl_compiler.py +17 -0
  1488. data/ext/gyp/test/win/importlib/dll_no_exports.cc +9 -0
  1489. data/ext/gyp/test/win/importlib/has-exports.cc +10 -0
  1490. data/ext/gyp/test/win/importlib/hello.cc +9 -0
  1491. data/ext/gyp/test/win/importlib/importlib.gyp +30 -0
  1492. data/ext/gyp/test/win/importlib/noimplib.gyp +16 -0
  1493. data/ext/gyp/test/win/large-pdb/dllmain.cc +9 -0
  1494. data/ext/gyp/test/win/large-pdb/large-pdb.gyp +98 -0
  1495. data/ext/gyp/test/win/large-pdb/main.cc +7 -0
  1496. data/ext/gyp/test/win/lib-crosscompile/answer.cc +9 -0
  1497. data/ext/gyp/test/win/lib-crosscompile/answer.h +5 -0
  1498. data/ext/gyp/test/win/lib-crosscompile/use_host_ar.gyp +17 -0
  1499. data/ext/gyp/test/win/lib-flags/answer.cc +9 -0
  1500. data/ext/gyp/test/win/lib-flags/answer.h +5 -0
  1501. data/ext/gyp/test/win/lib-flags/ltcg.gyp +21 -0
  1502. data/ext/gyp/test/win/linker-flags/a/x.cc +7 -0
  1503. data/ext/gyp/test/win/linker-flags/a/z.cc +7 -0
  1504. data/ext/gyp/test/win/linker-flags/additional-deps.cc +10 -0
  1505. data/ext/gyp/test/win/linker-flags/additional-deps.gyp +30 -0
  1506. data/ext/gyp/test/win/linker-flags/additional-options.gyp +29 -0
  1507. data/ext/gyp/test/win/linker-flags/aslr.gyp +35 -0
  1508. data/ext/gyp/test/win/linker-flags/b/y.cc +7 -0
  1509. data/ext/gyp/test/win/linker-flags/base-address.gyp +38 -0
  1510. data/ext/gyp/test/win/linker-flags/debug-info.gyp +28 -0
  1511. data/ext/gyp/test/win/linker-flags/deffile-multiple.gyp +17 -0
  1512. data/ext/gyp/test/win/linker-flags/deffile.cc +13 -0
  1513. data/ext/gyp/test/win/linker-flags/deffile.def +8 -0
  1514. data/ext/gyp/test/win/linker-flags/deffile.gyp +38 -0
  1515. data/ext/gyp/test/win/linker-flags/delay-load-dlls.gyp +35 -0
  1516. data/ext/gyp/test/win/linker-flags/delay-load.cc +10 -0
  1517. data/ext/gyp/test/win/linker-flags/embed-manifest.gyp +109 -0
  1518. data/ext/gyp/test/win/linker-flags/enable-uac.gyp +45 -0
  1519. data/ext/gyp/test/win/linker-flags/entrypointsymbol.cc +13 -0
  1520. data/ext/gyp/test/win/linker-flags/entrypointsymbol.gyp +28 -0
  1521. data/ext/gyp/test/win/linker-flags/extra.manifest +11 -0
  1522. data/ext/gyp/test/win/linker-flags/extra2.manifest +11 -0
  1523. data/ext/gyp/test/win/linker-flags/fixed-base.gyp +52 -0
  1524. data/ext/gyp/test/win/linker-flags/force-symbol-reference.gyp +39 -0
  1525. data/ext/gyp/test/win/linker-flags/generate-manifest.gyp +166 -0
  1526. data/ext/gyp/test/win/linker-flags/hello.cc +7 -0
  1527. data/ext/gyp/test/win/linker-flags/incremental.gyp +65 -0
  1528. data/ext/gyp/test/win/linker-flags/inline_test.cc +12 -0
  1529. data/ext/gyp/test/win/linker-flags/inline_test.h +5 -0
  1530. data/ext/gyp/test/win/linker-flags/inline_test_main.cc +15 -0
  1531. data/ext/gyp/test/win/linker-flags/large-address-aware.gyp +28 -0
  1532. data/ext/gyp/test/win/linker-flags/library-adjust.cc +10 -0
  1533. data/ext/gyp/test/win/linker-flags/library-adjust.gyp +16 -0
  1534. data/ext/gyp/test/win/linker-flags/library-directories-define.cc +7 -0
  1535. data/ext/gyp/test/win/linker-flags/library-directories-reference.cc +10 -0
  1536. data/ext/gyp/test/win/linker-flags/library-directories.gyp +42 -0
  1537. data/ext/gyp/test/win/linker-flags/link-ordering.gyp +95 -0
  1538. data/ext/gyp/test/win/linker-flags/link-warning.cc +10 -0
  1539. data/ext/gyp/test/win/linker-flags/ltcg.gyp +42 -0
  1540. data/ext/gyp/test/win/linker-flags/main-crt.c +8 -0
  1541. data/ext/gyp/test/win/linker-flags/manifest-in-comment.cc +13 -0
  1542. data/ext/gyp/test/win/linker-flags/mapfile.cc +12 -0
  1543. data/ext/gyp/test/win/linker-flags/mapfile.gyp +45 -0
  1544. data/ext/gyp/test/win/linker-flags/no-default-libs.cc +18 -0
  1545. data/ext/gyp/test/win/linker-flags/no-default-libs.gyp +13 -0
  1546. data/ext/gyp/test/win/linker-flags/nodefaultlib.cc +13 -0
  1547. data/ext/gyp/test/win/linker-flags/nodefaultlib.gyp +30 -0
  1548. data/ext/gyp/test/win/linker-flags/nxcompat.gyp +35 -0
  1549. data/ext/gyp/test/win/linker-flags/opt-icf.cc +29 -0
  1550. data/ext/gyp/test/win/linker-flags/opt-icf.gyp +63 -0
  1551. data/ext/gyp/test/win/linker-flags/opt-ref.cc +11 -0
  1552. data/ext/gyp/test/win/linker-flags/opt-ref.gyp +56 -0
  1553. data/ext/gyp/test/win/linker-flags/outputfile.gyp +58 -0
  1554. data/ext/gyp/test/win/linker-flags/pdb-output.gyp +49 -0
  1555. data/ext/gyp/test/win/linker-flags/pgo.gyp +143 -0
  1556. data/ext/gyp/test/win/linker-flags/profile.gyp +50 -0
  1557. data/ext/gyp/test/win/linker-flags/program-database.gyp +40 -0
  1558. data/ext/gyp/test/win/linker-flags/safeseh.gyp +79 -0
  1559. data/ext/gyp/test/win/linker-flags/safeseh_hello.cc +11 -0
  1560. data/ext/gyp/test/win/linker-flags/safeseh_zero.asm +10 -0
  1561. data/ext/gyp/test/win/linker-flags/safeseh_zero64.asm +9 -0
  1562. data/ext/gyp/test/win/linker-flags/stacksize.gyp +44 -0
  1563. data/ext/gyp/test/win/linker-flags/subdir/library.gyp +13 -0
  1564. data/ext/gyp/test/win/linker-flags/subsystem-windows.cc +9 -0
  1565. data/ext/gyp/test/win/linker-flags/subsystem.gyp +70 -0
  1566. data/ext/gyp/test/win/linker-flags/target-machine.gyp +48 -0
  1567. data/ext/gyp/test/win/linker-flags/tsaware.gyp +28 -0
  1568. data/ext/gyp/test/win/linker-flags/unsupported-manifest.gyp +13 -0
  1569. data/ext/gyp/test/win/linker-flags/update_pgd.py +35 -0
  1570. data/ext/gyp/test/win/linker-flags/warn-as-error.gyp +33 -0
  1571. data/ext/gyp/test/win/linker-flags/x.cc +7 -0
  1572. data/ext/gyp/test/win/linker-flags/y.cc +7 -0
  1573. data/ext/gyp/test/win/linker-flags/z.cc +7 -0
  1574. data/ext/gyp/test/win/long-command-line/function.cc +7 -0
  1575. data/ext/gyp/test/win/long-command-line/hello.cc +7 -0
  1576. data/ext/gyp/test/win/long-command-line/long-command-line.gyp +54 -0
  1577. data/ext/gyp/test/win/ml-safeseh/a.asm +10 -0
  1578. data/ext/gyp/test/win/ml-safeseh/hello.cc +11 -0
  1579. data/ext/gyp/test/win/ml-safeseh/ml-safeseh.gyp +24 -0
  1580. data/ext/gyp/test/win/precompiled/gyptest-all.py +21 -0
  1581. data/ext/gyp/test/win/precompiled/hello.c +14 -0
  1582. data/ext/gyp/test/win/precompiled/hello.gyp +28 -0
  1583. data/ext/gyp/test/win/precompiled/hello2.c +13 -0
  1584. data/ext/gyp/test/win/precompiled/precomp.c +8 -0
  1585. data/ext/gyp/test/win/rc-build/Resource.h +26 -0
  1586. data/ext/gyp/test/win/rc-build/hello.cpp +30 -0
  1587. data/ext/gyp/test/win/rc-build/hello.gyp +92 -0
  1588. data/ext/gyp/test/win/rc-build/hello.h +3 -0
  1589. data/ext/gyp/test/win/rc-build/hello.ico +0 -0
  1590. data/ext/gyp/test/win/rc-build/hello.rc +86 -0
  1591. data/ext/gyp/test/win/rc-build/hello3.rc +87 -0
  1592. data/ext/gyp/test/win/rc-build/small.ico +0 -0
  1593. data/ext/gyp/test/win/rc-build/subdir/hello2.rc +87 -0
  1594. data/ext/gyp/test/win/rc-build/subdir/include.h +1 -0
  1595. data/ext/gyp/test/win/rc-build/targetver.h +24 -0
  1596. data/ext/gyp/test/win/shard/hello.cc +7 -0
  1597. data/ext/gyp/test/win/shard/hello1.cc +7 -0
  1598. data/ext/gyp/test/win/shard/hello2.cc +7 -0
  1599. data/ext/gyp/test/win/shard/hello3.cc +7 -0
  1600. data/ext/gyp/test/win/shard/hello4.cc +7 -0
  1601. data/ext/gyp/test/win/shard/shard.gyp +31 -0
  1602. data/ext/gyp/test/win/shard/shard_ref.gyp +41 -0
  1603. data/ext/gyp/test/win/system-include/bar/header.h +0 -0
  1604. data/ext/gyp/test/win/system-include/common/commonheader.h +0 -0
  1605. data/ext/gyp/test/win/system-include/foo/header.h +0 -0
  1606. data/ext/gyp/test/win/system-include/main.cc +4 -0
  1607. data/ext/gyp/test/win/system-include/test.gyp +26 -0
  1608. data/ext/gyp/test/win/uldi/a.cc +7 -0
  1609. data/ext/gyp/test/win/uldi/b.cc +7 -0
  1610. data/ext/gyp/test/win/uldi/dll.cc +6 -0
  1611. data/ext/gyp/test/win/uldi/exe.cc +7 -0
  1612. data/ext/gyp/test/win/uldi/main.cc +10 -0
  1613. data/ext/gyp/test/win/uldi/uldi-depending-on-module.gyp +42 -0
  1614. data/ext/gyp/test/win/uldi/uldi.gyp +45 -0
  1615. data/ext/gyp/test/win/vs-macros/as.py +20 -0
  1616. data/ext/gyp/test/win/vs-macros/containing-gyp.gyp +39 -0
  1617. data/ext/gyp/test/win/vs-macros/do_stuff.py +8 -0
  1618. data/ext/gyp/test/win/vs-macros/hello.cc +7 -0
  1619. data/ext/gyp/test/win/vs-macros/input-output-macros.gyp +32 -0
  1620. data/ext/gyp/test/win/vs-macros/input.S +0 -0
  1621. data/ext/gyp/test/win/vs-macros/projectname.gyp +29 -0
  1622. data/ext/gyp/test/win/vs-macros/stuff.blah +1 -0
  1623. data/ext/gyp/test/win/vs-macros/targetext.gyp +59 -0
  1624. data/ext/gyp/test/win/vs-macros/targetfilename.gyp +59 -0
  1625. data/ext/gyp/test/win/vs-macros/targetname.gyp +52 -0
  1626. data/ext/gyp/test/win/vs-macros/targetpath.gyp +59 -0
  1627. data/ext/gyp/test/win/vs-macros/test_exists.py +10 -0
  1628. data/ext/gyp/test/win/vs-macros/vcinstalldir.gyp +41 -0
  1629. data/ext/gyp/test/win/win-driver-target-type/win-driver-target-type.c +10 -0
  1630. data/ext/gyp/test/win/win-driver-target-type/win-driver-target-type.gyp +32 -0
  1631. data/ext/gyp/test/win/win-driver-target-type/win-driver-target-type.h +13 -0
  1632. data/ext/gyp/test/win/win-driver-target-type/win-driver-target-type.rc +14 -0
  1633. data/ext/gyp/test/win/win-tool/copies_readonly_files.gyp +29 -0
  1634. data/ext/gyp/test/win/win-tool/gyptest-win-tool-handles-readonly-files.py +55 -0
  1635. data/ext/gyp/test/win/winrt-app-type-revision/dllmain.cc +30 -0
  1636. data/ext/gyp/test/win/winrt-app-type-revision/winrt-app-type-revison.gyp +43 -0
  1637. data/ext/gyp/test/win/winrt-target-platform-version/dllmain.cc +30 -0
  1638. data/ext/gyp/test/win/winrt-target-platform-version/winrt-target-platform-version.gyp +49 -0
  1639. data/ext/gyp/test/xcode-ninja/list_excluded/gyptest-all.py +49 -0
  1640. data/ext/gyp/test/xcode-ninja/list_excluded/hello.cpp +7 -0
  1641. data/ext/gyp/test/xcode-ninja/list_excluded/hello_exclude.gyp +19 -0
  1642. data/ext/gyp/test/xcode-ninja/list_excluded/hello_excluded.cpp +7 -0
  1643. data/ext/gyp/tools/README +15 -0
  1644. data/ext/gyp/tools/Xcode/README +5 -0
  1645. data/ext/gyp/tools/Xcode/Specifications/gyp.pbfilespec +27 -0
  1646. data/ext/gyp/tools/Xcode/Specifications/gyp.xclangspec +226 -0
  1647. data/ext/gyp/tools/emacs/README +12 -0
  1648. data/ext/gyp/tools/emacs/gyp-tests.el +63 -0
  1649. data/ext/gyp/tools/emacs/gyp.el +275 -0
  1650. data/ext/gyp/tools/emacs/run-unit-tests.sh +7 -0
  1651. data/ext/gyp/tools/emacs/testdata/media.gyp +1105 -0
  1652. data/ext/gyp/tools/emacs/testdata/media.gyp.fontified +1107 -0
  1653. data/ext/gyp/tools/graphviz.py +102 -0
  1654. data/ext/gyp/tools/pretty_gyp.py +156 -0
  1655. data/ext/gyp/tools/pretty_sln.py +171 -0
  1656. data/ext/gyp/tools/pretty_vcproj.py +337 -0
  1657. data/ext/libuv/.gitattributes +1 -0
  1658. data/ext/libuv/.github/ISSUE_TEMPLATE.md +13 -0
  1659. data/ext/libuv/.github/stale.yml +22 -0
  1660. data/ext/libuv/.gitignore +80 -0
  1661. data/ext/libuv/.mailmap +50 -0
  1662. data/ext/libuv/AUTHORS +415 -0
  1663. data/ext/libuv/CMakeLists.txt +430 -0
  1664. data/ext/libuv/CONTRIBUTING.md +172 -0
  1665. data/ext/libuv/ChangeLog +4548 -0
  1666. data/ext/libuv/LICENSE +70 -0
  1667. data/ext/libuv/LICENSE-docs +396 -0
  1668. data/ext/libuv/MAINTAINERS.md +48 -0
  1669. data/ext/libuv/Makefile.am +548 -0
  1670. data/ext/libuv/README.md +431 -0
  1671. data/ext/libuv/SUPPORTED_PLATFORMS.md +68 -0
  1672. data/ext/libuv/android-configure-arm +23 -0
  1673. data/ext/libuv/android-configure-arm64 +23 -0
  1674. data/ext/libuv/android-configure-x86 +23 -0
  1675. data/ext/libuv/android-configure-x86_64 +25 -0
  1676. data/ext/libuv/appveyor.yml +32 -0
  1677. data/ext/libuv/autogen.sh +46 -0
  1678. data/ext/libuv/common.gypi +213 -0
  1679. data/ext/libuv/configure.ac +82 -0
  1680. data/ext/libuv/docs/Makefile +183 -0
  1681. data/ext/libuv/docs/code/cgi/main.c +81 -0
  1682. data/ext/libuv/docs/code/cgi/tick.c +13 -0
  1683. data/ext/libuv/docs/code/detach/main.c +31 -0
  1684. data/ext/libuv/docs/code/dns/main.c +80 -0
  1685. data/ext/libuv/docs/code/helloworld/main.c +15 -0
  1686. data/ext/libuv/docs/code/idle-basic/main.c +24 -0
  1687. data/ext/libuv/docs/code/idle-compute/main.c +43 -0
  1688. data/ext/libuv/docs/code/interfaces/main.c +33 -0
  1689. data/ext/libuv/docs/code/locks/main.c +57 -0
  1690. data/ext/libuv/docs/code/multi-echo-server/hammer.js +20 -0
  1691. data/ext/libuv/docs/code/multi-echo-server/main.c +114 -0
  1692. data/ext/libuv/docs/code/multi-echo-server/worker.c +88 -0
  1693. data/ext/libuv/docs/code/onchange/main.c +44 -0
  1694. data/ext/libuv/docs/code/pipe-echo-server/main.c +94 -0
  1695. data/ext/libuv/docs/code/plugin/hello.c +5 -0
  1696. data/ext/libuv/docs/code/plugin/main.c +39 -0
  1697. data/ext/libuv/docs/code/plugin/plugin.h +7 -0
  1698. data/ext/libuv/docs/code/proc-streams/main.c +49 -0
  1699. data/ext/libuv/docs/code/proc-streams/test.c +8 -0
  1700. data/ext/libuv/docs/code/progress/main.c +47 -0
  1701. data/ext/libuv/docs/code/queue-cancel/main.c +59 -0
  1702. data/ext/libuv/docs/code/queue-work/main.c +44 -0
  1703. data/ext/libuv/docs/code/ref-timer/main.c +29 -0
  1704. data/ext/libuv/docs/code/signal/main.c +66 -0
  1705. data/ext/libuv/docs/code/spawn/main.c +36 -0
  1706. data/ext/libuv/docs/code/tcp-echo-server/main.c +87 -0
  1707. data/ext/libuv/docs/code/thread-create/main.c +36 -0
  1708. data/ext/libuv/docs/code/tty/main.c +29 -0
  1709. data/ext/libuv/docs/code/tty-gravity/main.c +48 -0
  1710. data/ext/libuv/docs/code/udp-dhcp/main.c +127 -0
  1711. data/ext/libuv/docs/code/uvcat/main.c +63 -0
  1712. data/ext/libuv/docs/code/uvstop/main.c +33 -0
  1713. data/ext/libuv/docs/code/uvtee/main.c +80 -0
  1714. data/ext/libuv/docs/code/uvwget/main.c +166 -0
  1715. data/ext/libuv/docs/make.bat +243 -0
  1716. data/ext/libuv/docs/src/api.rst +35 -0
  1717. data/ext/libuv/docs/src/async.rst +65 -0
  1718. data/ext/libuv/docs/src/check.rst +46 -0
  1719. data/ext/libuv/docs/src/conf.py +348 -0
  1720. data/ext/libuv/docs/src/design.rst +140 -0
  1721. data/ext/libuv/docs/src/dll.rst +44 -0
  1722. data/ext/libuv/docs/src/dns.rst +108 -0
  1723. data/ext/libuv/docs/src/errors.rst +365 -0
  1724. data/ext/libuv/docs/src/fs.rst +689 -0
  1725. data/ext/libuv/docs/src/fs_event.rst +132 -0
  1726. data/ext/libuv/docs/src/fs_poll.rst +77 -0
  1727. data/ext/libuv/docs/src/guide/about.rst +22 -0
  1728. data/ext/libuv/docs/src/guide/basics.rst +219 -0
  1729. data/ext/libuv/docs/src/guide/eventloops.rst +48 -0
  1730. data/ext/libuv/docs/src/guide/filesystem.rst +330 -0
  1731. data/ext/libuv/docs/src/guide/introduction.rst +75 -0
  1732. data/ext/libuv/docs/src/guide/networking.rst +250 -0
  1733. data/ext/libuv/docs/src/guide/processes.rst +406 -0
  1734. data/ext/libuv/docs/src/guide/threads.rst +385 -0
  1735. data/ext/libuv/docs/src/guide/utilities.rst +437 -0
  1736. data/ext/libuv/docs/src/guide.rst +22 -0
  1737. data/ext/libuv/docs/src/handle.rst +283 -0
  1738. data/ext/libuv/docs/src/idle.rst +54 -0
  1739. data/ext/libuv/docs/src/index.rst +62 -0
  1740. data/ext/libuv/docs/src/loop.rst +238 -0
  1741. data/ext/libuv/docs/src/migration_010_100.rst +244 -0
  1742. data/ext/libuv/docs/src/misc.rst +702 -0
  1743. data/ext/libuv/docs/src/pipe.rst +116 -0
  1744. data/ext/libuv/docs/src/poll.rst +121 -0
  1745. data/ext/libuv/docs/src/prepare.rst +46 -0
  1746. data/ext/libuv/docs/src/process.rst +250 -0
  1747. data/ext/libuv/docs/src/request.rst +116 -0
  1748. data/ext/libuv/docs/src/signal.rst +101 -0
  1749. data/ext/libuv/docs/src/sphinx-plugins/manpage.py +45 -0
  1750. data/ext/libuv/docs/src/static/architecture.png +0 -0
  1751. data/ext/libuv/docs/src/static/diagrams.key/Data/st0-311.jpg +0 -0
  1752. data/ext/libuv/docs/src/static/diagrams.key/Data/st1-475.jpg +0 -0
  1753. data/ext/libuv/docs/src/static/diagrams.key/Index.zip +0 -0
  1754. data/ext/libuv/docs/src/static/diagrams.key/Metadata/BuildVersionHistory.plist +8 -0
  1755. data/ext/libuv/docs/src/static/diagrams.key/Metadata/DocumentIdentifier +1 -0
  1756. data/ext/libuv/docs/src/static/diagrams.key/Metadata/Properties.plist +0 -0
  1757. data/ext/libuv/docs/src/static/diagrams.key/preview-micro.jpg +0 -0
  1758. data/ext/libuv/docs/src/static/diagrams.key/preview-web.jpg +0 -0
  1759. data/ext/libuv/docs/src/static/diagrams.key/preview.jpg +0 -0
  1760. data/ext/libuv/docs/src/static/favicon.ico +0 -0
  1761. data/ext/libuv/docs/src/static/logo.png +0 -0
  1762. data/ext/libuv/docs/src/static/loop_iteration.png +0 -0
  1763. data/ext/libuv/docs/src/stream.rst +237 -0
  1764. data/ext/libuv/docs/src/tcp.rst +125 -0
  1765. data/ext/libuv/docs/src/threading.rst +197 -0
  1766. data/ext/libuv/docs/src/threadpool.rst +69 -0
  1767. data/ext/libuv/docs/src/timer.rst +81 -0
  1768. data/ext/libuv/docs/src/tty.rst +139 -0
  1769. data/ext/libuv/docs/src/udp.rst +390 -0
  1770. data/ext/libuv/docs/src/upgrading.rst +11 -0
  1771. data/ext/libuv/docs/src/version.rst +60 -0
  1772. data/ext/libuv/gyp_uv.py +73 -0
  1773. data/ext/libuv/img/banner.png +0 -0
  1774. data/ext/libuv/img/logos.svg +152 -0
  1775. data/ext/libuv/include/uv/aix.h +32 -0
  1776. data/ext/libuv/include/uv/android-ifaddrs.h +54 -0
  1777. data/ext/libuv/include/uv/bsd.h +34 -0
  1778. data/ext/libuv/include/uv/darwin.h +61 -0
  1779. data/ext/libuv/include/uv/errno.h +448 -0
  1780. data/ext/libuv/include/uv/linux.h +34 -0
  1781. data/ext/libuv/include/uv/os390.h +33 -0
  1782. data/ext/libuv/include/uv/posix.h +31 -0
  1783. data/ext/libuv/include/uv/stdint-msvc2008.h +247 -0
  1784. data/ext/libuv/include/uv/sunos.h +44 -0
  1785. data/ext/libuv/include/uv/threadpool.h +37 -0
  1786. data/ext/libuv/include/uv/tree.h +768 -0
  1787. data/ext/libuv/include/uv/unix.h +505 -0
  1788. data/ext/libuv/include/uv/version.h +43 -0
  1789. data/ext/libuv/include/uv/win.h +691 -0
  1790. data/ext/libuv/include/uv.h +1782 -0
  1791. data/ext/libuv/libuv.pc.in +12 -0
  1792. data/ext/libuv/m4/.gitignore +4 -0
  1793. data/ext/libuv/m4/as_case.m4 +21 -0
  1794. data/ext/libuv/m4/libuv-check-flags.m4 +319 -0
  1795. data/ext/libuv/src/fs-poll.c +287 -0
  1796. data/ext/libuv/src/heap-inl.h +245 -0
  1797. data/ext/libuv/src/idna.c +291 -0
  1798. data/ext/libuv/src/idna.h +31 -0
  1799. data/ext/libuv/src/inet.c +302 -0
  1800. data/ext/libuv/src/queue.h +108 -0
  1801. data/ext/libuv/src/random.c +123 -0
  1802. data/ext/libuv/src/strscpy.c +17 -0
  1803. data/ext/libuv/src/strscpy.h +18 -0
  1804. data/ext/libuv/src/threadpool.c +388 -0
  1805. data/ext/libuv/src/timer.c +181 -0
  1806. data/ext/libuv/src/unix/aix-common.c +337 -0
  1807. data/ext/libuv/src/unix/aix.c +1066 -0
  1808. data/ext/libuv/src/unix/android-ifaddrs.c +712 -0
  1809. data/ext/libuv/src/unix/async.c +298 -0
  1810. data/ext/libuv/src/unix/atomic-ops.h +59 -0
  1811. data/ext/libuv/src/unix/bsd-ifaddrs.c +161 -0
  1812. data/ext/libuv/src/unix/bsd-proctitle.c +93 -0
  1813. data/ext/libuv/src/unix/core.c +1571 -0
  1814. data/ext/libuv/src/unix/cygwin.c +53 -0
  1815. data/ext/libuv/src/unix/darwin-proctitle.c +202 -0
  1816. data/ext/libuv/src/unix/darwin.c +225 -0
  1817. data/ext/libuv/src/unix/dl.c +80 -0
  1818. data/ext/libuv/src/unix/freebsd.c +290 -0
  1819. data/ext/libuv/src/unix/fs.c +2044 -0
  1820. data/ext/libuv/src/unix/fsevents.c +924 -0
  1821. data/ext/libuv/src/unix/getaddrinfo.c +255 -0
  1822. data/ext/libuv/src/unix/getnameinfo.c +121 -0
  1823. data/ext/libuv/src/unix/haiku.c +167 -0
  1824. data/ext/libuv/src/unix/ibmi.c +249 -0
  1825. data/ext/libuv/src/unix/internal.h +331 -0
  1826. data/ext/libuv/src/unix/kqueue.c +544 -0
  1827. data/ext/libuv/src/unix/linux-core.c +1091 -0
  1828. data/ext/libuv/src/unix/linux-inotify.c +354 -0
  1829. data/ext/libuv/src/unix/linux-syscalls.c +394 -0
  1830. data/ext/libuv/src/unix/linux-syscalls.h +153 -0
  1831. data/ext/libuv/src/unix/loop-watcher.c +68 -0
  1832. data/ext/libuv/src/unix/loop.c +194 -0
  1833. data/ext/libuv/src/unix/netbsd.c +259 -0
  1834. data/ext/libuv/src/unix/no-fsevents.c +42 -0
  1835. data/ext/libuv/src/unix/no-proctitle.c +42 -0
  1836. data/ext/libuv/src/unix/openbsd.c +244 -0
  1837. data/ext/libuv/src/unix/os390-syscalls.c +519 -0
  1838. data/ext/libuv/src/unix/os390-syscalls.h +68 -0
  1839. data/ext/libuv/src/unix/os390.c +1003 -0
  1840. data/ext/libuv/src/unix/pipe.c +377 -0
  1841. data/ext/libuv/src/unix/poll.c +150 -0
  1842. data/ext/libuv/src/unix/posix-hrtime.c +35 -0
  1843. data/ext/libuv/src/unix/posix-poll.c +336 -0
  1844. data/ext/libuv/src/unix/process.c +603 -0
  1845. data/ext/libuv/src/unix/procfs-exepath.c +45 -0
  1846. data/ext/libuv/src/unix/proctitle.c +132 -0
  1847. data/ext/libuv/src/unix/pthread-fixes.c +56 -0
  1848. data/ext/libuv/src/unix/random-devurandom.c +93 -0
  1849. data/ext/libuv/src/unix/random-getentropy.c +57 -0
  1850. data/ext/libuv/src/unix/random-getrandom.c +88 -0
  1851. data/ext/libuv/src/unix/random-sysctl-linux.c +99 -0
  1852. data/ext/libuv/src/unix/signal.c +577 -0
  1853. data/ext/libuv/src/unix/spinlock.h +53 -0
  1854. data/ext/libuv/src/unix/stream.c +1697 -0
  1855. data/ext/libuv/src/unix/sunos.c +836 -0
  1856. data/ext/libuv/src/unix/sysinfo-loadavg.c +36 -0
  1857. data/ext/libuv/src/unix/sysinfo-memory.c +42 -0
  1858. data/ext/libuv/src/unix/tcp.c +450 -0
  1859. data/ext/libuv/src/unix/thread.c +852 -0
  1860. data/ext/libuv/src/unix/tty.c +381 -0
  1861. data/ext/libuv/src/unix/udp.c +1136 -0
  1862. data/ext/libuv/src/uv-common.c +812 -0
  1863. data/ext/libuv/src/uv-common.h +326 -0
  1864. data/ext/libuv/src/uv-data-getter-setters.c +98 -0
  1865. data/ext/libuv/src/version.c +45 -0
  1866. data/ext/libuv/src/win/async.c +98 -0
  1867. data/ext/libuv/src/win/atomicops-inl.h +57 -0
  1868. data/ext/libuv/src/win/core.c +657 -0
  1869. data/ext/libuv/src/win/detect-wakeup.c +35 -0
  1870. data/ext/libuv/src/win/dl.c +136 -0
  1871. data/ext/libuv/src/win/error.c +172 -0
  1872. data/ext/libuv/src/win/fs-event.c +589 -0
  1873. data/ext/libuv/src/win/fs-fd-hash-inl.h +178 -0
  1874. data/ext/libuv/src/win/fs.c +3238 -0
  1875. data/ext/libuv/src/win/getaddrinfo.c +463 -0
  1876. data/ext/libuv/src/win/getnameinfo.c +157 -0
  1877. data/ext/libuv/src/win/handle-inl.h +180 -0
  1878. data/ext/libuv/src/win/handle.c +162 -0
  1879. data/ext/libuv/src/win/internal.h +344 -0
  1880. data/ext/libuv/src/win/loop-watcher.c +122 -0
  1881. data/ext/libuv/src/win/pipe.c +2386 -0
  1882. data/ext/libuv/src/win/poll.c +643 -0
  1883. data/ext/libuv/src/win/process-stdio.c +512 -0
  1884. data/ext/libuv/src/win/process.c +1282 -0
  1885. data/ext/libuv/src/win/req-inl.h +221 -0
  1886. data/ext/libuv/src/win/signal.c +277 -0
  1887. data/ext/libuv/src/win/snprintf.c +42 -0
  1888. data/ext/libuv/src/win/stream-inl.h +54 -0
  1889. data/ext/libuv/src/win/stream.c +243 -0
  1890. data/ext/libuv/src/win/tcp.c +1520 -0
  1891. data/ext/libuv/src/win/thread.c +520 -0
  1892. data/ext/libuv/src/win/tty.c +2348 -0
  1893. data/ext/libuv/src/win/udp.c +1185 -0
  1894. data/ext/libuv/src/win/util.c +1879 -0
  1895. data/ext/libuv/src/win/winapi.c +149 -0
  1896. data/ext/libuv/src/win/winapi.h +4751 -0
  1897. data/ext/libuv/src/win/winsock.c +575 -0
  1898. data/ext/libuv/src/win/winsock.h +201 -0
  1899. data/ext/libuv/test/benchmark-async-pummel.c +119 -0
  1900. data/ext/libuv/test/benchmark-async.c +141 -0
  1901. data/ext/libuv/test/benchmark-fs-stat.c +136 -0
  1902. data/ext/libuv/test/benchmark-getaddrinfo.c +92 -0
  1903. data/ext/libuv/test/benchmark-list.h +163 -0
  1904. data/ext/libuv/test/benchmark-loop-count.c +92 -0
  1905. data/ext/libuv/test/benchmark-million-async.c +112 -0
  1906. data/ext/libuv/test/benchmark-million-timers.c +86 -0
  1907. data/ext/libuv/test/benchmark-multi-accept.c +447 -0
  1908. data/ext/libuv/test/benchmark-ping-pongs.c +221 -0
  1909. data/ext/libuv/test/benchmark-pound.c +351 -0
  1910. data/ext/libuv/test/benchmark-pump.c +476 -0
  1911. data/ext/libuv/test/benchmark-sizes.c +46 -0
  1912. data/ext/libuv/test/benchmark-spawn.c +164 -0
  1913. data/ext/libuv/test/benchmark-tcp-write-batch.c +144 -0
  1914. data/ext/libuv/test/benchmark-thread.c +64 -0
  1915. data/ext/libuv/test/benchmark-udp-pummel.c +243 -0
  1916. data/ext/libuv/test/blackhole-server.c +121 -0
  1917. data/ext/libuv/test/dns-server.c +340 -0
  1918. data/ext/libuv/test/echo-server.c +382 -0
  1919. data/ext/libuv/test/fixtures/empty_file +0 -0
  1920. data/ext/libuv/test/fixtures/load_error.node +1 -0
  1921. data/ext/libuv/test/fixtures/lorem_ipsum.txt +1 -0
  1922. data/ext/libuv/test/run-benchmarks.c +65 -0
  1923. data/ext/libuv/test/run-tests.c +239 -0
  1924. data/ext/libuv/test/runner-unix.c +450 -0
  1925. data/ext/libuv/test/runner-unix.h +36 -0
  1926. data/ext/libuv/test/runner-win.c +357 -0
  1927. data/ext/libuv/test/runner-win.h +41 -0
  1928. data/ext/libuv/test/runner.c +431 -0
  1929. data/ext/libuv/test/runner.h +176 -0
  1930. data/ext/libuv/test/task.h +238 -0
  1931. data/ext/libuv/test/test-active.c +84 -0
  1932. data/ext/libuv/test/test-async-null-cb.c +64 -0
  1933. data/ext/libuv/test/test-async.c +134 -0
  1934. data/ext/libuv/test/test-barrier.c +148 -0
  1935. data/ext/libuv/test/test-callback-order.c +77 -0
  1936. data/ext/libuv/test/test-callback-stack.c +204 -0
  1937. data/ext/libuv/test/test-close-fd.c +80 -0
  1938. data/ext/libuv/test/test-close-order.c +80 -0
  1939. data/ext/libuv/test/test-condvar.c +267 -0
  1940. data/ext/libuv/test/test-connect-unspecified.c +63 -0
  1941. data/ext/libuv/test/test-connection-fail.c +151 -0
  1942. data/ext/libuv/test/test-cwd-and-chdir.c +58 -0
  1943. data/ext/libuv/test/test-default-loop-close.c +59 -0
  1944. data/ext/libuv/test/test-delayed-accept.c +189 -0
  1945. data/ext/libuv/test/test-dlerror.c +61 -0
  1946. data/ext/libuv/test/test-eintr-handling.c +94 -0
  1947. data/ext/libuv/test/test-embed.c +139 -0
  1948. data/ext/libuv/test/test-emfile.c +121 -0
  1949. data/ext/libuv/test/test-env-vars.c +140 -0
  1950. data/ext/libuv/test/test-error.c +79 -0
  1951. data/ext/libuv/test/test-fail-always.c +29 -0
  1952. data/ext/libuv/test/test-fork.c +683 -0
  1953. data/ext/libuv/test/test-fs-copyfile.c +209 -0
  1954. data/ext/libuv/test/test-fs-event.c +1165 -0
  1955. data/ext/libuv/test/test-fs-fd-hash.c +133 -0
  1956. data/ext/libuv/test/test-fs-open-flags.c +435 -0
  1957. data/ext/libuv/test/test-fs-poll.c +300 -0
  1958. data/ext/libuv/test/test-fs-readdir.c +462 -0
  1959. data/ext/libuv/test/test-fs.c +4238 -0
  1960. data/ext/libuv/test/test-get-currentexe.c +86 -0
  1961. data/ext/libuv/test/test-get-loadavg.c +35 -0
  1962. data/ext/libuv/test/test-get-memory.c +40 -0
  1963. data/ext/libuv/test/test-get-passwd.c +86 -0
  1964. data/ext/libuv/test/test-getaddrinfo.c +191 -0
  1965. data/ext/libuv/test/test-gethostname.c +58 -0
  1966. data/ext/libuv/test/test-getnameinfo.c +101 -0
  1967. data/ext/libuv/test/test-getsockname.c +361 -0
  1968. data/ext/libuv/test/test-getters-setters.c +88 -0
  1969. data/ext/libuv/test/test-gettimeofday.c +39 -0
  1970. data/ext/libuv/test/test-handle-fileno.c +125 -0
  1971. data/ext/libuv/test/test-homedir.c +72 -0
  1972. data/ext/libuv/test/test-hrtime.c +52 -0
  1973. data/ext/libuv/test/test-idle.c +99 -0
  1974. data/ext/libuv/test/test-idna.c +195 -0
  1975. data/ext/libuv/test/test-ip4-addr.c +55 -0
  1976. data/ext/libuv/test/test-ip6-addr.c +171 -0
  1977. data/ext/libuv/test/test-ipc-heavy-traffic-deadlock-bug.c +159 -0
  1978. data/ext/libuv/test/test-ipc-send-recv.c +429 -0
  1979. data/ext/libuv/test/test-ipc.c +974 -0
  1980. data/ext/libuv/test/test-list.h +1064 -0
  1981. data/ext/libuv/test/test-loop-alive.c +67 -0
  1982. data/ext/libuv/test/test-loop-close.c +75 -0
  1983. data/ext/libuv/test/test-loop-configure.c +38 -0
  1984. data/ext/libuv/test/test-loop-handles.c +337 -0
  1985. data/ext/libuv/test/test-loop-stop.c +71 -0
  1986. data/ext/libuv/test/test-loop-time.c +63 -0
  1987. data/ext/libuv/test/test-multiple-listen.c +109 -0
  1988. data/ext/libuv/test/test-mutexes.c +182 -0
  1989. data/ext/libuv/test/test-osx-select.c +140 -0
  1990. data/ext/libuv/test/test-pass-always.c +28 -0
  1991. data/ext/libuv/test/test-ping-pong.c +301 -0
  1992. data/ext/libuv/test/test-pipe-bind-error.c +139 -0
  1993. data/ext/libuv/test/test-pipe-close-stdout-read-stdin.c +112 -0
  1994. data/ext/libuv/test/test-pipe-connect-error.c +95 -0
  1995. data/ext/libuv/test/test-pipe-connect-multiple.c +107 -0
  1996. data/ext/libuv/test/test-pipe-connect-prepare.c +83 -0
  1997. data/ext/libuv/test/test-pipe-getsockname.c +266 -0
  1998. data/ext/libuv/test/test-pipe-pending-instances.c +59 -0
  1999. data/ext/libuv/test/test-pipe-sendmsg.c +172 -0
  2000. data/ext/libuv/test/test-pipe-server-close.c +94 -0
  2001. data/ext/libuv/test/test-pipe-set-fchmod.c +90 -0
  2002. data/ext/libuv/test/test-pipe-set-non-blocking.c +99 -0
  2003. data/ext/libuv/test/test-platform-output.c +170 -0
  2004. data/ext/libuv/test/test-poll-close-doesnt-corrupt-stack.c +114 -0
  2005. data/ext/libuv/test/test-poll-close.c +73 -0
  2006. data/ext/libuv/test/test-poll-closesocket.c +92 -0
  2007. data/ext/libuv/test/test-poll-oob.c +210 -0
  2008. data/ext/libuv/test/test-poll.c +668 -0
  2009. data/ext/libuv/test/test-process-priority.c +83 -0
  2010. data/ext/libuv/test/test-process-title-threadsafe.c +89 -0
  2011. data/ext/libuv/test/test-process-title.c +76 -0
  2012. data/ext/libuv/test/test-queue-foreach-delete.c +204 -0
  2013. data/ext/libuv/test/test-random.c +94 -0
  2014. data/ext/libuv/test/test-ref.c +445 -0
  2015. data/ext/libuv/test/test-run-nowait.c +45 -0
  2016. data/ext/libuv/test/test-run-once.c +48 -0
  2017. data/ext/libuv/test/test-semaphore.c +111 -0
  2018. data/ext/libuv/test/test-shutdown-close.c +108 -0
  2019. data/ext/libuv/test/test-shutdown-eof.c +182 -0
  2020. data/ext/libuv/test/test-shutdown-twice.c +85 -0
  2021. data/ext/libuv/test/test-signal-multiple-loops.c +302 -0
  2022. data/ext/libuv/test/test-signal-pending-on-close.c +94 -0
  2023. data/ext/libuv/test/test-signal.c +325 -0
  2024. data/ext/libuv/test/test-socket-buffer-size.c +77 -0
  2025. data/ext/libuv/test/test-spawn.c +1924 -0
  2026. data/ext/libuv/test/test-stdio-over-pipes.c +256 -0
  2027. data/ext/libuv/test/test-strscpy.c +53 -0
  2028. data/ext/libuv/test/test-tcp-alloc-cb-fail.c +123 -0
  2029. data/ext/libuv/test/test-tcp-bind-error.c +254 -0
  2030. data/ext/libuv/test/test-tcp-bind6-error.c +176 -0
  2031. data/ext/libuv/test/test-tcp-close-accept.c +198 -0
  2032. data/ext/libuv/test/test-tcp-close-reset.c +290 -0
  2033. data/ext/libuv/test/test-tcp-close-while-connecting.c +97 -0
  2034. data/ext/libuv/test/test-tcp-close.c +136 -0
  2035. data/ext/libuv/test/test-tcp-connect-error-after-write.c +98 -0
  2036. data/ext/libuv/test/test-tcp-connect-error.c +73 -0
  2037. data/ext/libuv/test/test-tcp-connect-timeout.c +91 -0
  2038. data/ext/libuv/test/test-tcp-connect6-error.c +71 -0
  2039. data/ext/libuv/test/test-tcp-create-socket-early.c +209 -0
  2040. data/ext/libuv/test/test-tcp-flags.c +52 -0
  2041. data/ext/libuv/test/test-tcp-oob.c +146 -0
  2042. data/ext/libuv/test/test-tcp-open.c +400 -0
  2043. data/ext/libuv/test/test-tcp-read-stop.c +76 -0
  2044. data/ext/libuv/test/test-tcp-shutdown-after-write.c +138 -0
  2045. data/ext/libuv/test/test-tcp-try-write-error.c +109 -0
  2046. data/ext/libuv/test/test-tcp-try-write.c +135 -0
  2047. data/ext/libuv/test/test-tcp-unexpected-read.c +117 -0
  2048. data/ext/libuv/test/test-tcp-write-after-connect.c +72 -0
  2049. data/ext/libuv/test/test-tcp-write-fail.c +115 -0
  2050. data/ext/libuv/test/test-tcp-write-queue-order.c +139 -0
  2051. data/ext/libuv/test/test-tcp-write-to-half-open-connection.c +141 -0
  2052. data/ext/libuv/test/test-tcp-writealot.c +180 -0
  2053. data/ext/libuv/test/test-thread-equal.c +45 -0
  2054. data/ext/libuv/test/test-thread.c +286 -0
  2055. data/ext/libuv/test/test-threadpool-cancel.c +349 -0
  2056. data/ext/libuv/test/test-threadpool.c +76 -0
  2057. data/ext/libuv/test/test-timer-again.c +141 -0
  2058. data/ext/libuv/test/test-timer-from-check.c +80 -0
  2059. data/ext/libuv/test/test-timer.c +343 -0
  2060. data/ext/libuv/test/test-tmpdir.c +82 -0
  2061. data/ext/libuv/test/test-tty-duplicate-key.c +321 -0
  2062. data/ext/libuv/test/test-tty.c +464 -0
  2063. data/ext/libuv/test/test-udp-alloc-cb-fail.c +196 -0
  2064. data/ext/libuv/test/test-udp-bind.c +93 -0
  2065. data/ext/libuv/test/test-udp-connect.c +182 -0
  2066. data/ext/libuv/test/test-udp-create-socket-early.c +135 -0
  2067. data/ext/libuv/test/test-udp-dgram-too-big.c +91 -0
  2068. data/ext/libuv/test/test-udp-ipv6.c +200 -0
  2069. data/ext/libuv/test/test-udp-multicast-interface.c +99 -0
  2070. data/ext/libuv/test/test-udp-multicast-interface6.c +103 -0
  2071. data/ext/libuv/test/test-udp-multicast-join.c +181 -0
  2072. data/ext/libuv/test/test-udp-multicast-join6.c +215 -0
  2073. data/ext/libuv/test/test-udp-multicast-ttl.c +94 -0
  2074. data/ext/libuv/test/test-udp-open.c +350 -0
  2075. data/ext/libuv/test/test-udp-options.c +156 -0
  2076. data/ext/libuv/test/test-udp-send-and-recv.c +212 -0
  2077. data/ext/libuv/test/test-udp-send-hang-loop.c +99 -0
  2078. data/ext/libuv/test/test-udp-send-immediate.c +148 -0
  2079. data/ext/libuv/test/test-udp-send-unreachable.c +150 -0
  2080. data/ext/libuv/test/test-udp-try-send.c +121 -0
  2081. data/ext/libuv/test/test-uname.c +69 -0
  2082. data/ext/libuv/test/test-walk-handles.c +77 -0
  2083. data/ext/libuv/test/test-watcher-cross-stop.c +111 -0
  2084. data/ext/libuv/test/test.gyp +293 -0
  2085. data/ext/libuv/tools/make_dist_html.py +124 -0
  2086. data/ext/libuv/tools/vswhere_usability_wrapper.cmd +33 -0
  2087. data/ext/libuv/uv.gyp +368 -0
  2088. data/ext/libuv/vcbuild.bat +184 -0
  2089. data/lib/mt-libuv/version.rb +1 -1
  2090. data/mt-libuv.gemspec +26 -26
  2091. metadata +2088 -1
@@ -0,0 +1,4238 @@
1
+ /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
2
+ *
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to
5
+ * deal in the Software without restriction, including without limitation the
6
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
+ * sell copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19
+ * IN THE SOFTWARE.
20
+ */
21
+
22
+ #include "uv.h"
23
+ #include "task.h"
24
+
25
+ #include <errno.h>
26
+ #include <string.h> /* memset */
27
+ #include <fcntl.h>
28
+ #include <sys/stat.h>
29
+ #include <limits.h> /* INT_MAX, PATH_MAX, IOV_MAX */
30
+
31
+ /* FIXME we shouldn't need to branch in this file */
32
+ #if defined(__unix__) || defined(__POSIX__) || \
33
+ defined(__APPLE__) || defined(__sun) || \
34
+ defined(_AIX) || defined(__MVS__) || \
35
+ defined(__HAIKU__)
36
+ #include <unistd.h> /* unlink, rmdir, etc. */
37
+ #else
38
+ # include <winioctl.h>
39
+ # include <direct.h>
40
+ # include <io.h>
41
+ # ifndef ERROR_SYMLINK_NOT_SUPPORTED
42
+ # define ERROR_SYMLINK_NOT_SUPPORTED 1464
43
+ # endif
44
+ # define unlink _unlink
45
+ # define rmdir _rmdir
46
+ # define open _open
47
+ # define write _write
48
+ # define close _close
49
+ # ifndef stat
50
+ # define stat _stati64
51
+ # endif
52
+ # ifndef lseek
53
+ # define lseek _lseek
54
+ # endif
55
+ #endif
56
+
57
+ #define TOO_LONG_NAME_LENGTH 65536
58
+ #define PATHMAX 1024
59
+
60
+ typedef struct {
61
+ const char* path;
62
+ double atime;
63
+ double mtime;
64
+ } utime_check_t;
65
+
66
+
67
+ static int dummy_cb_count;
68
+ static int close_cb_count;
69
+ static int create_cb_count;
70
+ static int open_cb_count;
71
+ static int read_cb_count;
72
+ static int write_cb_count;
73
+ static int unlink_cb_count;
74
+ static int mkdir_cb_count;
75
+ static int mkdtemp_cb_count;
76
+ static int mkstemp_cb_count;
77
+ static int rmdir_cb_count;
78
+ static int scandir_cb_count;
79
+ static int stat_cb_count;
80
+ static int rename_cb_count;
81
+ static int fsync_cb_count;
82
+ static int fdatasync_cb_count;
83
+ static int ftruncate_cb_count;
84
+ static int sendfile_cb_count;
85
+ static int fstat_cb_count;
86
+ static int access_cb_count;
87
+ static int chmod_cb_count;
88
+ static int fchmod_cb_count;
89
+ static int chown_cb_count;
90
+ static int fchown_cb_count;
91
+ static int lchown_cb_count;
92
+ static int link_cb_count;
93
+ static int symlink_cb_count;
94
+ static int readlink_cb_count;
95
+ static int realpath_cb_count;
96
+ static int utime_cb_count;
97
+ static int futime_cb_count;
98
+ static int statfs_cb_count;
99
+
100
+ static uv_loop_t* loop;
101
+
102
+ static uv_fs_t open_req1;
103
+ static uv_fs_t open_req2;
104
+ static uv_fs_t read_req;
105
+ static uv_fs_t write_req;
106
+ static uv_fs_t unlink_req;
107
+ static uv_fs_t close_req;
108
+ static uv_fs_t mkdir_req;
109
+ static uv_fs_t mkdtemp_req1;
110
+ static uv_fs_t mkdtemp_req2;
111
+ static uv_fs_t mkstemp_req1;
112
+ static uv_fs_t mkstemp_req2;
113
+ static uv_fs_t mkstemp_req3;
114
+ static uv_fs_t rmdir_req;
115
+ static uv_fs_t scandir_req;
116
+ static uv_fs_t stat_req;
117
+ static uv_fs_t rename_req;
118
+ static uv_fs_t fsync_req;
119
+ static uv_fs_t fdatasync_req;
120
+ static uv_fs_t ftruncate_req;
121
+ static uv_fs_t sendfile_req;
122
+ static uv_fs_t utime_req;
123
+ static uv_fs_t futime_req;
124
+
125
+ static char buf[32];
126
+ static char buf2[32];
127
+ static char test_buf[] = "test-buffer\n";
128
+ static char test_buf2[] = "second-buffer\n";
129
+ static uv_buf_t iov;
130
+
131
+ #ifdef _WIN32
132
+ int uv_test_getiovmax(void) {
133
+ return INT32_MAX; /* Emulated by libuv, so no real limit. */
134
+ }
135
+ #else
136
+ int uv_test_getiovmax(void) {
137
+ #if defined(IOV_MAX)
138
+ return IOV_MAX;
139
+ #elif defined(_SC_IOV_MAX)
140
+ static int iovmax = -1;
141
+ if (iovmax == -1) {
142
+ iovmax = sysconf(_SC_IOV_MAX);
143
+ /* On some embedded devices (arm-linux-uclibc based ip camera),
144
+ * sysconf(_SC_IOV_MAX) can not get the correct value. The return
145
+ * value is -1 and the errno is EINPROGRESS. Degrade the value to 1.
146
+ */
147
+ if (iovmax == -1) iovmax = 1;
148
+ }
149
+ return iovmax;
150
+ #else
151
+ return 1024;
152
+ #endif
153
+ }
154
+ #endif
155
+
156
+ #ifdef _WIN32
157
+ /*
158
+ * This tag and guid have no special meaning, and don't conflict with
159
+ * reserved ids.
160
+ */
161
+ static unsigned REPARSE_TAG = 0x9913;
162
+ static GUID REPARSE_GUID = {
163
+ 0x1bf6205f, 0x46ae, 0x4527,
164
+ { 0xb1, 0x0c, 0xc5, 0x09, 0xb7, 0x55, 0x22, 0x80 }};
165
+ #endif
166
+
167
+ static void check_permission(const char* filename, unsigned int mode) {
168
+ int r;
169
+ uv_fs_t req;
170
+ uv_stat_t* s;
171
+
172
+ r = uv_fs_stat(NULL, &req, filename, NULL);
173
+ ASSERT(r == 0);
174
+ ASSERT(req.result == 0);
175
+
176
+ s = &req.statbuf;
177
+ #if defined(_WIN32) || defined(__CYGWIN__) || defined(__MSYS__)
178
+ /*
179
+ * On Windows, chmod can only modify S_IWUSR (_S_IWRITE) bit,
180
+ * so only testing for the specified flags.
181
+ */
182
+ ASSERT((s->st_mode & 0777) & mode);
183
+ #else
184
+ ASSERT((s->st_mode & 0777) == mode);
185
+ #endif
186
+
187
+ uv_fs_req_cleanup(&req);
188
+ }
189
+
190
+
191
+ static void dummy_cb(uv_fs_t* req) {
192
+ (void) req;
193
+ dummy_cb_count++;
194
+ }
195
+
196
+
197
+ static void link_cb(uv_fs_t* req) {
198
+ ASSERT(req->fs_type == UV_FS_LINK);
199
+ ASSERT(req->result == 0);
200
+ link_cb_count++;
201
+ uv_fs_req_cleanup(req);
202
+ }
203
+
204
+
205
+ static void symlink_cb(uv_fs_t* req) {
206
+ ASSERT(req->fs_type == UV_FS_SYMLINK);
207
+ ASSERT(req->result == 0);
208
+ symlink_cb_count++;
209
+ uv_fs_req_cleanup(req);
210
+ }
211
+
212
+ static void readlink_cb(uv_fs_t* req) {
213
+ ASSERT(req->fs_type == UV_FS_READLINK);
214
+ ASSERT(req->result == 0);
215
+ ASSERT(strcmp(req->ptr, "test_file_symlink2") == 0);
216
+ readlink_cb_count++;
217
+ uv_fs_req_cleanup(req);
218
+ }
219
+
220
+
221
+ static void realpath_cb(uv_fs_t* req) {
222
+ char test_file_abs_buf[PATHMAX];
223
+ size_t test_file_abs_size = sizeof(test_file_abs_buf);
224
+ ASSERT(req->fs_type == UV_FS_REALPATH);
225
+ #ifdef _WIN32
226
+ /*
227
+ * Windows XP and Server 2003 don't support GetFinalPathNameByHandleW()
228
+ */
229
+ if (req->result == UV_ENOSYS) {
230
+ realpath_cb_count++;
231
+ uv_fs_req_cleanup(req);
232
+ return;
233
+ }
234
+ #endif
235
+ ASSERT(req->result == 0);
236
+
237
+ uv_cwd(test_file_abs_buf, &test_file_abs_size);
238
+ #ifdef _WIN32
239
+ strcat(test_file_abs_buf, "\\test_file");
240
+ ASSERT(stricmp(req->ptr, test_file_abs_buf) == 0);
241
+ #else
242
+ strcat(test_file_abs_buf, "/test_file");
243
+ ASSERT(strcmp(req->ptr, test_file_abs_buf) == 0);
244
+ #endif
245
+ realpath_cb_count++;
246
+ uv_fs_req_cleanup(req);
247
+ }
248
+
249
+
250
+ static void access_cb(uv_fs_t* req) {
251
+ ASSERT(req->fs_type == UV_FS_ACCESS);
252
+ access_cb_count++;
253
+ uv_fs_req_cleanup(req);
254
+ }
255
+
256
+
257
+ static void fchmod_cb(uv_fs_t* req) {
258
+ ASSERT(req->fs_type == UV_FS_FCHMOD);
259
+ ASSERT(req->result == 0);
260
+ fchmod_cb_count++;
261
+ uv_fs_req_cleanup(req);
262
+ check_permission("test_file", *(int*)req->data);
263
+ }
264
+
265
+
266
+ static void chmod_cb(uv_fs_t* req) {
267
+ ASSERT(req->fs_type == UV_FS_CHMOD);
268
+ ASSERT(req->result == 0);
269
+ chmod_cb_count++;
270
+ uv_fs_req_cleanup(req);
271
+ check_permission("test_file", *(int*)req->data);
272
+ }
273
+
274
+
275
+ static void fchown_cb(uv_fs_t* req) {
276
+ ASSERT(req->fs_type == UV_FS_FCHOWN);
277
+ ASSERT(req->result == 0);
278
+ fchown_cb_count++;
279
+ uv_fs_req_cleanup(req);
280
+ }
281
+
282
+
283
+ static void chown_cb(uv_fs_t* req) {
284
+ ASSERT(req->fs_type == UV_FS_CHOWN);
285
+ ASSERT(req->result == 0);
286
+ chown_cb_count++;
287
+ uv_fs_req_cleanup(req);
288
+ }
289
+
290
+ static void lchown_cb(uv_fs_t* req) {
291
+ ASSERT(req->fs_type == UV_FS_LCHOWN);
292
+ ASSERT(req->result == 0);
293
+ lchown_cb_count++;
294
+ uv_fs_req_cleanup(req);
295
+ }
296
+
297
+ static void chown_root_cb(uv_fs_t* req) {
298
+ ASSERT(req->fs_type == UV_FS_CHOWN);
299
+ #if defined(_WIN32) || defined(__MSYS__)
300
+ /* On windows, chown is a no-op and always succeeds. */
301
+ ASSERT(req->result == 0);
302
+ #else
303
+ /* On unix, chown'ing the root directory is not allowed -
304
+ * unless you're root, of course.
305
+ */
306
+ if (geteuid() == 0)
307
+ ASSERT(req->result == 0);
308
+ else
309
+ # if defined(__CYGWIN__)
310
+ /* On Cygwin, uid 0 is invalid (no root). */
311
+ ASSERT(req->result == UV_EINVAL);
312
+ # else
313
+ ASSERT(req->result == UV_EPERM);
314
+ # endif
315
+ #endif
316
+ chown_cb_count++;
317
+ uv_fs_req_cleanup(req);
318
+ }
319
+
320
+ static void unlink_cb(uv_fs_t* req) {
321
+ ASSERT(req == &unlink_req);
322
+ ASSERT(req->fs_type == UV_FS_UNLINK);
323
+ ASSERT(req->result == 0);
324
+ unlink_cb_count++;
325
+ uv_fs_req_cleanup(req);
326
+ }
327
+
328
+ static void fstat_cb(uv_fs_t* req) {
329
+ uv_stat_t* s = req->ptr;
330
+ ASSERT(req->fs_type == UV_FS_FSTAT);
331
+ ASSERT(req->result == 0);
332
+ ASSERT(s->st_size == sizeof(test_buf));
333
+ uv_fs_req_cleanup(req);
334
+ fstat_cb_count++;
335
+ }
336
+
337
+
338
+ static void statfs_cb(uv_fs_t* req) {
339
+ uv_statfs_t* stats;
340
+
341
+ ASSERT(req->fs_type == UV_FS_STATFS);
342
+ ASSERT(req->result == 0);
343
+ ASSERT(req->ptr != NULL);
344
+ stats = req->ptr;
345
+
346
+ #if defined(_WIN32) || defined(__sun) || defined(_AIX) || defined(__MVS__) || \
347
+ defined(__OpenBSD__) || defined(__NetBSD__)
348
+ ASSERT(stats->f_type == 0);
349
+ #else
350
+ ASSERT(stats->f_type > 0);
351
+ #endif
352
+
353
+ ASSERT(stats->f_bsize > 0);
354
+ ASSERT(stats->f_blocks > 0);
355
+ ASSERT(stats->f_bfree <= stats->f_blocks);
356
+ ASSERT(stats->f_bavail <= stats->f_bfree);
357
+
358
+ #ifdef _WIN32
359
+ ASSERT(stats->f_files == 0);
360
+ ASSERT(stats->f_ffree == 0);
361
+ #else
362
+ /* There is no assertion for stats->f_files that makes sense, so ignore it. */
363
+ ASSERT(stats->f_ffree <= stats->f_files);
364
+ #endif
365
+ uv_fs_req_cleanup(req);
366
+ ASSERT(req->ptr == NULL);
367
+ statfs_cb_count++;
368
+ }
369
+
370
+
371
+ static void close_cb(uv_fs_t* req) {
372
+ int r;
373
+ ASSERT(req == &close_req);
374
+ ASSERT(req->fs_type == UV_FS_CLOSE);
375
+ ASSERT(req->result == 0);
376
+ close_cb_count++;
377
+ uv_fs_req_cleanup(req);
378
+ if (close_cb_count == 3) {
379
+ r = uv_fs_unlink(loop, &unlink_req, "test_file2", unlink_cb);
380
+ ASSERT(r == 0);
381
+ }
382
+ }
383
+
384
+
385
+ static void ftruncate_cb(uv_fs_t* req) {
386
+ int r;
387
+ ASSERT(req == &ftruncate_req);
388
+ ASSERT(req->fs_type == UV_FS_FTRUNCATE);
389
+ ASSERT(req->result == 0);
390
+ ftruncate_cb_count++;
391
+ uv_fs_req_cleanup(req);
392
+ r = uv_fs_close(loop, &close_req, open_req1.result, close_cb);
393
+ ASSERT(r == 0);
394
+ }
395
+
396
+ static void fail_cb(uv_fs_t* req) {
397
+ FATAL("fail_cb should not have been called");
398
+ }
399
+
400
+ static void read_cb(uv_fs_t* req) {
401
+ int r;
402
+ ASSERT(req == &read_req);
403
+ ASSERT(req->fs_type == UV_FS_READ);
404
+ ASSERT(req->result >= 0); /* FIXME(bnoordhuis) Check if requested size? */
405
+ read_cb_count++;
406
+ uv_fs_req_cleanup(req);
407
+ if (read_cb_count == 1) {
408
+ ASSERT(strcmp(buf, test_buf) == 0);
409
+ r = uv_fs_ftruncate(loop, &ftruncate_req, open_req1.result, 7,
410
+ ftruncate_cb);
411
+ } else {
412
+ ASSERT(strcmp(buf, "test-bu") == 0);
413
+ r = uv_fs_close(loop, &close_req, open_req1.result, close_cb);
414
+ }
415
+ ASSERT(r == 0);
416
+ }
417
+
418
+
419
+ static void open_cb(uv_fs_t* req) {
420
+ int r;
421
+ ASSERT(req == &open_req1);
422
+ ASSERT(req->fs_type == UV_FS_OPEN);
423
+ if (req->result < 0) {
424
+ fprintf(stderr, "async open error: %d\n", (int) req->result);
425
+ ASSERT(0);
426
+ }
427
+ open_cb_count++;
428
+ ASSERT(req->path);
429
+ ASSERT(memcmp(req->path, "test_file2\0", 11) == 0);
430
+ uv_fs_req_cleanup(req);
431
+ memset(buf, 0, sizeof(buf));
432
+ iov = uv_buf_init(buf, sizeof(buf));
433
+ r = uv_fs_read(loop, &read_req, open_req1.result, &iov, 1, -1,
434
+ read_cb);
435
+ ASSERT(r == 0);
436
+ }
437
+
438
+
439
+ static void open_cb_simple(uv_fs_t* req) {
440
+ ASSERT(req->fs_type == UV_FS_OPEN);
441
+ if (req->result < 0) {
442
+ fprintf(stderr, "async open error: %d\n", (int) req->result);
443
+ ASSERT(0);
444
+ }
445
+ open_cb_count++;
446
+ ASSERT(req->path);
447
+ uv_fs_req_cleanup(req);
448
+ }
449
+
450
+
451
+ static void fsync_cb(uv_fs_t* req) {
452
+ int r;
453
+ ASSERT(req == &fsync_req);
454
+ ASSERT(req->fs_type == UV_FS_FSYNC);
455
+ ASSERT(req->result == 0);
456
+ fsync_cb_count++;
457
+ uv_fs_req_cleanup(req);
458
+ r = uv_fs_close(loop, &close_req, open_req1.result, close_cb);
459
+ ASSERT(r == 0);
460
+ }
461
+
462
+
463
+ static void fdatasync_cb(uv_fs_t* req) {
464
+ int r;
465
+ ASSERT(req == &fdatasync_req);
466
+ ASSERT(req->fs_type == UV_FS_FDATASYNC);
467
+ ASSERT(req->result == 0);
468
+ fdatasync_cb_count++;
469
+ uv_fs_req_cleanup(req);
470
+ r = uv_fs_fsync(loop, &fsync_req, open_req1.result, fsync_cb);
471
+ ASSERT(r == 0);
472
+ }
473
+
474
+
475
+ static void write_cb(uv_fs_t* req) {
476
+ int r;
477
+ ASSERT(req == &write_req);
478
+ ASSERT(req->fs_type == UV_FS_WRITE);
479
+ ASSERT(req->result >= 0); /* FIXME(bnoordhuis) Check if requested size? */
480
+ write_cb_count++;
481
+ uv_fs_req_cleanup(req);
482
+ r = uv_fs_fdatasync(loop, &fdatasync_req, open_req1.result, fdatasync_cb);
483
+ ASSERT(r == 0);
484
+ }
485
+
486
+
487
+ static void create_cb(uv_fs_t* req) {
488
+ int r;
489
+ ASSERT(req == &open_req1);
490
+ ASSERT(req->fs_type == UV_FS_OPEN);
491
+ ASSERT(req->result >= 0);
492
+ create_cb_count++;
493
+ uv_fs_req_cleanup(req);
494
+ iov = uv_buf_init(test_buf, sizeof(test_buf));
495
+ r = uv_fs_write(loop, &write_req, req->result, &iov, 1, -1, write_cb);
496
+ ASSERT(r == 0);
497
+ }
498
+
499
+
500
+ static void rename_cb(uv_fs_t* req) {
501
+ ASSERT(req == &rename_req);
502
+ ASSERT(req->fs_type == UV_FS_RENAME);
503
+ ASSERT(req->result == 0);
504
+ rename_cb_count++;
505
+ uv_fs_req_cleanup(req);
506
+ }
507
+
508
+
509
+ static void mkdir_cb(uv_fs_t* req) {
510
+ ASSERT(req == &mkdir_req);
511
+ ASSERT(req->fs_type == UV_FS_MKDIR);
512
+ ASSERT(req->result == 0);
513
+ mkdir_cb_count++;
514
+ ASSERT(req->path);
515
+ ASSERT(memcmp(req->path, "test_dir\0", 9) == 0);
516
+ uv_fs_req_cleanup(req);
517
+ }
518
+
519
+
520
+ static void check_mkdtemp_result(uv_fs_t* req) {
521
+ int r;
522
+
523
+ ASSERT(req->fs_type == UV_FS_MKDTEMP);
524
+ ASSERT(req->result == 0);
525
+ ASSERT(req->path);
526
+ ASSERT(strlen(req->path) == 15);
527
+ ASSERT(memcmp(req->path, "test_dir_", 9) == 0);
528
+ ASSERT(memcmp(req->path + 9, "XXXXXX", 6) != 0);
529
+ check_permission(req->path, 0700);
530
+
531
+ /* Check if req->path is actually a directory */
532
+ r = uv_fs_stat(NULL, &stat_req, req->path, NULL);
533
+ ASSERT(r == 0);
534
+ ASSERT(((uv_stat_t*)stat_req.ptr)->st_mode & S_IFDIR);
535
+ uv_fs_req_cleanup(&stat_req);
536
+ }
537
+
538
+
539
+ static void mkdtemp_cb(uv_fs_t* req) {
540
+ ASSERT(req == &mkdtemp_req1);
541
+ check_mkdtemp_result(req);
542
+ mkdtemp_cb_count++;
543
+ }
544
+
545
+
546
+ static void check_mkstemp_result(uv_fs_t* req) {
547
+ int r;
548
+
549
+ ASSERT(req->fs_type == UV_FS_MKSTEMP);
550
+ ASSERT(req->result >= 0);
551
+ ASSERT(req->path);
552
+ ASSERT(strlen(req->path) == 16);
553
+ ASSERT(memcmp(req->path, "test_file_", 10) == 0);
554
+ ASSERT(memcmp(req->path + 10, "XXXXXX", 6) != 0);
555
+ check_permission(req->path, 0600);
556
+
557
+ /* Check if req->path is actually a file */
558
+ r = uv_fs_stat(NULL, &stat_req, req->path, NULL);
559
+ ASSERT(r == 0);
560
+ ASSERT(stat_req.statbuf.st_mode & S_IFREG);
561
+ uv_fs_req_cleanup(&stat_req);
562
+ }
563
+
564
+
565
+ static void mkstemp_cb(uv_fs_t* req) {
566
+ ASSERT(req == &mkstemp_req1);
567
+ check_mkstemp_result(req);
568
+ mkstemp_cb_count++;
569
+ }
570
+
571
+
572
+ static void rmdir_cb(uv_fs_t* req) {
573
+ ASSERT(req == &rmdir_req);
574
+ ASSERT(req->fs_type == UV_FS_RMDIR);
575
+ ASSERT(req->result == 0);
576
+ rmdir_cb_count++;
577
+ ASSERT(req->path);
578
+ ASSERT(memcmp(req->path, "test_dir\0", 9) == 0);
579
+ uv_fs_req_cleanup(req);
580
+ }
581
+
582
+
583
+ static void assert_is_file_type(uv_dirent_t dent) {
584
+ #ifdef HAVE_DIRENT_TYPES
585
+ /*
586
+ * For Apple and Windows, we know getdents is expected to work but for other
587
+ * environments, the filesystem dictates whether or not getdents supports
588
+ * returning the file type.
589
+ *
590
+ * See:
591
+ * http://man7.org/linux/man-pages/man2/getdents.2.html
592
+ * https://github.com/libuv/libuv/issues/501
593
+ */
594
+ #if defined(__APPLE__) || defined(_WIN32)
595
+ ASSERT(dent.type == UV_DIRENT_FILE);
596
+ #else
597
+ ASSERT(dent.type == UV_DIRENT_FILE || dent.type == UV_DIRENT_UNKNOWN);
598
+ #endif
599
+ #else
600
+ ASSERT(dent.type == UV_DIRENT_UNKNOWN);
601
+ #endif
602
+ }
603
+
604
+
605
+ static void scandir_cb(uv_fs_t* req) {
606
+ uv_dirent_t dent;
607
+ ASSERT(req == &scandir_req);
608
+ ASSERT(req->fs_type == UV_FS_SCANDIR);
609
+ ASSERT(req->result == 2);
610
+ ASSERT(req->ptr);
611
+
612
+ while (UV_EOF != uv_fs_scandir_next(req, &dent)) {
613
+ ASSERT(strcmp(dent.name, "file1") == 0 || strcmp(dent.name, "file2") == 0);
614
+ assert_is_file_type(dent);
615
+ }
616
+ scandir_cb_count++;
617
+ ASSERT(req->path);
618
+ ASSERT(memcmp(req->path, "test_dir\0", 9) == 0);
619
+ uv_fs_req_cleanup(req);
620
+ ASSERT(!req->ptr);
621
+ }
622
+
623
+
624
+ static void empty_scandir_cb(uv_fs_t* req) {
625
+ uv_dirent_t dent;
626
+
627
+ ASSERT(req == &scandir_req);
628
+ ASSERT(req->fs_type == UV_FS_SCANDIR);
629
+ ASSERT(req->result == 0);
630
+ ASSERT(req->ptr == NULL);
631
+ ASSERT(UV_EOF == uv_fs_scandir_next(req, &dent));
632
+ uv_fs_req_cleanup(req);
633
+ scandir_cb_count++;
634
+ }
635
+
636
+ static void non_existent_scandir_cb(uv_fs_t* req) {
637
+ uv_dirent_t dent;
638
+
639
+ ASSERT(req == &scandir_req);
640
+ ASSERT(req->fs_type == UV_FS_SCANDIR);
641
+ ASSERT(req->result == UV_ENOENT);
642
+ ASSERT(req->ptr == NULL);
643
+ ASSERT(UV_ENOENT == uv_fs_scandir_next(req, &dent));
644
+ uv_fs_req_cleanup(req);
645
+ scandir_cb_count++;
646
+ }
647
+
648
+
649
+ static void file_scandir_cb(uv_fs_t* req) {
650
+ ASSERT(req == &scandir_req);
651
+ ASSERT(req->fs_type == UV_FS_SCANDIR);
652
+ ASSERT(req->result == UV_ENOTDIR);
653
+ ASSERT(req->ptr == NULL);
654
+ uv_fs_req_cleanup(req);
655
+ scandir_cb_count++;
656
+ }
657
+
658
+
659
+ static void stat_cb(uv_fs_t* req) {
660
+ ASSERT(req == &stat_req);
661
+ ASSERT(req->fs_type == UV_FS_STAT || req->fs_type == UV_FS_LSTAT);
662
+ ASSERT(req->result == 0);
663
+ ASSERT(req->ptr);
664
+ stat_cb_count++;
665
+ uv_fs_req_cleanup(req);
666
+ ASSERT(!req->ptr);
667
+ }
668
+
669
+
670
+ static void sendfile_cb(uv_fs_t* req) {
671
+ ASSERT(req == &sendfile_req);
672
+ ASSERT(req->fs_type == UV_FS_SENDFILE);
673
+ ASSERT(req->result == 65546);
674
+ sendfile_cb_count++;
675
+ uv_fs_req_cleanup(req);
676
+ }
677
+
678
+
679
+ static void sendfile_nodata_cb(uv_fs_t* req) {
680
+ ASSERT(req == &sendfile_req);
681
+ ASSERT(req->fs_type == UV_FS_SENDFILE);
682
+ ASSERT(req->result == 0);
683
+ sendfile_cb_count++;
684
+ uv_fs_req_cleanup(req);
685
+ }
686
+
687
+
688
+ static void open_noent_cb(uv_fs_t* req) {
689
+ ASSERT(req->fs_type == UV_FS_OPEN);
690
+ ASSERT(req->result == UV_ENOENT);
691
+ open_cb_count++;
692
+ uv_fs_req_cleanup(req);
693
+ }
694
+
695
+ static void open_nametoolong_cb(uv_fs_t* req) {
696
+ ASSERT(req->fs_type == UV_FS_OPEN);
697
+ ASSERT(req->result == UV_ENAMETOOLONG);
698
+ open_cb_count++;
699
+ uv_fs_req_cleanup(req);
700
+ }
701
+
702
+ static void open_loop_cb(uv_fs_t* req) {
703
+ ASSERT(req->fs_type == UV_FS_OPEN);
704
+ ASSERT(req->result == UV_ELOOP);
705
+ open_cb_count++;
706
+ uv_fs_req_cleanup(req);
707
+ }
708
+
709
+
710
+ TEST_IMPL(fs_file_noent) {
711
+ uv_fs_t req;
712
+ int r;
713
+
714
+ loop = uv_default_loop();
715
+
716
+ r = uv_fs_open(NULL, &req, "does_not_exist", O_RDONLY, 0, NULL);
717
+ ASSERT(r == UV_ENOENT);
718
+ ASSERT(req.result == UV_ENOENT);
719
+ uv_fs_req_cleanup(&req);
720
+
721
+ r = uv_fs_open(loop, &req, "does_not_exist", O_RDONLY, 0, open_noent_cb);
722
+ ASSERT(r == 0);
723
+
724
+ ASSERT(open_cb_count == 0);
725
+ uv_run(loop, UV_RUN_DEFAULT);
726
+ ASSERT(open_cb_count == 1);
727
+
728
+ /* TODO add EACCES test */
729
+
730
+ MAKE_VALGRIND_HAPPY();
731
+ return 0;
732
+ }
733
+
734
+ TEST_IMPL(fs_file_nametoolong) {
735
+ uv_fs_t req;
736
+ int r;
737
+ char name[TOO_LONG_NAME_LENGTH + 1];
738
+
739
+ loop = uv_default_loop();
740
+
741
+ memset(name, 'a', TOO_LONG_NAME_LENGTH);
742
+ name[TOO_LONG_NAME_LENGTH] = 0;
743
+
744
+ r = uv_fs_open(NULL, &req, name, O_RDONLY, 0, NULL);
745
+ ASSERT(r == UV_ENAMETOOLONG);
746
+ ASSERT(req.result == UV_ENAMETOOLONG);
747
+ uv_fs_req_cleanup(&req);
748
+
749
+ r = uv_fs_open(loop, &req, name, O_RDONLY, 0, open_nametoolong_cb);
750
+ ASSERT(r == 0);
751
+
752
+ ASSERT(open_cb_count == 0);
753
+ uv_run(loop, UV_RUN_DEFAULT);
754
+ ASSERT(open_cb_count == 1);
755
+
756
+ MAKE_VALGRIND_HAPPY();
757
+ return 0;
758
+ }
759
+
760
+ TEST_IMPL(fs_file_loop) {
761
+ uv_fs_t req;
762
+ int r;
763
+
764
+ loop = uv_default_loop();
765
+
766
+ unlink("test_symlink");
767
+ r = uv_fs_symlink(NULL, &req, "test_symlink", "test_symlink", 0, NULL);
768
+ #ifdef _WIN32
769
+ /*
770
+ * Windows XP and Server 2003 don't support symlinks; we'll get UV_ENOTSUP.
771
+ * Starting with vista they are supported, but only when elevated, otherwise
772
+ * we'll see UV_EPERM.
773
+ */
774
+ if (r == UV_ENOTSUP || r == UV_EPERM)
775
+ return 0;
776
+ #elif defined(__MSYS__)
777
+ /* MSYS2's approximation of symlinks with copies does not work for broken
778
+ links. */
779
+ if (r == UV_ENOENT)
780
+ return 0;
781
+ #endif
782
+ ASSERT(r == 0);
783
+ uv_fs_req_cleanup(&req);
784
+
785
+ r = uv_fs_open(NULL, &req, "test_symlink", O_RDONLY, 0, NULL);
786
+ ASSERT(r == UV_ELOOP);
787
+ ASSERT(req.result == UV_ELOOP);
788
+ uv_fs_req_cleanup(&req);
789
+
790
+ r = uv_fs_open(loop, &req, "test_symlink", O_RDONLY, 0, open_loop_cb);
791
+ ASSERT(r == 0);
792
+
793
+ ASSERT(open_cb_count == 0);
794
+ uv_run(loop, UV_RUN_DEFAULT);
795
+ ASSERT(open_cb_count == 1);
796
+
797
+ unlink("test_symlink");
798
+
799
+ MAKE_VALGRIND_HAPPY();
800
+ return 0;
801
+ }
802
+
803
+ static void check_utime(const char* path, double atime, double mtime) {
804
+ uv_stat_t* s;
805
+ uv_fs_t req;
806
+ int r;
807
+
808
+ r = uv_fs_stat(loop, &req, path, NULL);
809
+ ASSERT(r == 0);
810
+
811
+ ASSERT(req.result == 0);
812
+ s = &req.statbuf;
813
+
814
+ ASSERT(s->st_atim.tv_sec + (s->st_atim.tv_nsec / 1000000000.0) == atime);
815
+ ASSERT(s->st_mtim.tv_sec + (s->st_mtim.tv_nsec / 1000000000.0) == mtime);
816
+
817
+ uv_fs_req_cleanup(&req);
818
+ }
819
+
820
+
821
+ static void utime_cb(uv_fs_t* req) {
822
+ utime_check_t* c;
823
+
824
+ ASSERT(req == &utime_req);
825
+ ASSERT(req->result == 0);
826
+ ASSERT(req->fs_type == UV_FS_UTIME);
827
+
828
+ c = req->data;
829
+ check_utime(c->path, c->atime, c->mtime);
830
+
831
+ uv_fs_req_cleanup(req);
832
+ utime_cb_count++;
833
+ }
834
+
835
+
836
+ static void futime_cb(uv_fs_t* req) {
837
+ utime_check_t* c;
838
+
839
+ ASSERT(req == &futime_req);
840
+ ASSERT(req->result == 0);
841
+ ASSERT(req->fs_type == UV_FS_FUTIME);
842
+
843
+ c = req->data;
844
+ check_utime(c->path, c->atime, c->mtime);
845
+
846
+ uv_fs_req_cleanup(req);
847
+ futime_cb_count++;
848
+ }
849
+
850
+
851
+ TEST_IMPL(fs_file_async) {
852
+ int r;
853
+
854
+ /* Setup. */
855
+ unlink("test_file");
856
+ unlink("test_file2");
857
+
858
+ loop = uv_default_loop();
859
+
860
+ r = uv_fs_open(loop, &open_req1, "test_file", O_WRONLY | O_CREAT,
861
+ S_IRUSR | S_IWUSR, create_cb);
862
+ ASSERT(r == 0);
863
+ uv_run(loop, UV_RUN_DEFAULT);
864
+
865
+ ASSERT(create_cb_count == 1);
866
+ ASSERT(write_cb_count == 1);
867
+ ASSERT(fsync_cb_count == 1);
868
+ ASSERT(fdatasync_cb_count == 1);
869
+ ASSERT(close_cb_count == 1);
870
+
871
+ r = uv_fs_rename(loop, &rename_req, "test_file", "test_file2", rename_cb);
872
+ ASSERT(r == 0);
873
+
874
+ uv_run(loop, UV_RUN_DEFAULT);
875
+ ASSERT(create_cb_count == 1);
876
+ ASSERT(write_cb_count == 1);
877
+ ASSERT(close_cb_count == 1);
878
+ ASSERT(rename_cb_count == 1);
879
+
880
+ r = uv_fs_open(loop, &open_req1, "test_file2", O_RDWR, 0, open_cb);
881
+ ASSERT(r == 0);
882
+
883
+ uv_run(loop, UV_RUN_DEFAULT);
884
+ ASSERT(open_cb_count == 1);
885
+ ASSERT(read_cb_count == 1);
886
+ ASSERT(close_cb_count == 2);
887
+ ASSERT(rename_cb_count == 1);
888
+ ASSERT(create_cb_count == 1);
889
+ ASSERT(write_cb_count == 1);
890
+ ASSERT(ftruncate_cb_count == 1);
891
+
892
+ r = uv_fs_open(loop, &open_req1, "test_file2", O_RDONLY, 0, open_cb);
893
+ ASSERT(r == 0);
894
+
895
+ uv_run(loop, UV_RUN_DEFAULT);
896
+ ASSERT(open_cb_count == 2);
897
+ ASSERT(read_cb_count == 2);
898
+ ASSERT(close_cb_count == 3);
899
+ ASSERT(rename_cb_count == 1);
900
+ ASSERT(unlink_cb_count == 1);
901
+ ASSERT(create_cb_count == 1);
902
+ ASSERT(write_cb_count == 1);
903
+ ASSERT(ftruncate_cb_count == 1);
904
+
905
+ /* Cleanup. */
906
+ unlink("test_file");
907
+ unlink("test_file2");
908
+
909
+ MAKE_VALGRIND_HAPPY();
910
+ return 0;
911
+ }
912
+
913
+
914
+ static void fs_file_sync(int add_flags) {
915
+ int r;
916
+
917
+ /* Setup. */
918
+ unlink("test_file");
919
+ unlink("test_file2");
920
+
921
+ loop = uv_default_loop();
922
+
923
+ r = uv_fs_open(loop, &open_req1, "test_file",
924
+ O_WRONLY | O_CREAT | add_flags, S_IWUSR | S_IRUSR, NULL);
925
+ ASSERT(r >= 0);
926
+ ASSERT(open_req1.result >= 0);
927
+ uv_fs_req_cleanup(&open_req1);
928
+
929
+ iov = uv_buf_init(test_buf, sizeof(test_buf));
930
+ r = uv_fs_write(NULL, &write_req, open_req1.result, &iov, 1, -1, NULL);
931
+ ASSERT(r >= 0);
932
+ ASSERT(write_req.result >= 0);
933
+ uv_fs_req_cleanup(&write_req);
934
+
935
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
936
+ ASSERT(r == 0);
937
+ ASSERT(close_req.result == 0);
938
+ uv_fs_req_cleanup(&close_req);
939
+
940
+ r = uv_fs_open(NULL, &open_req1, "test_file", O_RDWR | add_flags, 0, NULL);
941
+ ASSERT(r >= 0);
942
+ ASSERT(open_req1.result >= 0);
943
+ uv_fs_req_cleanup(&open_req1);
944
+
945
+ iov = uv_buf_init(buf, sizeof(buf));
946
+ r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, -1, NULL);
947
+ ASSERT(r >= 0);
948
+ ASSERT(read_req.result >= 0);
949
+ ASSERT(strcmp(buf, test_buf) == 0);
950
+ uv_fs_req_cleanup(&read_req);
951
+
952
+ r = uv_fs_ftruncate(NULL, &ftruncate_req, open_req1.result, 7, NULL);
953
+ ASSERT(r == 0);
954
+ ASSERT(ftruncate_req.result == 0);
955
+ uv_fs_req_cleanup(&ftruncate_req);
956
+
957
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
958
+ ASSERT(r == 0);
959
+ ASSERT(close_req.result == 0);
960
+ uv_fs_req_cleanup(&close_req);
961
+
962
+ r = uv_fs_rename(NULL, &rename_req, "test_file", "test_file2", NULL);
963
+ ASSERT(r == 0);
964
+ ASSERT(rename_req.result == 0);
965
+ uv_fs_req_cleanup(&rename_req);
966
+
967
+ r = uv_fs_open(NULL, &open_req1, "test_file2", O_RDONLY | add_flags, 0,
968
+ NULL);
969
+ ASSERT(r >= 0);
970
+ ASSERT(open_req1.result >= 0);
971
+ uv_fs_req_cleanup(&open_req1);
972
+
973
+ memset(buf, 0, sizeof(buf));
974
+ iov = uv_buf_init(buf, sizeof(buf));
975
+ r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, -1, NULL);
976
+ ASSERT(r >= 0);
977
+ ASSERT(read_req.result >= 0);
978
+ ASSERT(strcmp(buf, "test-bu") == 0);
979
+ uv_fs_req_cleanup(&read_req);
980
+
981
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
982
+ ASSERT(r == 0);
983
+ ASSERT(close_req.result == 0);
984
+ uv_fs_req_cleanup(&close_req);
985
+
986
+ r = uv_fs_unlink(NULL, &unlink_req, "test_file2", NULL);
987
+ ASSERT(r == 0);
988
+ ASSERT(unlink_req.result == 0);
989
+ uv_fs_req_cleanup(&unlink_req);
990
+
991
+ /* Cleanup */
992
+ unlink("test_file");
993
+ unlink("test_file2");
994
+ }
995
+ TEST_IMPL(fs_file_sync) {
996
+ fs_file_sync(0);
997
+ fs_file_sync(UV_FS_O_FILEMAP);
998
+
999
+ MAKE_VALGRIND_HAPPY();
1000
+ return 0;
1001
+ }
1002
+
1003
+
1004
+ static void fs_file_write_null_buffer(int add_flags) {
1005
+ int r;
1006
+
1007
+ /* Setup. */
1008
+ unlink("test_file");
1009
+
1010
+ loop = uv_default_loop();
1011
+
1012
+ r = uv_fs_open(NULL, &open_req1, "test_file",
1013
+ O_WRONLY | O_CREAT | add_flags, S_IWUSR | S_IRUSR, NULL);
1014
+ ASSERT(r >= 0);
1015
+ ASSERT(open_req1.result >= 0);
1016
+ uv_fs_req_cleanup(&open_req1);
1017
+
1018
+ iov = uv_buf_init(NULL, 0);
1019
+ r = uv_fs_write(NULL, &write_req, open_req1.result, &iov, 1, -1, NULL);
1020
+ ASSERT(r == 0);
1021
+ ASSERT(write_req.result == 0);
1022
+ uv_fs_req_cleanup(&write_req);
1023
+
1024
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
1025
+ ASSERT(r == 0);
1026
+ ASSERT(close_req.result == 0);
1027
+ uv_fs_req_cleanup(&close_req);
1028
+
1029
+ unlink("test_file");
1030
+ }
1031
+ TEST_IMPL(fs_file_write_null_buffer) {
1032
+ fs_file_write_null_buffer(0);
1033
+ fs_file_write_null_buffer(UV_FS_O_FILEMAP);
1034
+
1035
+ MAKE_VALGRIND_HAPPY();
1036
+ return 0;
1037
+ }
1038
+
1039
+
1040
+ TEST_IMPL(fs_async_dir) {
1041
+ int r;
1042
+ uv_dirent_t dent;
1043
+
1044
+ /* Setup */
1045
+ unlink("test_dir/file1");
1046
+ unlink("test_dir/file2");
1047
+ rmdir("test_dir");
1048
+
1049
+ loop = uv_default_loop();
1050
+
1051
+ r = uv_fs_mkdir(loop, &mkdir_req, "test_dir", 0755, mkdir_cb);
1052
+ ASSERT(r == 0);
1053
+
1054
+ uv_run(loop, UV_RUN_DEFAULT);
1055
+ ASSERT(mkdir_cb_count == 1);
1056
+
1057
+ /* Create 2 files synchronously. */
1058
+ r = uv_fs_open(NULL, &open_req1, "test_dir/file1", O_WRONLY | O_CREAT,
1059
+ S_IWUSR | S_IRUSR, NULL);
1060
+ ASSERT(r >= 0);
1061
+ uv_fs_req_cleanup(&open_req1);
1062
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
1063
+ ASSERT(r == 0);
1064
+ uv_fs_req_cleanup(&close_req);
1065
+
1066
+ r = uv_fs_open(NULL, &open_req1, "test_dir/file2", O_WRONLY | O_CREAT,
1067
+ S_IWUSR | S_IRUSR, NULL);
1068
+ ASSERT(r >= 0);
1069
+ uv_fs_req_cleanup(&open_req1);
1070
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
1071
+ ASSERT(r == 0);
1072
+ uv_fs_req_cleanup(&close_req);
1073
+
1074
+ r = uv_fs_scandir(loop, &scandir_req, "test_dir", 0, scandir_cb);
1075
+ ASSERT(r == 0);
1076
+
1077
+ uv_run(loop, UV_RUN_DEFAULT);
1078
+ ASSERT(scandir_cb_count == 1);
1079
+
1080
+ /* sync uv_fs_scandir */
1081
+ r = uv_fs_scandir(NULL, &scandir_req, "test_dir", 0, NULL);
1082
+ ASSERT(r == 2);
1083
+ ASSERT(scandir_req.result == 2);
1084
+ ASSERT(scandir_req.ptr);
1085
+ while (UV_EOF != uv_fs_scandir_next(&scandir_req, &dent)) {
1086
+ ASSERT(strcmp(dent.name, "file1") == 0 || strcmp(dent.name, "file2") == 0);
1087
+ assert_is_file_type(dent);
1088
+ }
1089
+ uv_fs_req_cleanup(&scandir_req);
1090
+ ASSERT(!scandir_req.ptr);
1091
+
1092
+ r = uv_fs_stat(loop, &stat_req, "test_dir", stat_cb);
1093
+ ASSERT(r == 0);
1094
+ uv_run(loop, UV_RUN_DEFAULT);
1095
+
1096
+ r = uv_fs_stat(loop, &stat_req, "test_dir/", stat_cb);
1097
+ ASSERT(r == 0);
1098
+ uv_run(loop, UV_RUN_DEFAULT);
1099
+
1100
+ r = uv_fs_lstat(loop, &stat_req, "test_dir", stat_cb);
1101
+ ASSERT(r == 0);
1102
+ uv_run(loop, UV_RUN_DEFAULT);
1103
+
1104
+ r = uv_fs_lstat(loop, &stat_req, "test_dir/", stat_cb);
1105
+ ASSERT(r == 0);
1106
+ uv_run(loop, UV_RUN_DEFAULT);
1107
+
1108
+ ASSERT(stat_cb_count == 4);
1109
+
1110
+ r = uv_fs_unlink(loop, &unlink_req, "test_dir/file1", unlink_cb);
1111
+ ASSERT(r == 0);
1112
+ uv_run(loop, UV_RUN_DEFAULT);
1113
+ ASSERT(unlink_cb_count == 1);
1114
+
1115
+ r = uv_fs_unlink(loop, &unlink_req, "test_dir/file2", unlink_cb);
1116
+ ASSERT(r == 0);
1117
+ uv_run(loop, UV_RUN_DEFAULT);
1118
+ ASSERT(unlink_cb_count == 2);
1119
+
1120
+ r = uv_fs_rmdir(loop, &rmdir_req, "test_dir", rmdir_cb);
1121
+ ASSERT(r == 0);
1122
+ uv_run(loop, UV_RUN_DEFAULT);
1123
+ ASSERT(rmdir_cb_count == 1);
1124
+
1125
+ /* Cleanup */
1126
+ unlink("test_dir/file1");
1127
+ unlink("test_dir/file2");
1128
+ rmdir("test_dir");
1129
+
1130
+ MAKE_VALGRIND_HAPPY();
1131
+ return 0;
1132
+ }
1133
+
1134
+
1135
+ static int test_sendfile(void (*setup)(int), uv_fs_cb cb, off_t expected_size) {
1136
+ int f, r;
1137
+ struct stat s1, s2;
1138
+
1139
+ loop = uv_default_loop();
1140
+
1141
+ /* Setup. */
1142
+ unlink("test_file");
1143
+ unlink("test_file2");
1144
+
1145
+ f = open("test_file", O_WRONLY | O_CREAT, S_IWUSR | S_IRUSR);
1146
+ ASSERT(f != -1);
1147
+
1148
+ if (setup != NULL)
1149
+ setup(f);
1150
+
1151
+ r = close(f);
1152
+ ASSERT(r == 0);
1153
+
1154
+ /* Test starts here. */
1155
+ r = uv_fs_open(NULL, &open_req1, "test_file", O_RDWR, 0, NULL);
1156
+ ASSERT(r >= 0);
1157
+ ASSERT(open_req1.result >= 0);
1158
+ uv_fs_req_cleanup(&open_req1);
1159
+
1160
+ r = uv_fs_open(NULL, &open_req2, "test_file2", O_WRONLY | O_CREAT,
1161
+ S_IWUSR | S_IRUSR, NULL);
1162
+ ASSERT(r >= 0);
1163
+ ASSERT(open_req2.result >= 0);
1164
+ uv_fs_req_cleanup(&open_req2);
1165
+
1166
+ r = uv_fs_sendfile(loop, &sendfile_req, open_req2.result, open_req1.result,
1167
+ 0, 131072, cb);
1168
+ ASSERT(r == 0);
1169
+ uv_run(loop, UV_RUN_DEFAULT);
1170
+
1171
+ ASSERT(sendfile_cb_count == 1);
1172
+
1173
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
1174
+ ASSERT(r == 0);
1175
+ uv_fs_req_cleanup(&close_req);
1176
+ r = uv_fs_close(NULL, &close_req, open_req2.result, NULL);
1177
+ ASSERT(r == 0);
1178
+ uv_fs_req_cleanup(&close_req);
1179
+
1180
+ ASSERT(0 == stat("test_file", &s1));
1181
+ ASSERT(0 == stat("test_file2", &s2));
1182
+ ASSERT(s1.st_size == s2.st_size);
1183
+ ASSERT(s2.st_size == expected_size);
1184
+
1185
+ /* Cleanup. */
1186
+ unlink("test_file");
1187
+ unlink("test_file2");
1188
+
1189
+ MAKE_VALGRIND_HAPPY();
1190
+ return 0;
1191
+ }
1192
+
1193
+
1194
+ static void sendfile_setup(int f) {
1195
+ ASSERT(6 == write(f, "begin\n", 6));
1196
+ ASSERT(65542 == lseek(f, 65536, SEEK_CUR));
1197
+ ASSERT(4 == write(f, "end\n", 4));
1198
+ }
1199
+
1200
+
1201
+ TEST_IMPL(fs_async_sendfile) {
1202
+ return test_sendfile(sendfile_setup, sendfile_cb, 65546);
1203
+ }
1204
+
1205
+
1206
+ TEST_IMPL(fs_async_sendfile_nodata) {
1207
+ return test_sendfile(NULL, sendfile_nodata_cb, 0);
1208
+ }
1209
+
1210
+
1211
+ TEST_IMPL(fs_mkdtemp) {
1212
+ int r;
1213
+ const char* path_template = "test_dir_XXXXXX";
1214
+
1215
+ loop = uv_default_loop();
1216
+
1217
+ r = uv_fs_mkdtemp(loop, &mkdtemp_req1, path_template, mkdtemp_cb);
1218
+ ASSERT(r == 0);
1219
+
1220
+ uv_run(loop, UV_RUN_DEFAULT);
1221
+ ASSERT(mkdtemp_cb_count == 1);
1222
+
1223
+ /* sync mkdtemp */
1224
+ r = uv_fs_mkdtemp(NULL, &mkdtemp_req2, path_template, NULL);
1225
+ ASSERT(r == 0);
1226
+ check_mkdtemp_result(&mkdtemp_req2);
1227
+
1228
+ /* mkdtemp return different values on subsequent calls */
1229
+ ASSERT(strcmp(mkdtemp_req1.path, mkdtemp_req2.path) != 0);
1230
+
1231
+ /* Cleanup */
1232
+ rmdir(mkdtemp_req1.path);
1233
+ rmdir(mkdtemp_req2.path);
1234
+ uv_fs_req_cleanup(&mkdtemp_req1);
1235
+ uv_fs_req_cleanup(&mkdtemp_req2);
1236
+
1237
+ MAKE_VALGRIND_HAPPY();
1238
+ return 0;
1239
+ }
1240
+
1241
+
1242
+ TEST_IMPL(fs_mkstemp) {
1243
+ int r;
1244
+ int fd;
1245
+ const char path_template[] = "test_file_XXXXXX";
1246
+ uv_fs_t req;
1247
+
1248
+ loop = uv_default_loop();
1249
+
1250
+ r = uv_fs_mkstemp(loop, &mkstemp_req1, path_template, mkstemp_cb);
1251
+ ASSERT(r == 0);
1252
+
1253
+ uv_run(loop, UV_RUN_DEFAULT);
1254
+ ASSERT(mkstemp_cb_count == 1);
1255
+
1256
+ /* sync mkstemp */
1257
+ r = uv_fs_mkstemp(NULL, &mkstemp_req2, path_template, NULL);
1258
+ ASSERT(r >= 0);
1259
+ check_mkstemp_result(&mkstemp_req2);
1260
+
1261
+ /* mkstemp return different values on subsequent calls */
1262
+ ASSERT(strcmp(mkstemp_req1.path, mkstemp_req2.path) != 0);
1263
+
1264
+ /* invalid template returns EINVAL */
1265
+ ASSERT(uv_fs_mkstemp(NULL, &mkstemp_req3, "test_file", NULL) == UV_EINVAL);
1266
+
1267
+ /* We can write to the opened file */
1268
+ iov = uv_buf_init(test_buf, sizeof(test_buf));
1269
+ r = uv_fs_write(NULL, &req, mkstemp_req1.result, &iov, 1, -1, NULL);
1270
+ ASSERT(r == sizeof(test_buf));
1271
+ ASSERT(req.result == sizeof(test_buf));
1272
+ uv_fs_req_cleanup(&req);
1273
+
1274
+ /* Cleanup */
1275
+ uv_fs_close(NULL, &req, mkstemp_req1.result, NULL);
1276
+ uv_fs_req_cleanup(&req);
1277
+ uv_fs_close(NULL, &req, mkstemp_req2.result, NULL);
1278
+ uv_fs_req_cleanup(&req);
1279
+
1280
+ fd = uv_fs_open(NULL, &req, mkstemp_req1.path , O_RDONLY, 0, NULL);
1281
+ ASSERT(fd >= 0);
1282
+ uv_fs_req_cleanup(&req);
1283
+
1284
+ memset(buf, 0, sizeof(buf));
1285
+ iov = uv_buf_init(buf, sizeof(buf));
1286
+ r = uv_fs_read(NULL, &req, fd, &iov, 1, -1, NULL);
1287
+ ASSERT(r >= 0);
1288
+ ASSERT(req.result >= 0);
1289
+ ASSERT(strcmp(buf, test_buf) == 0);
1290
+ uv_fs_req_cleanup(&req);
1291
+
1292
+ uv_fs_close(NULL, &req, fd, NULL);
1293
+ uv_fs_req_cleanup(&req);
1294
+
1295
+ unlink(mkstemp_req1.path);
1296
+ unlink(mkstemp_req2.path);
1297
+ uv_fs_req_cleanup(&mkstemp_req1);
1298
+ uv_fs_req_cleanup(&mkstemp_req2);
1299
+
1300
+ MAKE_VALGRIND_HAPPY();
1301
+ return 0;
1302
+ }
1303
+
1304
+
1305
+ TEST_IMPL(fs_fstat) {
1306
+ int r;
1307
+ uv_fs_t req;
1308
+ uv_file file;
1309
+ uv_stat_t* s;
1310
+ #ifndef _WIN32
1311
+ struct stat t;
1312
+ #endif
1313
+
1314
+ /* Setup. */
1315
+ unlink("test_file");
1316
+
1317
+ loop = uv_default_loop();
1318
+
1319
+ r = uv_fs_open(NULL, &req, "test_file", O_RDWR | O_CREAT,
1320
+ S_IWUSR | S_IRUSR, NULL);
1321
+ ASSERT(r >= 0);
1322
+ ASSERT(req.result >= 0);
1323
+ file = req.result;
1324
+ uv_fs_req_cleanup(&req);
1325
+
1326
+ #ifndef _WIN32
1327
+ ASSERT(0 == fstat(file, &t));
1328
+ ASSERT(0 == uv_fs_fstat(NULL, &req, file, NULL));
1329
+ ASSERT(req.result == 0);
1330
+ s = req.ptr;
1331
+ # if defined(__APPLE__)
1332
+ ASSERT(s->st_birthtim.tv_sec == t.st_birthtimespec.tv_sec);
1333
+ ASSERT(s->st_birthtim.tv_nsec == t.st_birthtimespec.tv_nsec);
1334
+ # elif defined(__linux__)
1335
+ /* If statx() is supported, the birth time should be equal to the change time
1336
+ * because we just created the file. On older kernels, it's set to zero.
1337
+ */
1338
+ ASSERT(s->st_birthtim.tv_sec == 0 ||
1339
+ s->st_birthtim.tv_sec == t.st_ctim.tv_sec);
1340
+ ASSERT(s->st_birthtim.tv_nsec == 0 ||
1341
+ s->st_birthtim.tv_nsec == t.st_ctim.tv_nsec);
1342
+ # endif
1343
+ #endif
1344
+
1345
+ iov = uv_buf_init(test_buf, sizeof(test_buf));
1346
+ r = uv_fs_write(NULL, &req, file, &iov, 1, -1, NULL);
1347
+ ASSERT(r == sizeof(test_buf));
1348
+ ASSERT(req.result == sizeof(test_buf));
1349
+ uv_fs_req_cleanup(&req);
1350
+
1351
+ memset(&req.statbuf, 0xaa, sizeof(req.statbuf));
1352
+ r = uv_fs_fstat(NULL, &req, file, NULL);
1353
+ ASSERT(r == 0);
1354
+ ASSERT(req.result == 0);
1355
+ s = req.ptr;
1356
+ ASSERT(s->st_size == sizeof(test_buf));
1357
+
1358
+ #ifndef _WIN32
1359
+ r = fstat(file, &t);
1360
+ ASSERT(r == 0);
1361
+
1362
+ ASSERT(s->st_dev == (uint64_t) t.st_dev);
1363
+ ASSERT(s->st_mode == (uint64_t) t.st_mode);
1364
+ ASSERT(s->st_nlink == (uint64_t) t.st_nlink);
1365
+ ASSERT(s->st_uid == (uint64_t) t.st_uid);
1366
+ ASSERT(s->st_gid == (uint64_t) t.st_gid);
1367
+ ASSERT(s->st_rdev == (uint64_t) t.st_rdev);
1368
+ ASSERT(s->st_ino == (uint64_t) t.st_ino);
1369
+ ASSERT(s->st_size == (uint64_t) t.st_size);
1370
+ ASSERT(s->st_blksize == (uint64_t) t.st_blksize);
1371
+ ASSERT(s->st_blocks == (uint64_t) t.st_blocks);
1372
+ #if defined(__APPLE__)
1373
+ ASSERT(s->st_atim.tv_sec == t.st_atimespec.tv_sec);
1374
+ ASSERT(s->st_atim.tv_nsec == t.st_atimespec.tv_nsec);
1375
+ ASSERT(s->st_mtim.tv_sec == t.st_mtimespec.tv_sec);
1376
+ ASSERT(s->st_mtim.tv_nsec == t.st_mtimespec.tv_nsec);
1377
+ ASSERT(s->st_ctim.tv_sec == t.st_ctimespec.tv_sec);
1378
+ ASSERT(s->st_ctim.tv_nsec == t.st_ctimespec.tv_nsec);
1379
+ #elif defined(_AIX)
1380
+ ASSERT(s->st_atim.tv_sec == t.st_atime);
1381
+ ASSERT(s->st_atim.tv_nsec == 0);
1382
+ ASSERT(s->st_mtim.tv_sec == t.st_mtime);
1383
+ ASSERT(s->st_mtim.tv_nsec == 0);
1384
+ ASSERT(s->st_ctim.tv_sec == t.st_ctime);
1385
+ ASSERT(s->st_ctim.tv_nsec == 0);
1386
+ #elif defined(__ANDROID__)
1387
+ ASSERT(s->st_atim.tv_sec == t.st_atime);
1388
+ ASSERT(s->st_atim.tv_nsec == t.st_atimensec);
1389
+ ASSERT(s->st_mtim.tv_sec == t.st_mtime);
1390
+ ASSERT(s->st_mtim.tv_nsec == t.st_mtimensec);
1391
+ ASSERT(s->st_ctim.tv_sec == t.st_ctime);
1392
+ ASSERT(s->st_ctim.tv_nsec == t.st_ctimensec);
1393
+ #elif defined(__sun) || \
1394
+ defined(__DragonFly__) || \
1395
+ defined(__FreeBSD__) || \
1396
+ defined(__OpenBSD__) || \
1397
+ defined(__NetBSD__) || \
1398
+ defined(_GNU_SOURCE) || \
1399
+ defined(_BSD_SOURCE) || \
1400
+ defined(_SVID_SOURCE) || \
1401
+ defined(_XOPEN_SOURCE) || \
1402
+ defined(_DEFAULT_SOURCE)
1403
+ ASSERT(s->st_atim.tv_sec == t.st_atim.tv_sec);
1404
+ ASSERT(s->st_atim.tv_nsec == t.st_atim.tv_nsec);
1405
+ ASSERT(s->st_mtim.tv_sec == t.st_mtim.tv_sec);
1406
+ ASSERT(s->st_mtim.tv_nsec == t.st_mtim.tv_nsec);
1407
+ ASSERT(s->st_ctim.tv_sec == t.st_ctim.tv_sec);
1408
+ ASSERT(s->st_ctim.tv_nsec == t.st_ctim.tv_nsec);
1409
+ # if defined(__FreeBSD__) || \
1410
+ defined(__NetBSD__)
1411
+ ASSERT(s->st_birthtim.tv_sec == t.st_birthtim.tv_sec);
1412
+ ASSERT(s->st_birthtim.tv_nsec == t.st_birthtim.tv_nsec);
1413
+ # endif
1414
+ #else
1415
+ ASSERT(s->st_atim.tv_sec == t.st_atime);
1416
+ ASSERT(s->st_atim.tv_nsec == 0);
1417
+ ASSERT(s->st_mtim.tv_sec == t.st_mtime);
1418
+ ASSERT(s->st_mtim.tv_nsec == 0);
1419
+ ASSERT(s->st_ctim.tv_sec == t.st_ctime);
1420
+ ASSERT(s->st_ctim.tv_nsec == 0);
1421
+ #endif
1422
+ #endif
1423
+
1424
+ #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__)
1425
+ ASSERT(s->st_flags == t.st_flags);
1426
+ ASSERT(s->st_gen == t.st_gen);
1427
+ #else
1428
+ ASSERT(s->st_flags == 0);
1429
+ ASSERT(s->st_gen == 0);
1430
+ #endif
1431
+
1432
+ uv_fs_req_cleanup(&req);
1433
+
1434
+ /* Now do the uv_fs_fstat call asynchronously */
1435
+ r = uv_fs_fstat(loop, &req, file, fstat_cb);
1436
+ ASSERT(r == 0);
1437
+ uv_run(loop, UV_RUN_DEFAULT);
1438
+ ASSERT(fstat_cb_count == 1);
1439
+
1440
+
1441
+ r = uv_fs_close(NULL, &req, file, NULL);
1442
+ ASSERT(r == 0);
1443
+ ASSERT(req.result == 0);
1444
+ uv_fs_req_cleanup(&req);
1445
+
1446
+ /*
1447
+ * Run the loop just to check we don't have make any extraneous uv_ref()
1448
+ * calls. This should drop out immediately.
1449
+ */
1450
+ uv_run(loop, UV_RUN_DEFAULT);
1451
+
1452
+ /* Cleanup. */
1453
+ unlink("test_file");
1454
+
1455
+ MAKE_VALGRIND_HAPPY();
1456
+ return 0;
1457
+ }
1458
+
1459
+
1460
+ TEST_IMPL(fs_access) {
1461
+ int r;
1462
+ uv_fs_t req;
1463
+ uv_file file;
1464
+
1465
+ /* Setup. */
1466
+ unlink("test_file");
1467
+ rmdir("test_dir");
1468
+
1469
+ loop = uv_default_loop();
1470
+
1471
+ /* File should not exist */
1472
+ r = uv_fs_access(NULL, &req, "test_file", F_OK, NULL);
1473
+ ASSERT(r < 0);
1474
+ ASSERT(req.result < 0);
1475
+ uv_fs_req_cleanup(&req);
1476
+
1477
+ /* File should not exist */
1478
+ r = uv_fs_access(loop, &req, "test_file", F_OK, access_cb);
1479
+ ASSERT(r == 0);
1480
+ uv_run(loop, UV_RUN_DEFAULT);
1481
+ ASSERT(access_cb_count == 1);
1482
+ access_cb_count = 0; /* reset for the next test */
1483
+
1484
+ /* Create file */
1485
+ r = uv_fs_open(NULL, &req, "test_file", O_RDWR | O_CREAT,
1486
+ S_IWUSR | S_IRUSR, NULL);
1487
+ ASSERT(r >= 0);
1488
+ ASSERT(req.result >= 0);
1489
+ file = req.result;
1490
+ uv_fs_req_cleanup(&req);
1491
+
1492
+ /* File should exist */
1493
+ r = uv_fs_access(NULL, &req, "test_file", F_OK, NULL);
1494
+ ASSERT(r == 0);
1495
+ ASSERT(req.result == 0);
1496
+ uv_fs_req_cleanup(&req);
1497
+
1498
+ /* File should exist */
1499
+ r = uv_fs_access(loop, &req, "test_file", F_OK, access_cb);
1500
+ ASSERT(r == 0);
1501
+ uv_run(loop, UV_RUN_DEFAULT);
1502
+ ASSERT(access_cb_count == 1);
1503
+ access_cb_count = 0; /* reset for the next test */
1504
+
1505
+ /* Close file */
1506
+ r = uv_fs_close(NULL, &req, file, NULL);
1507
+ ASSERT(r == 0);
1508
+ ASSERT(req.result == 0);
1509
+ uv_fs_req_cleanup(&req);
1510
+
1511
+ /* Directory access */
1512
+ r = uv_fs_mkdir(NULL, &req, "test_dir", 0777, NULL);
1513
+ ASSERT(r == 0);
1514
+ uv_fs_req_cleanup(&req);
1515
+
1516
+ r = uv_fs_access(NULL, &req, "test_dir", W_OK, NULL);
1517
+ ASSERT(r == 0);
1518
+ ASSERT(req.result == 0);
1519
+ uv_fs_req_cleanup(&req);
1520
+
1521
+ /*
1522
+ * Run the loop just to check we don't have make any extraneous uv_ref()
1523
+ * calls. This should drop out immediately.
1524
+ */
1525
+ uv_run(loop, UV_RUN_DEFAULT);
1526
+
1527
+ /* Cleanup. */
1528
+ unlink("test_file");
1529
+ rmdir("test_dir");
1530
+
1531
+ MAKE_VALGRIND_HAPPY();
1532
+ return 0;
1533
+ }
1534
+
1535
+
1536
+ TEST_IMPL(fs_chmod) {
1537
+ int r;
1538
+ uv_fs_t req;
1539
+ uv_file file;
1540
+
1541
+ /* Setup. */
1542
+ unlink("test_file");
1543
+
1544
+ loop = uv_default_loop();
1545
+
1546
+ r = uv_fs_open(NULL, &req, "test_file", O_RDWR | O_CREAT,
1547
+ S_IWUSR | S_IRUSR, NULL);
1548
+ ASSERT(r >= 0);
1549
+ ASSERT(req.result >= 0);
1550
+ file = req.result;
1551
+ uv_fs_req_cleanup(&req);
1552
+
1553
+ iov = uv_buf_init(test_buf, sizeof(test_buf));
1554
+ r = uv_fs_write(NULL, &req, file, &iov, 1, -1, NULL);
1555
+ ASSERT(r == sizeof(test_buf));
1556
+ ASSERT(req.result == sizeof(test_buf));
1557
+ uv_fs_req_cleanup(&req);
1558
+
1559
+ #ifndef _WIN32
1560
+ /* Make the file write-only */
1561
+ r = uv_fs_chmod(NULL, &req, "test_file", 0200, NULL);
1562
+ ASSERT(r == 0);
1563
+ ASSERT(req.result == 0);
1564
+ uv_fs_req_cleanup(&req);
1565
+
1566
+ check_permission("test_file", 0200);
1567
+ #endif
1568
+
1569
+ /* Make the file read-only */
1570
+ r = uv_fs_chmod(NULL, &req, "test_file", 0400, NULL);
1571
+ ASSERT(r == 0);
1572
+ ASSERT(req.result == 0);
1573
+ uv_fs_req_cleanup(&req);
1574
+
1575
+ check_permission("test_file", 0400);
1576
+
1577
+ /* Make the file read+write with sync uv_fs_fchmod */
1578
+ r = uv_fs_fchmod(NULL, &req, file, 0600, NULL);
1579
+ ASSERT(r == 0);
1580
+ ASSERT(req.result == 0);
1581
+ uv_fs_req_cleanup(&req);
1582
+
1583
+ check_permission("test_file", 0600);
1584
+
1585
+ #ifndef _WIN32
1586
+ /* async chmod */
1587
+ {
1588
+ static int mode = 0200;
1589
+ req.data = &mode;
1590
+ }
1591
+ r = uv_fs_chmod(loop, &req, "test_file", 0200, chmod_cb);
1592
+ ASSERT(r == 0);
1593
+ uv_run(loop, UV_RUN_DEFAULT);
1594
+ ASSERT(chmod_cb_count == 1);
1595
+ chmod_cb_count = 0; /* reset for the next test */
1596
+ #endif
1597
+
1598
+ /* async chmod */
1599
+ {
1600
+ static int mode = 0400;
1601
+ req.data = &mode;
1602
+ }
1603
+ r = uv_fs_chmod(loop, &req, "test_file", 0400, chmod_cb);
1604
+ ASSERT(r == 0);
1605
+ uv_run(loop, UV_RUN_DEFAULT);
1606
+ ASSERT(chmod_cb_count == 1);
1607
+
1608
+ /* async fchmod */
1609
+ {
1610
+ static int mode = 0600;
1611
+ req.data = &mode;
1612
+ }
1613
+ r = uv_fs_fchmod(loop, &req, file, 0600, fchmod_cb);
1614
+ ASSERT(r == 0);
1615
+ uv_run(loop, UV_RUN_DEFAULT);
1616
+ ASSERT(fchmod_cb_count == 1);
1617
+
1618
+ uv_fs_close(loop, &req, file, NULL);
1619
+
1620
+ /*
1621
+ * Run the loop just to check we don't have make any extraneous uv_ref()
1622
+ * calls. This should drop out immediately.
1623
+ */
1624
+ uv_run(loop, UV_RUN_DEFAULT);
1625
+
1626
+ /* Cleanup. */
1627
+ unlink("test_file");
1628
+
1629
+ MAKE_VALGRIND_HAPPY();
1630
+ return 0;
1631
+ }
1632
+
1633
+
1634
+ TEST_IMPL(fs_unlink_readonly) {
1635
+ int r;
1636
+ uv_fs_t req;
1637
+ uv_file file;
1638
+
1639
+ /* Setup. */
1640
+ unlink("test_file");
1641
+
1642
+ loop = uv_default_loop();
1643
+
1644
+ r = uv_fs_open(NULL,
1645
+ &req,
1646
+ "test_file",
1647
+ O_RDWR | O_CREAT,
1648
+ S_IWUSR | S_IRUSR,
1649
+ NULL);
1650
+ ASSERT(r >= 0);
1651
+ ASSERT(req.result >= 0);
1652
+ file = req.result;
1653
+ uv_fs_req_cleanup(&req);
1654
+
1655
+ iov = uv_buf_init(test_buf, sizeof(test_buf));
1656
+ r = uv_fs_write(NULL, &req, file, &iov, 1, -1, NULL);
1657
+ ASSERT(r == sizeof(test_buf));
1658
+ ASSERT(req.result == sizeof(test_buf));
1659
+ uv_fs_req_cleanup(&req);
1660
+
1661
+ uv_fs_close(loop, &req, file, NULL);
1662
+
1663
+ /* Make the file read-only */
1664
+ r = uv_fs_chmod(NULL, &req, "test_file", 0400, NULL);
1665
+ ASSERT(r == 0);
1666
+ ASSERT(req.result == 0);
1667
+ uv_fs_req_cleanup(&req);
1668
+
1669
+ check_permission("test_file", 0400);
1670
+
1671
+ /* Try to unlink the file */
1672
+ r = uv_fs_unlink(NULL, &req, "test_file", NULL);
1673
+ ASSERT(r == 0);
1674
+ ASSERT(req.result == 0);
1675
+ uv_fs_req_cleanup(&req);
1676
+
1677
+ /*
1678
+ * Run the loop just to check we don't have make any extraneous uv_ref()
1679
+ * calls. This should drop out immediately.
1680
+ */
1681
+ uv_run(loop, UV_RUN_DEFAULT);
1682
+
1683
+ /* Cleanup. */
1684
+ uv_fs_chmod(NULL, &req, "test_file", 0600, NULL);
1685
+ uv_fs_req_cleanup(&req);
1686
+ unlink("test_file");
1687
+
1688
+ MAKE_VALGRIND_HAPPY();
1689
+ return 0;
1690
+ }
1691
+
1692
+ #ifdef _WIN32
1693
+ TEST_IMPL(fs_unlink_archive_readonly) {
1694
+ int r;
1695
+ uv_fs_t req;
1696
+ uv_file file;
1697
+
1698
+ /* Setup. */
1699
+ unlink("test_file");
1700
+
1701
+ loop = uv_default_loop();
1702
+
1703
+ r = uv_fs_open(NULL,
1704
+ &req,
1705
+ "test_file",
1706
+ O_RDWR | O_CREAT,
1707
+ S_IWUSR | S_IRUSR,
1708
+ NULL);
1709
+ ASSERT(r >= 0);
1710
+ ASSERT(req.result >= 0);
1711
+ file = req.result;
1712
+ uv_fs_req_cleanup(&req);
1713
+
1714
+ iov = uv_buf_init(test_buf, sizeof(test_buf));
1715
+ r = uv_fs_write(NULL, &req, file, &iov, 1, -1, NULL);
1716
+ ASSERT(r == sizeof(test_buf));
1717
+ ASSERT(req.result == sizeof(test_buf));
1718
+ uv_fs_req_cleanup(&req);
1719
+
1720
+ uv_fs_close(loop, &req, file, NULL);
1721
+
1722
+ /* Make the file read-only and clear archive flag */
1723
+ r = SetFileAttributes("test_file", FILE_ATTRIBUTE_READONLY);
1724
+ ASSERT(r != 0);
1725
+ uv_fs_req_cleanup(&req);
1726
+
1727
+ check_permission("test_file", 0400);
1728
+
1729
+ /* Try to unlink the file */
1730
+ r = uv_fs_unlink(NULL, &req, "test_file", NULL);
1731
+ ASSERT(r == 0);
1732
+ ASSERT(req.result == 0);
1733
+ uv_fs_req_cleanup(&req);
1734
+
1735
+ /*
1736
+ * Run the loop just to check we don't have make any extraneous uv_ref()
1737
+ * calls. This should drop out immediately.
1738
+ */
1739
+ uv_run(loop, UV_RUN_DEFAULT);
1740
+
1741
+ /* Cleanup. */
1742
+ uv_fs_chmod(NULL, &req, "test_file", 0600, NULL);
1743
+ uv_fs_req_cleanup(&req);
1744
+ unlink("test_file");
1745
+
1746
+ MAKE_VALGRIND_HAPPY();
1747
+ return 0;
1748
+ }
1749
+ #endif
1750
+
1751
+ TEST_IMPL(fs_chown) {
1752
+ int r;
1753
+ uv_fs_t req;
1754
+ uv_file file;
1755
+
1756
+ /* Setup. */
1757
+ unlink("test_file");
1758
+ unlink("test_file_link");
1759
+
1760
+ loop = uv_default_loop();
1761
+
1762
+ r = uv_fs_open(NULL, &req, "test_file", O_RDWR | O_CREAT,
1763
+ S_IWUSR | S_IRUSR, NULL);
1764
+ ASSERT(r >= 0);
1765
+ ASSERT(req.result >= 0);
1766
+ file = req.result;
1767
+ uv_fs_req_cleanup(&req);
1768
+
1769
+ /* sync chown */
1770
+ r = uv_fs_chown(NULL, &req, "test_file", -1, -1, NULL);
1771
+ ASSERT(r == 0);
1772
+ ASSERT(req.result == 0);
1773
+ uv_fs_req_cleanup(&req);
1774
+
1775
+ /* sync fchown */
1776
+ r = uv_fs_fchown(NULL, &req, file, -1, -1, NULL);
1777
+ ASSERT(r == 0);
1778
+ ASSERT(req.result == 0);
1779
+ uv_fs_req_cleanup(&req);
1780
+
1781
+ /* async chown */
1782
+ r = uv_fs_chown(loop, &req, "test_file", -1, -1, chown_cb);
1783
+ ASSERT(r == 0);
1784
+ uv_run(loop, UV_RUN_DEFAULT);
1785
+ ASSERT(chown_cb_count == 1);
1786
+
1787
+ #ifndef __MVS__
1788
+ /* chown to root (fail) */
1789
+ chown_cb_count = 0;
1790
+ r = uv_fs_chown(loop, &req, "test_file", 0, 0, chown_root_cb);
1791
+ ASSERT(r == 0);
1792
+ uv_run(loop, UV_RUN_DEFAULT);
1793
+ ASSERT(chown_cb_count == 1);
1794
+ #endif
1795
+
1796
+ /* async fchown */
1797
+ r = uv_fs_fchown(loop, &req, file, -1, -1, fchown_cb);
1798
+ ASSERT(r == 0);
1799
+ uv_run(loop, UV_RUN_DEFAULT);
1800
+ ASSERT(fchown_cb_count == 1);
1801
+
1802
+ #ifndef __HAIKU__
1803
+ /* Haiku doesn't support hardlink */
1804
+ /* sync link */
1805
+ r = uv_fs_link(NULL, &req, "test_file", "test_file_link", NULL);
1806
+ ASSERT(r == 0);
1807
+ ASSERT(req.result == 0);
1808
+ uv_fs_req_cleanup(&req);
1809
+
1810
+ /* sync lchown */
1811
+ r = uv_fs_lchown(NULL, &req, "test_file_link", -1, -1, NULL);
1812
+ ASSERT(r == 0);
1813
+ ASSERT(req.result == 0);
1814
+ uv_fs_req_cleanup(&req);
1815
+
1816
+ /* async lchown */
1817
+ r = uv_fs_lchown(loop, &req, "test_file_link", -1, -1, lchown_cb);
1818
+ ASSERT(r == 0);
1819
+ uv_run(loop, UV_RUN_DEFAULT);
1820
+ ASSERT(lchown_cb_count == 1);
1821
+ #endif
1822
+
1823
+ /* Close file */
1824
+ r = uv_fs_close(NULL, &req, file, NULL);
1825
+ ASSERT(r == 0);
1826
+ ASSERT(req.result == 0);
1827
+ uv_fs_req_cleanup(&req);
1828
+
1829
+ /*
1830
+ * Run the loop just to check we don't have make any extraneous uv_ref()
1831
+ * calls. This should drop out immediately.
1832
+ */
1833
+ uv_run(loop, UV_RUN_DEFAULT);
1834
+
1835
+ /* Cleanup. */
1836
+ unlink("test_file");
1837
+ unlink("test_file_link");
1838
+
1839
+ MAKE_VALGRIND_HAPPY();
1840
+ return 0;
1841
+ }
1842
+
1843
+
1844
+ TEST_IMPL(fs_link) {
1845
+ int r;
1846
+ uv_fs_t req;
1847
+ uv_file file;
1848
+ uv_file link;
1849
+
1850
+ /* Setup. */
1851
+ unlink("test_file");
1852
+ unlink("test_file_link");
1853
+ unlink("test_file_link2");
1854
+
1855
+ loop = uv_default_loop();
1856
+
1857
+ r = uv_fs_open(NULL, &req, "test_file", O_RDWR | O_CREAT,
1858
+ S_IWUSR | S_IRUSR, NULL);
1859
+ ASSERT(r >= 0);
1860
+ ASSERT(req.result >= 0);
1861
+ file = req.result;
1862
+ uv_fs_req_cleanup(&req);
1863
+
1864
+ iov = uv_buf_init(test_buf, sizeof(test_buf));
1865
+ r = uv_fs_write(NULL, &req, file, &iov, 1, -1, NULL);
1866
+ ASSERT(r == sizeof(test_buf));
1867
+ ASSERT(req.result == sizeof(test_buf));
1868
+ uv_fs_req_cleanup(&req);
1869
+
1870
+ uv_fs_close(loop, &req, file, NULL);
1871
+
1872
+ /* sync link */
1873
+ r = uv_fs_link(NULL, &req, "test_file", "test_file_link", NULL);
1874
+ ASSERT(r == 0);
1875
+ ASSERT(req.result == 0);
1876
+ uv_fs_req_cleanup(&req);
1877
+
1878
+ r = uv_fs_open(NULL, &req, "test_file_link", O_RDWR, 0, NULL);
1879
+ ASSERT(r >= 0);
1880
+ ASSERT(req.result >= 0);
1881
+ link = req.result;
1882
+ uv_fs_req_cleanup(&req);
1883
+
1884
+ memset(buf, 0, sizeof(buf));
1885
+ iov = uv_buf_init(buf, sizeof(buf));
1886
+ r = uv_fs_read(NULL, &req, link, &iov, 1, 0, NULL);
1887
+ ASSERT(r >= 0);
1888
+ ASSERT(req.result >= 0);
1889
+ ASSERT(strcmp(buf, test_buf) == 0);
1890
+
1891
+ close(link);
1892
+
1893
+ /* async link */
1894
+ r = uv_fs_link(loop, &req, "test_file", "test_file_link2", link_cb);
1895
+ ASSERT(r == 0);
1896
+ uv_run(loop, UV_RUN_DEFAULT);
1897
+ ASSERT(link_cb_count == 1);
1898
+
1899
+ r = uv_fs_open(NULL, &req, "test_file_link2", O_RDWR, 0, NULL);
1900
+ ASSERT(r >= 0);
1901
+ ASSERT(req.result >= 0);
1902
+ link = req.result;
1903
+ uv_fs_req_cleanup(&req);
1904
+
1905
+ memset(buf, 0, sizeof(buf));
1906
+ iov = uv_buf_init(buf, sizeof(buf));
1907
+ r = uv_fs_read(NULL, &req, link, &iov, 1, 0, NULL);
1908
+ ASSERT(r >= 0);
1909
+ ASSERT(req.result >= 0);
1910
+ ASSERT(strcmp(buf, test_buf) == 0);
1911
+
1912
+ uv_fs_close(loop, &req, link, NULL);
1913
+
1914
+ /*
1915
+ * Run the loop just to check we don't have make any extraneous uv_ref()
1916
+ * calls. This should drop out immediately.
1917
+ */
1918
+ uv_run(loop, UV_RUN_DEFAULT);
1919
+
1920
+ /* Cleanup. */
1921
+ unlink("test_file");
1922
+ unlink("test_file_link");
1923
+ unlink("test_file_link2");
1924
+
1925
+ MAKE_VALGRIND_HAPPY();
1926
+ return 0;
1927
+ }
1928
+
1929
+
1930
+ TEST_IMPL(fs_readlink) {
1931
+ uv_fs_t req;
1932
+
1933
+ loop = uv_default_loop();
1934
+ ASSERT(0 == uv_fs_readlink(loop, &req, "no_such_file", dummy_cb));
1935
+ ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT));
1936
+ ASSERT(dummy_cb_count == 1);
1937
+ ASSERT(req.ptr == NULL);
1938
+ ASSERT(req.result == UV_ENOENT);
1939
+ uv_fs_req_cleanup(&req);
1940
+
1941
+ ASSERT(UV_ENOENT == uv_fs_readlink(NULL, &req, "no_such_file", NULL));
1942
+ ASSERT(req.ptr == NULL);
1943
+ ASSERT(req.result == UV_ENOENT);
1944
+ uv_fs_req_cleanup(&req);
1945
+
1946
+ MAKE_VALGRIND_HAPPY();
1947
+ return 0;
1948
+ }
1949
+
1950
+
1951
+ TEST_IMPL(fs_realpath) {
1952
+ uv_fs_t req;
1953
+
1954
+ loop = uv_default_loop();
1955
+ ASSERT(0 == uv_fs_realpath(loop, &req, "no_such_file", dummy_cb));
1956
+ ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT));
1957
+ ASSERT(dummy_cb_count == 1);
1958
+ ASSERT(req.ptr == NULL);
1959
+ #ifdef _WIN32
1960
+ /*
1961
+ * Windows XP and Server 2003 don't support GetFinalPathNameByHandleW()
1962
+ */
1963
+ if (req.result == UV_ENOSYS) {
1964
+ uv_fs_req_cleanup(&req);
1965
+ RETURN_SKIP("realpath is not supported on Windows XP");
1966
+ }
1967
+ #endif
1968
+ ASSERT(req.result == UV_ENOENT);
1969
+ uv_fs_req_cleanup(&req);
1970
+
1971
+ ASSERT(UV_ENOENT == uv_fs_realpath(NULL, &req, "no_such_file", NULL));
1972
+ ASSERT(req.ptr == NULL);
1973
+ ASSERT(req.result == UV_ENOENT);
1974
+ uv_fs_req_cleanup(&req);
1975
+
1976
+ MAKE_VALGRIND_HAPPY();
1977
+ return 0;
1978
+ }
1979
+
1980
+
1981
+ TEST_IMPL(fs_symlink) {
1982
+ int r;
1983
+ uv_fs_t req;
1984
+ uv_file file;
1985
+ uv_file link;
1986
+ char test_file_abs_buf[PATHMAX];
1987
+ size_t test_file_abs_size;
1988
+
1989
+ /* Setup. */
1990
+ unlink("test_file");
1991
+ unlink("test_file_symlink");
1992
+ unlink("test_file_symlink2");
1993
+ unlink("test_file_symlink_symlink");
1994
+ unlink("test_file_symlink2_symlink");
1995
+ test_file_abs_size = sizeof(test_file_abs_buf);
1996
+ #ifdef _WIN32
1997
+ uv_cwd(test_file_abs_buf, &test_file_abs_size);
1998
+ strcat(test_file_abs_buf, "\\test_file");
1999
+ #else
2000
+ uv_cwd(test_file_abs_buf, &test_file_abs_size);
2001
+ strcat(test_file_abs_buf, "/test_file");
2002
+ #endif
2003
+
2004
+ loop = uv_default_loop();
2005
+
2006
+ r = uv_fs_open(NULL, &req, "test_file", O_RDWR | O_CREAT,
2007
+ S_IWUSR | S_IRUSR, NULL);
2008
+ ASSERT(r >= 0);
2009
+ ASSERT(req.result >= 0);
2010
+ file = req.result;
2011
+ uv_fs_req_cleanup(&req);
2012
+
2013
+ iov = uv_buf_init(test_buf, sizeof(test_buf));
2014
+ r = uv_fs_write(NULL, &req, file, &iov, 1, -1, NULL);
2015
+ ASSERT(r == sizeof(test_buf));
2016
+ ASSERT(req.result == sizeof(test_buf));
2017
+ uv_fs_req_cleanup(&req);
2018
+
2019
+ uv_fs_close(loop, &req, file, NULL);
2020
+
2021
+ /* sync symlink */
2022
+ r = uv_fs_symlink(NULL, &req, "test_file", "test_file_symlink", 0, NULL);
2023
+ #ifdef _WIN32
2024
+ if (r < 0) {
2025
+ if (r == UV_ENOTSUP) {
2026
+ /*
2027
+ * Windows doesn't support symlinks on older versions.
2028
+ * We just pass the test and bail out early if we get ENOTSUP.
2029
+ */
2030
+ return 0;
2031
+ } else if (r == UV_EPERM) {
2032
+ /*
2033
+ * Creating a symlink is only allowed when running elevated.
2034
+ * We pass the test and bail out early if we get UV_EPERM.
2035
+ */
2036
+ return 0;
2037
+ }
2038
+ }
2039
+ #endif
2040
+ ASSERT(r == 0);
2041
+ ASSERT(req.result == 0);
2042
+ uv_fs_req_cleanup(&req);
2043
+
2044
+ r = uv_fs_open(NULL, &req, "test_file_symlink", O_RDWR, 0, NULL);
2045
+ ASSERT(r >= 0);
2046
+ ASSERT(req.result >= 0);
2047
+ link = req.result;
2048
+ uv_fs_req_cleanup(&req);
2049
+
2050
+ memset(buf, 0, sizeof(buf));
2051
+ iov = uv_buf_init(buf, sizeof(buf));
2052
+ r = uv_fs_read(NULL, &req, link, &iov, 1, 0, NULL);
2053
+ ASSERT(r >= 0);
2054
+ ASSERT(req.result >= 0);
2055
+ ASSERT(strcmp(buf, test_buf) == 0);
2056
+
2057
+ uv_fs_close(loop, &req, link, NULL);
2058
+
2059
+ r = uv_fs_symlink(NULL,
2060
+ &req,
2061
+ "test_file_symlink",
2062
+ "test_file_symlink_symlink",
2063
+ 0,
2064
+ NULL);
2065
+ ASSERT(r == 0);
2066
+ uv_fs_req_cleanup(&req);
2067
+
2068
+ #if defined(__MSYS__)
2069
+ RETURN_SKIP("symlink reading is not supported on MSYS2");
2070
+ #endif
2071
+
2072
+ r = uv_fs_readlink(NULL, &req, "test_file_symlink_symlink", NULL);
2073
+ ASSERT(r == 0);
2074
+ ASSERT(strcmp(req.ptr, "test_file_symlink") == 0);
2075
+ uv_fs_req_cleanup(&req);
2076
+
2077
+ r = uv_fs_realpath(NULL, &req, "test_file_symlink_symlink", NULL);
2078
+ #ifdef _WIN32
2079
+ /*
2080
+ * Windows XP and Server 2003 don't support GetFinalPathNameByHandleW()
2081
+ */
2082
+ if (r == UV_ENOSYS) {
2083
+ uv_fs_req_cleanup(&req);
2084
+ RETURN_SKIP("realpath is not supported on Windows XP");
2085
+ }
2086
+ #endif
2087
+ ASSERT(r == 0);
2088
+ #ifdef _WIN32
2089
+ ASSERT(stricmp(req.ptr, test_file_abs_buf) == 0);
2090
+ #else
2091
+ ASSERT(strcmp(req.ptr, test_file_abs_buf) == 0);
2092
+ #endif
2093
+ uv_fs_req_cleanup(&req);
2094
+
2095
+ /* async link */
2096
+ r = uv_fs_symlink(loop,
2097
+ &req,
2098
+ "test_file",
2099
+ "test_file_symlink2",
2100
+ 0,
2101
+ symlink_cb);
2102
+ ASSERT(r == 0);
2103
+ uv_run(loop, UV_RUN_DEFAULT);
2104
+ ASSERT(symlink_cb_count == 1);
2105
+
2106
+ r = uv_fs_open(NULL, &req, "test_file_symlink2", O_RDWR, 0, NULL);
2107
+ ASSERT(r >= 0);
2108
+ ASSERT(req.result >= 0);
2109
+ link = req.result;
2110
+ uv_fs_req_cleanup(&req);
2111
+
2112
+ memset(buf, 0, sizeof(buf));
2113
+ iov = uv_buf_init(buf, sizeof(buf));
2114
+ r = uv_fs_read(NULL, &req, link, &iov, 1, 0, NULL);
2115
+ ASSERT(r >= 0);
2116
+ ASSERT(req.result >= 0);
2117
+ ASSERT(strcmp(buf, test_buf) == 0);
2118
+
2119
+ uv_fs_close(loop, &req, link, NULL);
2120
+
2121
+ r = uv_fs_symlink(NULL,
2122
+ &req,
2123
+ "test_file_symlink2",
2124
+ "test_file_symlink2_symlink",
2125
+ 0,
2126
+ NULL);
2127
+ ASSERT(r == 0);
2128
+ uv_fs_req_cleanup(&req);
2129
+
2130
+ r = uv_fs_readlink(loop, &req, "test_file_symlink2_symlink", readlink_cb);
2131
+ ASSERT(r == 0);
2132
+ uv_run(loop, UV_RUN_DEFAULT);
2133
+ ASSERT(readlink_cb_count == 1);
2134
+
2135
+ r = uv_fs_realpath(loop, &req, "test_file", realpath_cb);
2136
+ #ifdef _WIN32
2137
+ /*
2138
+ * Windows XP and Server 2003 don't support GetFinalPathNameByHandleW()
2139
+ */
2140
+ if (r == UV_ENOSYS) {
2141
+ uv_fs_req_cleanup(&req);
2142
+ RETURN_SKIP("realpath is not supported on Windows XP");
2143
+ }
2144
+ #endif
2145
+ ASSERT(r == 0);
2146
+ uv_run(loop, UV_RUN_DEFAULT);
2147
+ ASSERT(realpath_cb_count == 1);
2148
+
2149
+ /*
2150
+ * Run the loop just to check we don't have make any extraneous uv_ref()
2151
+ * calls. This should drop out immediately.
2152
+ */
2153
+ uv_run(loop, UV_RUN_DEFAULT);
2154
+
2155
+ /* Cleanup. */
2156
+ unlink("test_file");
2157
+ unlink("test_file_symlink");
2158
+ unlink("test_file_symlink_symlink");
2159
+ unlink("test_file_symlink2");
2160
+ unlink("test_file_symlink2_symlink");
2161
+
2162
+ MAKE_VALGRIND_HAPPY();
2163
+ return 0;
2164
+ }
2165
+
2166
+
2167
+ int test_symlink_dir_impl(int type) {
2168
+ uv_fs_t req;
2169
+ int r;
2170
+ char* test_dir;
2171
+ uv_dirent_t dent;
2172
+ static char test_dir_abs_buf[PATHMAX];
2173
+ size_t test_dir_abs_size;
2174
+
2175
+ /* set-up */
2176
+ unlink("test_dir/file1");
2177
+ unlink("test_dir/file2");
2178
+ rmdir("test_dir");
2179
+ rmdir("test_dir_symlink");
2180
+ test_dir_abs_size = sizeof(test_dir_abs_buf);
2181
+
2182
+ loop = uv_default_loop();
2183
+
2184
+ uv_fs_mkdir(NULL, &req, "test_dir", 0777, NULL);
2185
+ uv_fs_req_cleanup(&req);
2186
+
2187
+ #ifdef _WIN32
2188
+ strcpy(test_dir_abs_buf, "\\\\?\\");
2189
+ uv_cwd(test_dir_abs_buf + 4, &test_dir_abs_size);
2190
+ test_dir_abs_size += 4;
2191
+ strcat(test_dir_abs_buf, "\\test_dir\\");
2192
+ test_dir_abs_size += strlen("\\test_dir\\");
2193
+ test_dir = test_dir_abs_buf;
2194
+ #else
2195
+ uv_cwd(test_dir_abs_buf, &test_dir_abs_size);
2196
+ strcat(test_dir_abs_buf, "/test_dir");
2197
+ test_dir_abs_size += strlen("/test_dir");
2198
+ test_dir = "test_dir";
2199
+ #endif
2200
+
2201
+ r = uv_fs_symlink(NULL, &req, test_dir, "test_dir_symlink", type, NULL);
2202
+ if (type == UV_FS_SYMLINK_DIR && (r == UV_ENOTSUP || r == UV_EPERM)) {
2203
+ uv_fs_req_cleanup(&req);
2204
+ RETURN_SKIP("this version of Windows doesn't support unprivileged "
2205
+ "creation of directory symlinks");
2206
+ }
2207
+ fprintf(stderr, "r == %i\n", r);
2208
+ ASSERT(r == 0);
2209
+ ASSERT(req.result == 0);
2210
+ uv_fs_req_cleanup(&req);
2211
+
2212
+ r = uv_fs_stat(NULL, &req, "test_dir_symlink", NULL);
2213
+ ASSERT(r == 0);
2214
+ ASSERT(((uv_stat_t*)req.ptr)->st_mode & S_IFDIR);
2215
+ uv_fs_req_cleanup(&req);
2216
+
2217
+ r = uv_fs_lstat(NULL, &req, "test_dir_symlink", NULL);
2218
+ ASSERT(r == 0);
2219
+ #if defined(__MSYS__)
2220
+ RETURN_SKIP("symlink reading is not supported on MSYS2");
2221
+ #endif
2222
+ ASSERT(((uv_stat_t*)req.ptr)->st_mode & S_IFLNK);
2223
+ #ifdef _WIN32
2224
+ ASSERT(((uv_stat_t*)req.ptr)->st_size == strlen(test_dir + 4));
2225
+ #else
2226
+ ASSERT(((uv_stat_t*)req.ptr)->st_size == strlen(test_dir));
2227
+ #endif
2228
+ uv_fs_req_cleanup(&req);
2229
+
2230
+ r = uv_fs_readlink(NULL, &req, "test_dir_symlink", NULL);
2231
+ ASSERT(r == 0);
2232
+ #ifdef _WIN32
2233
+ ASSERT(strcmp(req.ptr, test_dir + 4) == 0);
2234
+ #else
2235
+ ASSERT(strcmp(req.ptr, test_dir) == 0);
2236
+ #endif
2237
+ uv_fs_req_cleanup(&req);
2238
+
2239
+ r = uv_fs_realpath(NULL, &req, "test_dir_symlink", NULL);
2240
+ #ifdef _WIN32
2241
+ /*
2242
+ * Windows XP and Server 2003 don't support GetFinalPathNameByHandleW()
2243
+ */
2244
+ if (r == UV_ENOSYS) {
2245
+ uv_fs_req_cleanup(&req);
2246
+ RETURN_SKIP("realpath is not supported on Windows XP");
2247
+ }
2248
+ #endif
2249
+ ASSERT(r == 0);
2250
+ #ifdef _WIN32
2251
+ ASSERT(strlen(req.ptr) == test_dir_abs_size - 5);
2252
+ ASSERT(strnicmp(req.ptr, test_dir + 4, test_dir_abs_size - 5) == 0);
2253
+ #else
2254
+ ASSERT(strcmp(req.ptr, test_dir_abs_buf) == 0);
2255
+ #endif
2256
+ uv_fs_req_cleanup(&req);
2257
+
2258
+ r = uv_fs_open(NULL, &open_req1, "test_dir/file1", O_WRONLY | O_CREAT,
2259
+ S_IWUSR | S_IRUSR, NULL);
2260
+ ASSERT(r >= 0);
2261
+ uv_fs_req_cleanup(&open_req1);
2262
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
2263
+ ASSERT(r == 0);
2264
+ uv_fs_req_cleanup(&close_req);
2265
+
2266
+ r = uv_fs_open(NULL, &open_req1, "test_dir/file2", O_WRONLY | O_CREAT,
2267
+ S_IWUSR | S_IRUSR, NULL);
2268
+ ASSERT(r >= 0);
2269
+ uv_fs_req_cleanup(&open_req1);
2270
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
2271
+ ASSERT(r == 0);
2272
+ uv_fs_req_cleanup(&close_req);
2273
+
2274
+ r = uv_fs_scandir(NULL, &scandir_req, "test_dir_symlink", 0, NULL);
2275
+ ASSERT(r == 2);
2276
+ ASSERT(scandir_req.result == 2);
2277
+ ASSERT(scandir_req.ptr);
2278
+ while (UV_EOF != uv_fs_scandir_next(&scandir_req, &dent)) {
2279
+ ASSERT(strcmp(dent.name, "file1") == 0 || strcmp(dent.name, "file2") == 0);
2280
+ assert_is_file_type(dent);
2281
+ }
2282
+ uv_fs_req_cleanup(&scandir_req);
2283
+ ASSERT(!scandir_req.ptr);
2284
+
2285
+ /* unlink will remove the directory symlink */
2286
+ r = uv_fs_unlink(NULL, &req, "test_dir_symlink", NULL);
2287
+ ASSERT(r == 0);
2288
+ uv_fs_req_cleanup(&req);
2289
+
2290
+ r = uv_fs_scandir(NULL, &scandir_req, "test_dir_symlink", 0, NULL);
2291
+ ASSERT(r == UV_ENOENT);
2292
+ uv_fs_req_cleanup(&scandir_req);
2293
+
2294
+ r = uv_fs_scandir(NULL, &scandir_req, "test_dir", 0, NULL);
2295
+ ASSERT(r == 2);
2296
+ ASSERT(scandir_req.result == 2);
2297
+ ASSERT(scandir_req.ptr);
2298
+ while (UV_EOF != uv_fs_scandir_next(&scandir_req, &dent)) {
2299
+ ASSERT(strcmp(dent.name, "file1") == 0 || strcmp(dent.name, "file2") == 0);
2300
+ assert_is_file_type(dent);
2301
+ }
2302
+ uv_fs_req_cleanup(&scandir_req);
2303
+ ASSERT(!scandir_req.ptr);
2304
+
2305
+ /* clean-up */
2306
+ unlink("test_dir/file1");
2307
+ unlink("test_dir/file2");
2308
+ rmdir("test_dir");
2309
+ rmdir("test_dir_symlink");
2310
+
2311
+ MAKE_VALGRIND_HAPPY();
2312
+ return 0;
2313
+ }
2314
+
2315
+ TEST_IMPL(fs_symlink_dir) {
2316
+ return test_symlink_dir_impl(UV_FS_SYMLINK_DIR);
2317
+ }
2318
+
2319
+ TEST_IMPL(fs_symlink_junction) {
2320
+ return test_symlink_dir_impl(UV_FS_SYMLINK_JUNCTION);
2321
+ }
2322
+
2323
+ #ifdef _WIN32
2324
+ TEST_IMPL(fs_non_symlink_reparse_point) {
2325
+ uv_fs_t req;
2326
+ int r;
2327
+ HANDLE file_handle;
2328
+ REPARSE_GUID_DATA_BUFFER reparse_buffer;
2329
+ DWORD bytes_returned;
2330
+ uv_dirent_t dent;
2331
+
2332
+ /* set-up */
2333
+ unlink("test_dir/test_file");
2334
+ rmdir("test_dir");
2335
+
2336
+ loop = uv_default_loop();
2337
+
2338
+ uv_fs_mkdir(NULL, &req, "test_dir", 0777, NULL);
2339
+ uv_fs_req_cleanup(&req);
2340
+
2341
+ file_handle = CreateFile("test_dir/test_file",
2342
+ GENERIC_WRITE | FILE_WRITE_ATTRIBUTES,
2343
+ 0,
2344
+ NULL,
2345
+ CREATE_ALWAYS,
2346
+ FILE_FLAG_OPEN_REPARSE_POINT |
2347
+ FILE_FLAG_BACKUP_SEMANTICS,
2348
+ NULL);
2349
+ ASSERT(file_handle != INVALID_HANDLE_VALUE);
2350
+
2351
+ memset(&reparse_buffer, 0, REPARSE_GUID_DATA_BUFFER_HEADER_SIZE);
2352
+ reparse_buffer.ReparseTag = REPARSE_TAG;
2353
+ reparse_buffer.ReparseDataLength = 0;
2354
+ reparse_buffer.ReparseGuid = REPARSE_GUID;
2355
+
2356
+ r = DeviceIoControl(file_handle,
2357
+ FSCTL_SET_REPARSE_POINT,
2358
+ &reparse_buffer,
2359
+ REPARSE_GUID_DATA_BUFFER_HEADER_SIZE,
2360
+ NULL,
2361
+ 0,
2362
+ &bytes_returned,
2363
+ NULL);
2364
+ ASSERT(r != 0);
2365
+
2366
+ CloseHandle(file_handle);
2367
+
2368
+ r = uv_fs_readlink(NULL, &req, "test_dir/test_file", NULL);
2369
+ ASSERT(r == UV_EINVAL && GetLastError() == ERROR_SYMLINK_NOT_SUPPORTED);
2370
+ uv_fs_req_cleanup(&req);
2371
+
2372
+ /*
2373
+ Placeholder tests for exercising the behavior fixed in issue #995.
2374
+ To run, update the path with the IP address of a Mac with the hard drive
2375
+ shared via SMB as "Macintosh HD".
2376
+
2377
+ r = uv_fs_stat(NULL, &req, "\\\\<mac_ip>\\Macintosh HD\\.DS_Store", NULL);
2378
+ ASSERT(r == 0);
2379
+ uv_fs_req_cleanup(&req);
2380
+
2381
+ r = uv_fs_lstat(NULL, &req, "\\\\<mac_ip>\\Macintosh HD\\.DS_Store", NULL);
2382
+ ASSERT(r == 0);
2383
+ uv_fs_req_cleanup(&req);
2384
+ */
2385
+
2386
+ /*
2387
+ uv_fs_stat and uv_fs_lstat can only work on non-symlink reparse
2388
+ points when a minifilter driver is registered which intercepts
2389
+ associated filesystem requests. Installing a driver is beyond
2390
+ the scope of this test.
2391
+
2392
+ r = uv_fs_stat(NULL, &req, "test_dir/test_file", NULL);
2393
+ ASSERT(r == 0);
2394
+ uv_fs_req_cleanup(&req);
2395
+
2396
+ r = uv_fs_lstat(NULL, &req, "test_dir/test_file", NULL);
2397
+ ASSERT(r == 0);
2398
+ uv_fs_req_cleanup(&req);
2399
+ */
2400
+
2401
+ r = uv_fs_scandir(NULL, &scandir_req, "test_dir", 0, NULL);
2402
+ ASSERT(r == 1);
2403
+ ASSERT(scandir_req.result == 1);
2404
+ ASSERT(scandir_req.ptr);
2405
+ while (UV_EOF != uv_fs_scandir_next(&scandir_req, &dent)) {
2406
+ ASSERT(strcmp(dent.name, "test_file") == 0);
2407
+ /* uv_fs_scandir incorrectly identifies non-symlink reparse points
2408
+ as links because it doesn't open the file and verify the reparse
2409
+ point tag. The PowerShell Get-ChildItem command shares this
2410
+ behavior, so it's reasonable to leave it as is. */
2411
+ ASSERT(dent.type == UV_DIRENT_LINK);
2412
+ }
2413
+ uv_fs_req_cleanup(&scandir_req);
2414
+ ASSERT(!scandir_req.ptr);
2415
+
2416
+ /* clean-up */
2417
+ unlink("test_dir/test_file");
2418
+ rmdir("test_dir");
2419
+
2420
+ MAKE_VALGRIND_HAPPY();
2421
+ return 0;
2422
+ }
2423
+ #endif
2424
+
2425
+
2426
+ TEST_IMPL(fs_utime) {
2427
+ utime_check_t checkme;
2428
+ const char* path = "test_file";
2429
+ double atime;
2430
+ double mtime;
2431
+ uv_fs_t req;
2432
+ int r;
2433
+
2434
+ /* Setup. */
2435
+ loop = uv_default_loop();
2436
+ unlink(path);
2437
+ r = uv_fs_open(NULL, &req, path, O_RDWR | O_CREAT, S_IWUSR | S_IRUSR, NULL);
2438
+ ASSERT(r >= 0);
2439
+ ASSERT(req.result >= 0);
2440
+ uv_fs_req_cleanup(&req);
2441
+ uv_fs_close(loop, &req, r, NULL);
2442
+
2443
+ atime = mtime = 400497753; /* 1982-09-10 11:22:33 */
2444
+
2445
+ /*
2446
+ * Test sub-second timestamps only on Windows (assuming NTFS). Some other
2447
+ * platforms support sub-second timestamps, but that support is filesystem-
2448
+ * dependent. Notably OS X (HFS Plus) does NOT support sub-second timestamps.
2449
+ */
2450
+ #ifdef _WIN32
2451
+ mtime += 0.444; /* 1982-09-10 11:22:33.444 */
2452
+ #endif
2453
+
2454
+ r = uv_fs_utime(NULL, &req, path, atime, mtime, NULL);
2455
+ ASSERT(r == 0);
2456
+ ASSERT(req.result == 0);
2457
+ uv_fs_req_cleanup(&req);
2458
+
2459
+ r = uv_fs_stat(NULL, &req, path, NULL);
2460
+ ASSERT(r == 0);
2461
+ ASSERT(req.result == 0);
2462
+ check_utime(path, atime, mtime);
2463
+ uv_fs_req_cleanup(&req);
2464
+
2465
+ atime = mtime = 1291404900; /* 2010-12-03 20:35:00 - mees <3 */
2466
+ checkme.path = path;
2467
+ checkme.atime = atime;
2468
+ checkme.mtime = mtime;
2469
+
2470
+ /* async utime */
2471
+ utime_req.data = &checkme;
2472
+ r = uv_fs_utime(loop, &utime_req, path, atime, mtime, utime_cb);
2473
+ ASSERT(r == 0);
2474
+ uv_run(loop, UV_RUN_DEFAULT);
2475
+ ASSERT(utime_cb_count == 1);
2476
+
2477
+ /* Cleanup. */
2478
+ unlink(path);
2479
+
2480
+ MAKE_VALGRIND_HAPPY();
2481
+ return 0;
2482
+ }
2483
+
2484
+
2485
+ #ifdef _WIN32
2486
+ TEST_IMPL(fs_stat_root) {
2487
+ int r;
2488
+
2489
+ r = uv_fs_stat(NULL, &stat_req, "\\", NULL);
2490
+ ASSERT(r == 0);
2491
+
2492
+ r = uv_fs_stat(NULL, &stat_req, "..\\..\\..\\..\\..\\..\\..", NULL);
2493
+ ASSERT(r == 0);
2494
+
2495
+ r = uv_fs_stat(NULL, &stat_req, "..", NULL);
2496
+ ASSERT(r == 0);
2497
+
2498
+ r = uv_fs_stat(NULL, &stat_req, "..\\", NULL);
2499
+ ASSERT(r == 0);
2500
+
2501
+ /* stats the current directory on c: */
2502
+ r = uv_fs_stat(NULL, &stat_req, "c:", NULL);
2503
+ ASSERT(r == 0);
2504
+
2505
+ r = uv_fs_stat(NULL, &stat_req, "c:\\", NULL);
2506
+ ASSERT(r == 0);
2507
+
2508
+ r = uv_fs_stat(NULL, &stat_req, "\\\\?\\C:\\", NULL);
2509
+ ASSERT(r == 0);
2510
+
2511
+ MAKE_VALGRIND_HAPPY();
2512
+ return 0;
2513
+ }
2514
+ #endif
2515
+
2516
+
2517
+ TEST_IMPL(fs_futime) {
2518
+ utime_check_t checkme;
2519
+ const char* path = "test_file";
2520
+ double atime;
2521
+ double mtime;
2522
+ uv_file file;
2523
+ uv_fs_t req;
2524
+ int r;
2525
+ #if defined(_AIX) && !defined(_AIX71)
2526
+ RETURN_SKIP("futime is not implemented for AIX versions below 7.1");
2527
+ #endif
2528
+
2529
+ /* Setup. */
2530
+ loop = uv_default_loop();
2531
+ unlink(path);
2532
+ r = uv_fs_open(NULL, &req, path, O_RDWR | O_CREAT, S_IWUSR | S_IRUSR, NULL);
2533
+ ASSERT(r >= 0);
2534
+ ASSERT(req.result >= 0);
2535
+ uv_fs_req_cleanup(&req);
2536
+ uv_fs_close(loop, &req, r, NULL);
2537
+
2538
+ atime = mtime = 400497753; /* 1982-09-10 11:22:33 */
2539
+
2540
+ /*
2541
+ * Test sub-second timestamps only on Windows (assuming NTFS). Some other
2542
+ * platforms support sub-second timestamps, but that support is filesystem-
2543
+ * dependent. Notably OS X (HFS Plus) does NOT support sub-second timestamps.
2544
+ */
2545
+ #ifdef _WIN32
2546
+ mtime += 0.444; /* 1982-09-10 11:22:33.444 */
2547
+ #endif
2548
+
2549
+ r = uv_fs_open(NULL, &req, path, O_RDWR, 0, NULL);
2550
+ ASSERT(r >= 0);
2551
+ ASSERT(req.result >= 0);
2552
+ file = req.result; /* FIXME probably not how it's supposed to be used */
2553
+ uv_fs_req_cleanup(&req);
2554
+
2555
+ r = uv_fs_futime(NULL, &req, file, atime, mtime, NULL);
2556
+ #if defined(__CYGWIN__) || defined(__MSYS__)
2557
+ ASSERT(r == UV_ENOSYS);
2558
+ RETURN_SKIP("futime not supported on Cygwin");
2559
+ #else
2560
+ ASSERT(r == 0);
2561
+ ASSERT(req.result == 0);
2562
+ #endif
2563
+ uv_fs_req_cleanup(&req);
2564
+
2565
+ r = uv_fs_stat(NULL, &req, path, NULL);
2566
+ ASSERT(r == 0);
2567
+ ASSERT(req.result == 0);
2568
+ check_utime(path, atime, mtime);
2569
+ uv_fs_req_cleanup(&req);
2570
+
2571
+ atime = mtime = 1291404900; /* 2010-12-03 20:35:00 - mees <3 */
2572
+
2573
+ checkme.atime = atime;
2574
+ checkme.mtime = mtime;
2575
+ checkme.path = path;
2576
+
2577
+ /* async futime */
2578
+ futime_req.data = &checkme;
2579
+ r = uv_fs_futime(loop, &futime_req, file, atime, mtime, futime_cb);
2580
+ ASSERT(r == 0);
2581
+ uv_run(loop, UV_RUN_DEFAULT);
2582
+ ASSERT(futime_cb_count == 1);
2583
+
2584
+ /* Cleanup. */
2585
+ unlink(path);
2586
+
2587
+ MAKE_VALGRIND_HAPPY();
2588
+ return 0;
2589
+ }
2590
+
2591
+
2592
+ TEST_IMPL(fs_stat_missing_path) {
2593
+ uv_fs_t req;
2594
+ int r;
2595
+
2596
+ loop = uv_default_loop();
2597
+
2598
+ r = uv_fs_stat(NULL, &req, "non_existent_file", NULL);
2599
+ ASSERT(r == UV_ENOENT);
2600
+ ASSERT(req.result == UV_ENOENT);
2601
+ uv_fs_req_cleanup(&req);
2602
+
2603
+ MAKE_VALGRIND_HAPPY();
2604
+ return 0;
2605
+ }
2606
+
2607
+
2608
+ TEST_IMPL(fs_scandir_empty_dir) {
2609
+ const char* path;
2610
+ uv_fs_t req;
2611
+ uv_dirent_t dent;
2612
+ int r;
2613
+
2614
+ path = "./empty_dir/";
2615
+ loop = uv_default_loop();
2616
+
2617
+ uv_fs_mkdir(NULL, &req, path, 0777, NULL);
2618
+ uv_fs_req_cleanup(&req);
2619
+
2620
+ /* Fill the req to ensure that required fields are cleaned up */
2621
+ memset(&req, 0xdb, sizeof(req));
2622
+
2623
+ r = uv_fs_scandir(NULL, &req, path, 0, NULL);
2624
+ ASSERT(r == 0);
2625
+ ASSERT(req.result == 0);
2626
+ ASSERT(req.ptr == NULL);
2627
+ ASSERT(UV_EOF == uv_fs_scandir_next(&req, &dent));
2628
+ uv_fs_req_cleanup(&req);
2629
+
2630
+ r = uv_fs_scandir(loop, &scandir_req, path, 0, empty_scandir_cb);
2631
+ ASSERT(r == 0);
2632
+
2633
+ ASSERT(scandir_cb_count == 0);
2634
+ uv_run(loop, UV_RUN_DEFAULT);
2635
+ ASSERT(scandir_cb_count == 1);
2636
+
2637
+ uv_fs_rmdir(NULL, &req, path, NULL);
2638
+ uv_fs_req_cleanup(&req);
2639
+
2640
+ MAKE_VALGRIND_HAPPY();
2641
+ return 0;
2642
+ }
2643
+
2644
+
2645
+ TEST_IMPL(fs_scandir_non_existent_dir) {
2646
+ const char* path;
2647
+ uv_fs_t req;
2648
+ uv_dirent_t dent;
2649
+ int r;
2650
+
2651
+ path = "./non_existent_dir/";
2652
+ loop = uv_default_loop();
2653
+
2654
+ uv_fs_rmdir(NULL, &req, path, NULL);
2655
+ uv_fs_req_cleanup(&req);
2656
+
2657
+ /* Fill the req to ensure that required fields are cleaned up */
2658
+ memset(&req, 0xdb, sizeof(req));
2659
+
2660
+ r = uv_fs_scandir(NULL, &req, path, 0, NULL);
2661
+ ASSERT(r == UV_ENOENT);
2662
+ ASSERT(req.result == UV_ENOENT);
2663
+ ASSERT(req.ptr == NULL);
2664
+ ASSERT(UV_ENOENT == uv_fs_scandir_next(&req, &dent));
2665
+ uv_fs_req_cleanup(&req);
2666
+
2667
+ r = uv_fs_scandir(loop, &scandir_req, path, 0, non_existent_scandir_cb);
2668
+ ASSERT(r == 0);
2669
+
2670
+ ASSERT(scandir_cb_count == 0);
2671
+ uv_run(loop, UV_RUN_DEFAULT);
2672
+ ASSERT(scandir_cb_count == 1);
2673
+
2674
+ MAKE_VALGRIND_HAPPY();
2675
+ return 0;
2676
+ }
2677
+
2678
+ TEST_IMPL(fs_scandir_file) {
2679
+ const char* path;
2680
+ int r;
2681
+
2682
+ path = "test/fixtures/empty_file";
2683
+ loop = uv_default_loop();
2684
+
2685
+ r = uv_fs_scandir(NULL, &scandir_req, path, 0, NULL);
2686
+ ASSERT(r == UV_ENOTDIR);
2687
+ uv_fs_req_cleanup(&scandir_req);
2688
+
2689
+ r = uv_fs_scandir(loop, &scandir_req, path, 0, file_scandir_cb);
2690
+ ASSERT(r == 0);
2691
+
2692
+ ASSERT(scandir_cb_count == 0);
2693
+ uv_run(loop, UV_RUN_DEFAULT);
2694
+ ASSERT(scandir_cb_count == 1);
2695
+
2696
+ MAKE_VALGRIND_HAPPY();
2697
+ return 0;
2698
+ }
2699
+
2700
+
2701
+ TEST_IMPL(fs_open_dir) {
2702
+ const char* path;
2703
+ uv_fs_t req;
2704
+ int r, file;
2705
+
2706
+ path = ".";
2707
+ loop = uv_default_loop();
2708
+
2709
+ r = uv_fs_open(NULL, &req, path, O_RDONLY, 0, NULL);
2710
+ ASSERT(r >= 0);
2711
+ ASSERT(req.result >= 0);
2712
+ ASSERT(req.ptr == NULL);
2713
+ file = r;
2714
+ uv_fs_req_cleanup(&req);
2715
+
2716
+ r = uv_fs_close(NULL, &req, file, NULL);
2717
+ ASSERT(r == 0);
2718
+
2719
+ r = uv_fs_open(loop, &req, path, O_RDONLY, 0, open_cb_simple);
2720
+ ASSERT(r == 0);
2721
+
2722
+ ASSERT(open_cb_count == 0);
2723
+ uv_run(loop, UV_RUN_DEFAULT);
2724
+ ASSERT(open_cb_count == 1);
2725
+
2726
+ MAKE_VALGRIND_HAPPY();
2727
+ return 0;
2728
+ }
2729
+
2730
+
2731
+ static void fs_file_open_append(int add_flags) {
2732
+ int r;
2733
+
2734
+ /* Setup. */
2735
+ unlink("test_file");
2736
+
2737
+ loop = uv_default_loop();
2738
+
2739
+ r = uv_fs_open(NULL, &open_req1, "test_file",
2740
+ O_WRONLY | O_CREAT | add_flags, S_IWUSR | S_IRUSR, NULL);
2741
+ ASSERT(r >= 0);
2742
+ ASSERT(open_req1.result >= 0);
2743
+ uv_fs_req_cleanup(&open_req1);
2744
+
2745
+ iov = uv_buf_init(test_buf, sizeof(test_buf));
2746
+ r = uv_fs_write(NULL, &write_req, open_req1.result, &iov, 1, -1, NULL);
2747
+ ASSERT(r >= 0);
2748
+ ASSERT(write_req.result >= 0);
2749
+ uv_fs_req_cleanup(&write_req);
2750
+
2751
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
2752
+ ASSERT(r == 0);
2753
+ ASSERT(close_req.result == 0);
2754
+ uv_fs_req_cleanup(&close_req);
2755
+
2756
+ r = uv_fs_open(NULL, &open_req1, "test_file",
2757
+ O_RDWR | O_APPEND | add_flags, 0, NULL);
2758
+ ASSERT(r >= 0);
2759
+ ASSERT(open_req1.result >= 0);
2760
+ uv_fs_req_cleanup(&open_req1);
2761
+
2762
+ iov = uv_buf_init(test_buf, sizeof(test_buf));
2763
+ r = uv_fs_write(NULL, &write_req, open_req1.result, &iov, 1, -1, NULL);
2764
+ ASSERT(r >= 0);
2765
+ ASSERT(write_req.result >= 0);
2766
+ uv_fs_req_cleanup(&write_req);
2767
+
2768
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
2769
+ ASSERT(r == 0);
2770
+ ASSERT(close_req.result == 0);
2771
+ uv_fs_req_cleanup(&close_req);
2772
+
2773
+ r = uv_fs_open(NULL, &open_req1, "test_file", O_RDONLY | add_flags,
2774
+ S_IRUSR, NULL);
2775
+ ASSERT(r >= 0);
2776
+ ASSERT(open_req1.result >= 0);
2777
+ uv_fs_req_cleanup(&open_req1);
2778
+
2779
+ iov = uv_buf_init(buf, sizeof(buf));
2780
+ r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, -1, NULL);
2781
+ printf("read = %d\n", r);
2782
+ ASSERT(r == 26);
2783
+ ASSERT(read_req.result == 26);
2784
+ ASSERT(memcmp(buf,
2785
+ "test-buffer\n\0test-buffer\n\0",
2786
+ sizeof("test-buffer\n\0test-buffer\n\0") - 1) == 0);
2787
+ uv_fs_req_cleanup(&read_req);
2788
+
2789
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
2790
+ ASSERT(r == 0);
2791
+ ASSERT(close_req.result == 0);
2792
+ uv_fs_req_cleanup(&close_req);
2793
+
2794
+ /* Cleanup */
2795
+ unlink("test_file");
2796
+ }
2797
+ TEST_IMPL(fs_file_open_append) {
2798
+ fs_file_open_append(0);
2799
+ fs_file_open_append(UV_FS_O_FILEMAP);
2800
+
2801
+ MAKE_VALGRIND_HAPPY();
2802
+ return 0;
2803
+ }
2804
+
2805
+
2806
+ TEST_IMPL(fs_rename_to_existing_file) {
2807
+ int r;
2808
+
2809
+ /* Setup. */
2810
+ unlink("test_file");
2811
+ unlink("test_file2");
2812
+
2813
+ loop = uv_default_loop();
2814
+
2815
+ r = uv_fs_open(NULL, &open_req1, "test_file", O_WRONLY | O_CREAT,
2816
+ S_IWUSR | S_IRUSR, NULL);
2817
+ ASSERT(r >= 0);
2818
+ ASSERT(open_req1.result >= 0);
2819
+ uv_fs_req_cleanup(&open_req1);
2820
+
2821
+ iov = uv_buf_init(test_buf, sizeof(test_buf));
2822
+ r = uv_fs_write(NULL, &write_req, open_req1.result, &iov, 1, -1, NULL);
2823
+ ASSERT(r >= 0);
2824
+ ASSERT(write_req.result >= 0);
2825
+ uv_fs_req_cleanup(&write_req);
2826
+
2827
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
2828
+ ASSERT(r == 0);
2829
+ ASSERT(close_req.result == 0);
2830
+ uv_fs_req_cleanup(&close_req);
2831
+
2832
+ r = uv_fs_open(NULL, &open_req1, "test_file2", O_WRONLY | O_CREAT,
2833
+ S_IWUSR | S_IRUSR, NULL);
2834
+ ASSERT(r >= 0);
2835
+ ASSERT(open_req1.result >= 0);
2836
+ uv_fs_req_cleanup(&open_req1);
2837
+
2838
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
2839
+ ASSERT(r == 0);
2840
+ ASSERT(close_req.result == 0);
2841
+ uv_fs_req_cleanup(&close_req);
2842
+
2843
+ r = uv_fs_rename(NULL, &rename_req, "test_file", "test_file2", NULL);
2844
+ ASSERT(r == 0);
2845
+ ASSERT(rename_req.result == 0);
2846
+ uv_fs_req_cleanup(&rename_req);
2847
+
2848
+ r = uv_fs_open(NULL, &open_req1, "test_file2", O_RDONLY, 0, NULL);
2849
+ ASSERT(r >= 0);
2850
+ ASSERT(open_req1.result >= 0);
2851
+ uv_fs_req_cleanup(&open_req1);
2852
+
2853
+ memset(buf, 0, sizeof(buf));
2854
+ iov = uv_buf_init(buf, sizeof(buf));
2855
+ r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, -1, NULL);
2856
+ ASSERT(r >= 0);
2857
+ ASSERT(read_req.result >= 0);
2858
+ ASSERT(strcmp(buf, test_buf) == 0);
2859
+ uv_fs_req_cleanup(&read_req);
2860
+
2861
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
2862
+ ASSERT(r == 0);
2863
+ ASSERT(close_req.result == 0);
2864
+ uv_fs_req_cleanup(&close_req);
2865
+
2866
+ /* Cleanup */
2867
+ unlink("test_file");
2868
+ unlink("test_file2");
2869
+
2870
+ MAKE_VALGRIND_HAPPY();
2871
+ return 0;
2872
+ }
2873
+
2874
+
2875
+ static void fs_read_bufs(int add_flags) {
2876
+ char scratch[768];
2877
+ uv_buf_t bufs[4];
2878
+
2879
+ ASSERT(0 <= uv_fs_open(NULL, &open_req1,
2880
+ "test/fixtures/lorem_ipsum.txt",
2881
+ O_RDONLY | add_flags, 0, NULL));
2882
+ ASSERT(open_req1.result >= 0);
2883
+ uv_fs_req_cleanup(&open_req1);
2884
+
2885
+ ASSERT(UV_EINVAL == uv_fs_read(NULL, &read_req, open_req1.result,
2886
+ NULL, 0, 0, NULL));
2887
+ ASSERT(UV_EINVAL == uv_fs_read(NULL, &read_req, open_req1.result,
2888
+ NULL, 1, 0, NULL));
2889
+ ASSERT(UV_EINVAL == uv_fs_read(NULL, &read_req, open_req1.result,
2890
+ bufs, 0, 0, NULL));
2891
+
2892
+ bufs[0] = uv_buf_init(scratch + 0, 256);
2893
+ bufs[1] = uv_buf_init(scratch + 256, 256);
2894
+ bufs[2] = uv_buf_init(scratch + 512, 128);
2895
+ bufs[3] = uv_buf_init(scratch + 640, 128);
2896
+
2897
+ ASSERT(446 == uv_fs_read(NULL,
2898
+ &read_req,
2899
+ open_req1.result,
2900
+ bufs + 0,
2901
+ 2, /* 2x 256 bytes. */
2902
+ 0, /* Positional read. */
2903
+ NULL));
2904
+ ASSERT(read_req.result == 446);
2905
+ uv_fs_req_cleanup(&read_req);
2906
+
2907
+ ASSERT(190 == uv_fs_read(NULL,
2908
+ &read_req,
2909
+ open_req1.result,
2910
+ bufs + 2,
2911
+ 2, /* 2x 128 bytes. */
2912
+ 256, /* Positional read. */
2913
+ NULL));
2914
+ ASSERT(read_req.result == /* 446 - 256 */ 190);
2915
+ uv_fs_req_cleanup(&read_req);
2916
+
2917
+ ASSERT(0 == memcmp(bufs[1].base + 0, bufs[2].base, 128));
2918
+ ASSERT(0 == memcmp(bufs[1].base + 128, bufs[3].base, 190 - 128));
2919
+
2920
+ ASSERT(0 == uv_fs_close(NULL, &close_req, open_req1.result, NULL));
2921
+ ASSERT(close_req.result == 0);
2922
+ uv_fs_req_cleanup(&close_req);
2923
+ }
2924
+ TEST_IMPL(fs_read_bufs) {
2925
+ fs_read_bufs(0);
2926
+ fs_read_bufs(UV_FS_O_FILEMAP);
2927
+
2928
+ MAKE_VALGRIND_HAPPY();
2929
+ return 0;
2930
+ }
2931
+
2932
+
2933
+ static void fs_read_file_eof(int add_flags) {
2934
+ #if defined(__CYGWIN__) || defined(__MSYS__)
2935
+ RETURN_SKIP("Cygwin pread at EOF may (incorrectly) return data!");
2936
+ #endif
2937
+ int r;
2938
+
2939
+ /* Setup. */
2940
+ unlink("test_file");
2941
+
2942
+ loop = uv_default_loop();
2943
+
2944
+ r = uv_fs_open(NULL, &open_req1, "test_file",
2945
+ O_WRONLY | O_CREAT | add_flags, S_IWUSR | S_IRUSR, NULL);
2946
+ ASSERT(r >= 0);
2947
+ ASSERT(open_req1.result >= 0);
2948
+ uv_fs_req_cleanup(&open_req1);
2949
+
2950
+ iov = uv_buf_init(test_buf, sizeof(test_buf));
2951
+ r = uv_fs_write(NULL, &write_req, open_req1.result, &iov, 1, -1, NULL);
2952
+ ASSERT(r >= 0);
2953
+ ASSERT(write_req.result >= 0);
2954
+ uv_fs_req_cleanup(&write_req);
2955
+
2956
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
2957
+ ASSERT(r == 0);
2958
+ ASSERT(close_req.result == 0);
2959
+ uv_fs_req_cleanup(&close_req);
2960
+
2961
+ r = uv_fs_open(NULL, &open_req1, "test_file", O_RDONLY | add_flags, 0,
2962
+ NULL);
2963
+ ASSERT(r >= 0);
2964
+ ASSERT(open_req1.result >= 0);
2965
+ uv_fs_req_cleanup(&open_req1);
2966
+
2967
+ memset(buf, 0, sizeof(buf));
2968
+ iov = uv_buf_init(buf, sizeof(buf));
2969
+ r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, -1, NULL);
2970
+ ASSERT(r >= 0);
2971
+ ASSERT(read_req.result >= 0);
2972
+ ASSERT(strcmp(buf, test_buf) == 0);
2973
+ uv_fs_req_cleanup(&read_req);
2974
+
2975
+ iov = uv_buf_init(buf, sizeof(buf));
2976
+ r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1,
2977
+ read_req.result, NULL);
2978
+ ASSERT(r == 0);
2979
+ ASSERT(read_req.result == 0);
2980
+ uv_fs_req_cleanup(&read_req);
2981
+
2982
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
2983
+ ASSERT(r == 0);
2984
+ ASSERT(close_req.result == 0);
2985
+ uv_fs_req_cleanup(&close_req);
2986
+
2987
+ /* Cleanup */
2988
+ unlink("test_file");
2989
+ }
2990
+ TEST_IMPL(fs_read_file_eof) {
2991
+ fs_read_file_eof(0);
2992
+ fs_read_file_eof(UV_FS_O_FILEMAP);
2993
+
2994
+ MAKE_VALGRIND_HAPPY();
2995
+ return 0;
2996
+ }
2997
+
2998
+
2999
+ static void fs_write_multiple_bufs(int add_flags) {
3000
+ uv_buf_t iovs[2];
3001
+ int r;
3002
+
3003
+ /* Setup. */
3004
+ unlink("test_file");
3005
+
3006
+ loop = uv_default_loop();
3007
+
3008
+ r = uv_fs_open(NULL, &open_req1, "test_file",
3009
+ O_WRONLY | O_CREAT | add_flags, S_IWUSR | S_IRUSR, NULL);
3010
+ ASSERT(r >= 0);
3011
+ ASSERT(open_req1.result >= 0);
3012
+ uv_fs_req_cleanup(&open_req1);
3013
+
3014
+ iovs[0] = uv_buf_init(test_buf, sizeof(test_buf));
3015
+ iovs[1] = uv_buf_init(test_buf2, sizeof(test_buf2));
3016
+ r = uv_fs_write(NULL, &write_req, open_req1.result, iovs, 2, 0, NULL);
3017
+ ASSERT(r >= 0);
3018
+ ASSERT(write_req.result >= 0);
3019
+ uv_fs_req_cleanup(&write_req);
3020
+
3021
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
3022
+ ASSERT(r == 0);
3023
+ ASSERT(close_req.result == 0);
3024
+ uv_fs_req_cleanup(&close_req);
3025
+
3026
+ r = uv_fs_open(NULL, &open_req1, "test_file", O_RDONLY | add_flags, 0,
3027
+ NULL);
3028
+ ASSERT(r >= 0);
3029
+ ASSERT(open_req1.result >= 0);
3030
+ uv_fs_req_cleanup(&open_req1);
3031
+
3032
+ memset(buf, 0, sizeof(buf));
3033
+ memset(buf2, 0, sizeof(buf2));
3034
+ /* Read the strings back to separate buffers. */
3035
+ iovs[0] = uv_buf_init(buf, sizeof(test_buf));
3036
+ iovs[1] = uv_buf_init(buf2, sizeof(test_buf2));
3037
+ ASSERT(lseek(open_req1.result, 0, SEEK_CUR) == 0);
3038
+ r = uv_fs_read(NULL, &read_req, open_req1.result, iovs, 2, -1, NULL);
3039
+ ASSERT(r >= 0);
3040
+ ASSERT(read_req.result == sizeof(test_buf) + sizeof(test_buf2));
3041
+ ASSERT(strcmp(buf, test_buf) == 0);
3042
+ ASSERT(strcmp(buf2, test_buf2) == 0);
3043
+ uv_fs_req_cleanup(&read_req);
3044
+
3045
+ iov = uv_buf_init(buf, sizeof(buf));
3046
+ r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, -1, NULL);
3047
+ ASSERT(r == 0);
3048
+ ASSERT(read_req.result == 0);
3049
+ uv_fs_req_cleanup(&read_req);
3050
+
3051
+ /* Read the strings back to separate buffers. */
3052
+ iovs[0] = uv_buf_init(buf, sizeof(test_buf));
3053
+ iovs[1] = uv_buf_init(buf2, sizeof(test_buf2));
3054
+ r = uv_fs_read(NULL, &read_req, open_req1.result, iovs, 2, 0, NULL);
3055
+ ASSERT(r >= 0);
3056
+ if (read_req.result == sizeof(test_buf)) {
3057
+ /* Infer that preadv is not available. */
3058
+ uv_fs_req_cleanup(&read_req);
3059
+ r = uv_fs_read(NULL, &read_req, open_req1.result, &iovs[1], 1, read_req.result, NULL);
3060
+ ASSERT(r >= 0);
3061
+ ASSERT(read_req.result == sizeof(test_buf2));
3062
+ } else {
3063
+ ASSERT(read_req.result == sizeof(test_buf) + sizeof(test_buf2));
3064
+ }
3065
+ ASSERT(strcmp(buf, test_buf) == 0);
3066
+ ASSERT(strcmp(buf2, test_buf2) == 0);
3067
+ uv_fs_req_cleanup(&read_req);
3068
+
3069
+ iov = uv_buf_init(buf, sizeof(buf));
3070
+ r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1,
3071
+ sizeof(test_buf) + sizeof(test_buf2), NULL);
3072
+ ASSERT(r == 0);
3073
+ ASSERT(read_req.result == 0);
3074
+ uv_fs_req_cleanup(&read_req);
3075
+
3076
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
3077
+ ASSERT(r == 0);
3078
+ ASSERT(close_req.result == 0);
3079
+ uv_fs_req_cleanup(&close_req);
3080
+
3081
+ /* Cleanup */
3082
+ unlink("test_file");
3083
+ }
3084
+ TEST_IMPL(fs_write_multiple_bufs) {
3085
+ fs_write_multiple_bufs(0);
3086
+ fs_write_multiple_bufs(UV_FS_O_FILEMAP);
3087
+
3088
+ MAKE_VALGRIND_HAPPY();
3089
+ return 0;
3090
+ }
3091
+
3092
+
3093
+ static void fs_write_alotof_bufs(int add_flags) {
3094
+ size_t iovcount;
3095
+ size_t iovmax;
3096
+ uv_buf_t* iovs;
3097
+ char* buffer;
3098
+ size_t index;
3099
+ int r;
3100
+
3101
+ iovcount = 54321;
3102
+
3103
+ /* Setup. */
3104
+ unlink("test_file");
3105
+
3106
+ loop = uv_default_loop();
3107
+
3108
+ iovs = malloc(sizeof(*iovs) * iovcount);
3109
+ ASSERT(iovs != NULL);
3110
+ iovmax = uv_test_getiovmax();
3111
+
3112
+ r = uv_fs_open(NULL,
3113
+ &open_req1,
3114
+ "test_file",
3115
+ O_RDWR | O_CREAT | add_flags,
3116
+ S_IWUSR | S_IRUSR,
3117
+ NULL);
3118
+ ASSERT(r >= 0);
3119
+ ASSERT(open_req1.result >= 0);
3120
+ uv_fs_req_cleanup(&open_req1);
3121
+
3122
+ for (index = 0; index < iovcount; ++index)
3123
+ iovs[index] = uv_buf_init(test_buf, sizeof(test_buf));
3124
+
3125
+ r = uv_fs_write(NULL,
3126
+ &write_req,
3127
+ open_req1.result,
3128
+ iovs,
3129
+ iovcount,
3130
+ -1,
3131
+ NULL);
3132
+ ASSERT(r >= 0);
3133
+ ASSERT((size_t)write_req.result == sizeof(test_buf) * iovcount);
3134
+ uv_fs_req_cleanup(&write_req);
3135
+
3136
+ /* Read the strings back to separate buffers. */
3137
+ buffer = malloc(sizeof(test_buf) * iovcount);
3138
+ ASSERT(buffer != NULL);
3139
+
3140
+ for (index = 0; index < iovcount; ++index)
3141
+ iovs[index] = uv_buf_init(buffer + index * sizeof(test_buf),
3142
+ sizeof(test_buf));
3143
+
3144
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
3145
+ ASSERT(r == 0);
3146
+ ASSERT(close_req.result == 0);
3147
+ uv_fs_req_cleanup(&close_req);
3148
+
3149
+ r = uv_fs_open(NULL, &open_req1, "test_file", O_RDONLY | add_flags, 0,
3150
+ NULL);
3151
+ ASSERT(r >= 0);
3152
+ ASSERT(open_req1.result >= 0);
3153
+ uv_fs_req_cleanup(&open_req1);
3154
+
3155
+ r = uv_fs_read(NULL, &read_req, open_req1.result, iovs, iovcount, -1, NULL);
3156
+ if (iovcount > iovmax)
3157
+ iovcount = iovmax;
3158
+ ASSERT(r >= 0);
3159
+ ASSERT((size_t)read_req.result == sizeof(test_buf) * iovcount);
3160
+
3161
+ for (index = 0; index < iovcount; ++index)
3162
+ ASSERT(strncmp(buffer + index * sizeof(test_buf),
3163
+ test_buf,
3164
+ sizeof(test_buf)) == 0);
3165
+
3166
+ uv_fs_req_cleanup(&read_req);
3167
+ free(buffer);
3168
+
3169
+ ASSERT(lseek(open_req1.result, write_req.result, SEEK_SET) == write_req.result);
3170
+ iov = uv_buf_init(buf, sizeof(buf));
3171
+ r = uv_fs_read(NULL,
3172
+ &read_req,
3173
+ open_req1.result,
3174
+ &iov,
3175
+ 1,
3176
+ -1,
3177
+ NULL);
3178
+ ASSERT(r == 0);
3179
+ ASSERT(read_req.result == 0);
3180
+ uv_fs_req_cleanup(&read_req);
3181
+
3182
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
3183
+ ASSERT(r == 0);
3184
+ ASSERT(close_req.result == 0);
3185
+ uv_fs_req_cleanup(&close_req);
3186
+
3187
+ /* Cleanup */
3188
+ unlink("test_file");
3189
+ free(iovs);
3190
+ }
3191
+ TEST_IMPL(fs_write_alotof_bufs) {
3192
+ fs_write_alotof_bufs(0);
3193
+ fs_write_alotof_bufs(UV_FS_O_FILEMAP);
3194
+
3195
+ MAKE_VALGRIND_HAPPY();
3196
+ return 0;
3197
+ }
3198
+
3199
+
3200
+ static void fs_write_alotof_bufs_with_offset(int add_flags) {
3201
+ size_t iovcount;
3202
+ size_t iovmax;
3203
+ uv_buf_t* iovs;
3204
+ char* buffer;
3205
+ size_t index;
3206
+ int r;
3207
+ int64_t offset;
3208
+ char* filler;
3209
+ int filler_len;
3210
+
3211
+ filler = "0123456789";
3212
+ filler_len = strlen(filler);
3213
+ iovcount = 54321;
3214
+
3215
+ /* Setup. */
3216
+ unlink("test_file");
3217
+
3218
+ loop = uv_default_loop();
3219
+
3220
+ iovs = malloc(sizeof(*iovs) * iovcount);
3221
+ ASSERT(iovs != NULL);
3222
+ iovmax = uv_test_getiovmax();
3223
+
3224
+ r = uv_fs_open(NULL,
3225
+ &open_req1,
3226
+ "test_file",
3227
+ O_RDWR | O_CREAT | add_flags,
3228
+ S_IWUSR | S_IRUSR,
3229
+ NULL);
3230
+ ASSERT(r >= 0);
3231
+ ASSERT(open_req1.result >= 0);
3232
+ uv_fs_req_cleanup(&open_req1);
3233
+
3234
+ iov = uv_buf_init(filler, filler_len);
3235
+ r = uv_fs_write(NULL, &write_req, open_req1.result, &iov, 1, -1, NULL);
3236
+ ASSERT(r == filler_len);
3237
+ ASSERT(write_req.result == filler_len);
3238
+ uv_fs_req_cleanup(&write_req);
3239
+ offset = (int64_t)r;
3240
+
3241
+ for (index = 0; index < iovcount; ++index)
3242
+ iovs[index] = uv_buf_init(test_buf, sizeof(test_buf));
3243
+
3244
+ r = uv_fs_write(NULL,
3245
+ &write_req,
3246
+ open_req1.result,
3247
+ iovs,
3248
+ iovcount,
3249
+ offset,
3250
+ NULL);
3251
+ ASSERT(r >= 0);
3252
+ ASSERT((size_t)write_req.result == sizeof(test_buf) * iovcount);
3253
+ uv_fs_req_cleanup(&write_req);
3254
+
3255
+ /* Read the strings back to separate buffers. */
3256
+ buffer = malloc(sizeof(test_buf) * iovcount);
3257
+ ASSERT(buffer != NULL);
3258
+
3259
+ for (index = 0; index < iovcount; ++index)
3260
+ iovs[index] = uv_buf_init(buffer + index * sizeof(test_buf),
3261
+ sizeof(test_buf));
3262
+
3263
+ r = uv_fs_read(NULL, &read_req, open_req1.result,
3264
+ iovs, iovcount, offset, NULL);
3265
+ ASSERT(r >= 0);
3266
+ if (r == sizeof(test_buf))
3267
+ iovcount = 1; /* Infer that preadv is not available. */
3268
+ else if (iovcount > iovmax)
3269
+ iovcount = iovmax;
3270
+ ASSERT((size_t)read_req.result == sizeof(test_buf) * iovcount);
3271
+
3272
+ for (index = 0; index < iovcount; ++index)
3273
+ ASSERT(strncmp(buffer + index * sizeof(test_buf),
3274
+ test_buf,
3275
+ sizeof(test_buf)) == 0);
3276
+
3277
+ uv_fs_req_cleanup(&read_req);
3278
+ free(buffer);
3279
+
3280
+ r = uv_fs_stat(NULL, &stat_req, "test_file", NULL);
3281
+ ASSERT(r == 0);
3282
+ ASSERT((int64_t)((uv_stat_t*)stat_req.ptr)->st_size ==
3283
+ offset + (int64_t)write_req.result);
3284
+ uv_fs_req_cleanup(&stat_req);
3285
+
3286
+ iov = uv_buf_init(buf, sizeof(buf));
3287
+ r = uv_fs_read(NULL,
3288
+ &read_req,
3289
+ open_req1.result,
3290
+ &iov,
3291
+ 1,
3292
+ offset + write_req.result,
3293
+ NULL);
3294
+ ASSERT(r == 0);
3295
+ ASSERT(read_req.result == 0);
3296
+ uv_fs_req_cleanup(&read_req);
3297
+
3298
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
3299
+ ASSERT(r == 0);
3300
+ ASSERT(close_req.result == 0);
3301
+ uv_fs_req_cleanup(&close_req);
3302
+
3303
+ /* Cleanup */
3304
+ unlink("test_file");
3305
+ free(iovs);
3306
+ }
3307
+ TEST_IMPL(fs_write_alotof_bufs_with_offset) {
3308
+ fs_write_alotof_bufs_with_offset(0);
3309
+ fs_write_alotof_bufs_with_offset(UV_FS_O_FILEMAP);
3310
+
3311
+ MAKE_VALGRIND_HAPPY();
3312
+ return 0;
3313
+ }
3314
+
3315
+ TEST_IMPL(fs_read_dir) {
3316
+ int r;
3317
+ char buf[2];
3318
+ loop = uv_default_loop();
3319
+
3320
+ /* Setup */
3321
+ rmdir("test_dir");
3322
+ r = uv_fs_mkdir(loop, &mkdir_req, "test_dir", 0755, mkdir_cb);
3323
+ ASSERT(r == 0);
3324
+ uv_run(loop, UV_RUN_DEFAULT);
3325
+ ASSERT(mkdir_cb_count == 1);
3326
+ /* Setup Done Here */
3327
+
3328
+ /* Get a file descriptor for the directory */
3329
+ r = uv_fs_open(loop,
3330
+ &open_req1,
3331
+ "test_dir",
3332
+ UV_FS_O_RDONLY | UV_FS_O_DIRECTORY,
3333
+ S_IWUSR | S_IRUSR,
3334
+ NULL);
3335
+ ASSERT(r >= 0);
3336
+ uv_fs_req_cleanup(&open_req1);
3337
+
3338
+ /* Try to read data from the directory */
3339
+ iov = uv_buf_init(buf, sizeof(buf));
3340
+ r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, 0, NULL);
3341
+ #if defined(__FreeBSD__) || \
3342
+ defined(__OpenBSD__) || \
3343
+ defined(__NetBSD__) || \
3344
+ defined(__DragonFly__) || \
3345
+ defined(_AIX) || \
3346
+ defined(__sun) || \
3347
+ defined(__MVS__)
3348
+ /*
3349
+ * As of now, these operating systems support reading from a directory,
3350
+ * that too depends on the filesystem this temporary test directory is
3351
+ * created on. That is why this assertion is a bit lenient.
3352
+ */
3353
+ ASSERT((r >= 0) || (r == UV_EISDIR));
3354
+ #else
3355
+ ASSERT(r == UV_EISDIR);
3356
+ #endif
3357
+ uv_fs_req_cleanup(&read_req);
3358
+
3359
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
3360
+ ASSERT(r == 0);
3361
+ uv_fs_req_cleanup(&close_req);
3362
+
3363
+ /* Cleanup */
3364
+ rmdir("test_dir");
3365
+
3366
+ MAKE_VALGRIND_HAPPY();
3367
+ return 0;
3368
+ }
3369
+
3370
+ #ifdef _WIN32
3371
+
3372
+ TEST_IMPL(fs_partial_read) {
3373
+ RETURN_SKIP("Test not implemented on Windows.");
3374
+ }
3375
+
3376
+ TEST_IMPL(fs_partial_write) {
3377
+ RETURN_SKIP("Test not implemented on Windows.");
3378
+ }
3379
+
3380
+ #else /* !_WIN32 */
3381
+
3382
+ struct thread_ctx {
3383
+ pthread_t pid;
3384
+ int fd;
3385
+ char* data;
3386
+ int size;
3387
+ int interval;
3388
+ int doread;
3389
+ };
3390
+
3391
+ static void thread_main(void* arg) {
3392
+ const struct thread_ctx* ctx;
3393
+ int size;
3394
+ char* data;
3395
+
3396
+ ctx = (struct thread_ctx*)arg;
3397
+ size = ctx->size;
3398
+ data = ctx->data;
3399
+
3400
+ while (size > 0) {
3401
+ ssize_t result;
3402
+ int nbytes;
3403
+ nbytes = size < ctx->interval ? size : ctx->interval;
3404
+ if (ctx->doread) {
3405
+ result = write(ctx->fd, data, nbytes);
3406
+ /* Should not see EINTR (or other errors) */
3407
+ ASSERT(result == nbytes);
3408
+ } else {
3409
+ result = read(ctx->fd, data, nbytes);
3410
+ /* Should not see EINTR (or other errors),
3411
+ * but might get a partial read if we are faster than the writer
3412
+ */
3413
+ ASSERT(result > 0 && result <= nbytes);
3414
+ }
3415
+
3416
+ pthread_kill(ctx->pid, SIGUSR1);
3417
+ size -= result;
3418
+ data += result;
3419
+ }
3420
+ }
3421
+
3422
+ static void sig_func(uv_signal_t* handle, int signum) {
3423
+ uv_signal_stop(handle);
3424
+ }
3425
+
3426
+ static size_t uv_test_fs_buf_offset(uv_buf_t* bufs, size_t size) {
3427
+ size_t offset;
3428
+ /* Figure out which bufs are done */
3429
+ for (offset = 0; size > 0 && bufs[offset].len <= size; ++offset)
3430
+ size -= bufs[offset].len;
3431
+
3432
+ /* Fix a partial read/write */
3433
+ if (size > 0) {
3434
+ bufs[offset].base += size;
3435
+ bufs[offset].len -= size;
3436
+ }
3437
+ return offset;
3438
+ }
3439
+
3440
+ static void test_fs_partial(int doread) {
3441
+ struct thread_ctx ctx;
3442
+ uv_thread_t thread;
3443
+ uv_signal_t signal;
3444
+ int pipe_fds[2];
3445
+ size_t iovcount;
3446
+ uv_buf_t* iovs;
3447
+ char* buffer;
3448
+ size_t index;
3449
+
3450
+ iovcount = 54321;
3451
+
3452
+ iovs = malloc(sizeof(*iovs) * iovcount);
3453
+ ASSERT(iovs != NULL);
3454
+
3455
+ ctx.pid = pthread_self();
3456
+ ctx.doread = doread;
3457
+ ctx.interval = 1000;
3458
+ ctx.size = sizeof(test_buf) * iovcount;
3459
+ ctx.data = malloc(ctx.size);
3460
+ ASSERT(ctx.data != NULL);
3461
+ buffer = malloc(ctx.size);
3462
+ ASSERT(buffer != NULL);
3463
+
3464
+ for (index = 0; index < iovcount; ++index)
3465
+ iovs[index] = uv_buf_init(buffer + index * sizeof(test_buf), sizeof(test_buf));
3466
+
3467
+ loop = uv_default_loop();
3468
+
3469
+ ASSERT(0 == uv_signal_init(loop, &signal));
3470
+ ASSERT(0 == uv_signal_start(&signal, sig_func, SIGUSR1));
3471
+
3472
+ ASSERT(0 == pipe(pipe_fds));
3473
+
3474
+ ctx.fd = pipe_fds[doread];
3475
+ ASSERT(0 == uv_thread_create(&thread, thread_main, &ctx));
3476
+
3477
+ if (doread) {
3478
+ uv_buf_t* read_iovs;
3479
+ int nread;
3480
+ read_iovs = iovs;
3481
+ nread = 0;
3482
+ while (nread < ctx.size) {
3483
+ int result;
3484
+ result = uv_fs_read(loop, &read_req, pipe_fds[0], read_iovs, iovcount, -1, NULL);
3485
+ if (result > 0) {
3486
+ size_t read_iovcount;
3487
+ read_iovcount = uv_test_fs_buf_offset(read_iovs, result);
3488
+ read_iovs += read_iovcount;
3489
+ iovcount -= read_iovcount;
3490
+ nread += result;
3491
+ } else {
3492
+ ASSERT(result == UV_EINTR);
3493
+ }
3494
+ uv_fs_req_cleanup(&read_req);
3495
+ }
3496
+ } else {
3497
+ int result;
3498
+ result = uv_fs_write(loop, &write_req, pipe_fds[1], iovs, iovcount, -1, NULL);
3499
+ ASSERT(write_req.result == result);
3500
+ ASSERT(result == ctx.size);
3501
+ uv_fs_req_cleanup(&write_req);
3502
+ }
3503
+
3504
+ ASSERT(0 == memcmp(buffer, ctx.data, ctx.size));
3505
+
3506
+ ASSERT(0 == uv_thread_join(&thread));
3507
+ ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT));
3508
+
3509
+ ASSERT(0 == close(pipe_fds[1]));
3510
+ uv_close((uv_handle_t*) &signal, NULL);
3511
+
3512
+ { /* Make sure we read everything that we wrote. */
3513
+ int result;
3514
+ result = uv_fs_read(loop, &read_req, pipe_fds[0], iovs, 1, -1, NULL);
3515
+ ASSERT(result == 0);
3516
+ uv_fs_req_cleanup(&read_req);
3517
+ }
3518
+ ASSERT(0 == close(pipe_fds[0]));
3519
+
3520
+ free(iovs);
3521
+ free(buffer);
3522
+ free(ctx.data);
3523
+
3524
+ MAKE_VALGRIND_HAPPY();
3525
+ }
3526
+
3527
+ TEST_IMPL(fs_partial_read) {
3528
+ test_fs_partial(1);
3529
+ return 0;
3530
+ }
3531
+
3532
+ TEST_IMPL(fs_partial_write) {
3533
+ test_fs_partial(0);
3534
+ return 0;
3535
+ }
3536
+
3537
+ #endif/* _WIN32 */
3538
+
3539
+ TEST_IMPL(fs_read_write_null_arguments) {
3540
+ int r;
3541
+
3542
+ r = uv_fs_read(NULL, &read_req, 0, NULL, 0, -1, NULL);
3543
+ ASSERT(r == UV_EINVAL);
3544
+ uv_fs_req_cleanup(&read_req);
3545
+
3546
+ r = uv_fs_write(NULL, &write_req, 0, NULL, 0, -1, NULL);
3547
+ /* Validate some memory management on failed input validation before sending
3548
+ fs work to the thread pool. */
3549
+ ASSERT(r == UV_EINVAL);
3550
+ ASSERT(write_req.path == NULL);
3551
+ ASSERT(write_req.ptr == NULL);
3552
+ #ifdef _WIN32
3553
+ ASSERT(write_req.file.pathw == NULL);
3554
+ ASSERT(write_req.fs.info.new_pathw == NULL);
3555
+ ASSERT(write_req.fs.info.bufs == NULL);
3556
+ #else
3557
+ ASSERT(write_req.new_path == NULL);
3558
+ ASSERT(write_req.bufs == NULL);
3559
+ #endif
3560
+ uv_fs_req_cleanup(&write_req);
3561
+
3562
+ iov = uv_buf_init(NULL, 0);
3563
+ r = uv_fs_read(NULL, &read_req, 0, &iov, 0, -1, NULL);
3564
+ ASSERT(r == UV_EINVAL);
3565
+ uv_fs_req_cleanup(&read_req);
3566
+
3567
+ iov = uv_buf_init(NULL, 0);
3568
+ r = uv_fs_write(NULL, &write_req, 0, &iov, 0, -1, NULL);
3569
+ ASSERT(r == UV_EINVAL);
3570
+ uv_fs_req_cleanup(&write_req);
3571
+
3572
+ /* If the arguments are invalid, the loop should not be kept open */
3573
+ loop = uv_default_loop();
3574
+
3575
+ r = uv_fs_read(loop, &read_req, 0, NULL, 0, -1, fail_cb);
3576
+ ASSERT(r == UV_EINVAL);
3577
+ uv_run(loop, UV_RUN_DEFAULT);
3578
+ uv_fs_req_cleanup(&read_req);
3579
+
3580
+ r = uv_fs_write(loop, &write_req, 0, NULL, 0, -1, fail_cb);
3581
+ ASSERT(r == UV_EINVAL);
3582
+ uv_run(loop, UV_RUN_DEFAULT);
3583
+ uv_fs_req_cleanup(&write_req);
3584
+
3585
+ iov = uv_buf_init(NULL, 0);
3586
+ r = uv_fs_read(loop, &read_req, 0, &iov, 0, -1, fail_cb);
3587
+ ASSERT(r == UV_EINVAL);
3588
+ uv_run(loop, UV_RUN_DEFAULT);
3589
+ uv_fs_req_cleanup(&read_req);
3590
+
3591
+ iov = uv_buf_init(NULL, 0);
3592
+ r = uv_fs_write(loop, &write_req, 0, &iov, 0, -1, fail_cb);
3593
+ ASSERT(r == UV_EINVAL);
3594
+ uv_run(loop, UV_RUN_DEFAULT);
3595
+ uv_fs_req_cleanup(&write_req);
3596
+
3597
+ return 0;
3598
+ }
3599
+
3600
+
3601
+ TEST_IMPL(get_osfhandle_valid_handle) {
3602
+ int r;
3603
+ uv_os_fd_t fd;
3604
+
3605
+ /* Setup. */
3606
+ unlink("test_file");
3607
+
3608
+ loop = uv_default_loop();
3609
+
3610
+ r = uv_fs_open(NULL,
3611
+ &open_req1,
3612
+ "test_file",
3613
+ O_RDWR | O_CREAT,
3614
+ S_IWUSR | S_IRUSR,
3615
+ NULL);
3616
+ ASSERT(r >= 0);
3617
+ ASSERT(open_req1.result >= 0);
3618
+ uv_fs_req_cleanup(&open_req1);
3619
+
3620
+ fd = uv_get_osfhandle(open_req1.result);
3621
+ #ifdef _WIN32
3622
+ ASSERT(fd != INVALID_HANDLE_VALUE);
3623
+ #else
3624
+ ASSERT(fd >= 0);
3625
+ #endif
3626
+
3627
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
3628
+ ASSERT(r == 0);
3629
+ ASSERT(close_req.result == 0);
3630
+ uv_fs_req_cleanup(&close_req);
3631
+
3632
+ /* Cleanup. */
3633
+ unlink("test_file");
3634
+
3635
+ MAKE_VALGRIND_HAPPY();
3636
+ return 0;
3637
+ }
3638
+
3639
+ TEST_IMPL(open_osfhandle_valid_handle) {
3640
+ int r;
3641
+ uv_os_fd_t handle;
3642
+ int fd;
3643
+
3644
+ /* Setup. */
3645
+ unlink("test_file");
3646
+
3647
+ loop = uv_default_loop();
3648
+
3649
+ r = uv_fs_open(NULL,
3650
+ &open_req1,
3651
+ "test_file",
3652
+ O_RDWR | O_CREAT,
3653
+ S_IWUSR | S_IRUSR,
3654
+ NULL);
3655
+ ASSERT(r >= 0);
3656
+ ASSERT(open_req1.result >= 0);
3657
+ uv_fs_req_cleanup(&open_req1);
3658
+
3659
+ handle = uv_get_osfhandle(open_req1.result);
3660
+ #ifdef _WIN32
3661
+ ASSERT(handle != INVALID_HANDLE_VALUE);
3662
+ #else
3663
+ ASSERT(handle >= 0);
3664
+ #endif
3665
+
3666
+ fd = uv_open_osfhandle(handle);
3667
+ #ifdef _WIN32
3668
+ ASSERT(fd > 0);
3669
+ #else
3670
+ ASSERT(fd == open_req1.result);
3671
+ #endif
3672
+
3673
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
3674
+ ASSERT(r == 0);
3675
+ ASSERT(close_req.result == 0);
3676
+ uv_fs_req_cleanup(&close_req);
3677
+
3678
+ /* Cleanup. */
3679
+ unlink("test_file");
3680
+
3681
+ MAKE_VALGRIND_HAPPY();
3682
+ return 0;
3683
+ }
3684
+
3685
+ TEST_IMPL(fs_file_pos_after_op_with_offset) {
3686
+ int r;
3687
+
3688
+ /* Setup. */
3689
+ unlink("test_file");
3690
+ loop = uv_default_loop();
3691
+
3692
+ r = uv_fs_open(loop,
3693
+ &open_req1,
3694
+ "test_file",
3695
+ O_RDWR | O_CREAT,
3696
+ S_IWUSR | S_IRUSR,
3697
+ NULL);
3698
+ ASSERT(r > 0);
3699
+ uv_fs_req_cleanup(&open_req1);
3700
+
3701
+ iov = uv_buf_init(test_buf, sizeof(test_buf));
3702
+ r = uv_fs_write(NULL, &write_req, open_req1.result, &iov, 1, 0, NULL);
3703
+ ASSERT(r == sizeof(test_buf));
3704
+ ASSERT(lseek(open_req1.result, 0, SEEK_CUR) == 0);
3705
+ uv_fs_req_cleanup(&write_req);
3706
+
3707
+ iov = uv_buf_init(buf, sizeof(buf));
3708
+ r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, 0, NULL);
3709
+ ASSERT(r == sizeof(test_buf));
3710
+ ASSERT(strcmp(buf, test_buf) == 0);
3711
+ ASSERT(lseek(open_req1.result, 0, SEEK_CUR) == 0);
3712
+ uv_fs_req_cleanup(&read_req);
3713
+
3714
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
3715
+ ASSERT(r == 0);
3716
+ uv_fs_req_cleanup(&close_req);
3717
+
3718
+ /* Cleanup */
3719
+ unlink("test_file");
3720
+
3721
+ MAKE_VALGRIND_HAPPY();
3722
+ return 0;
3723
+ }
3724
+
3725
+ #ifdef _WIN32
3726
+ static void fs_file_pos_common() {
3727
+ int r;
3728
+
3729
+ iov = uv_buf_init("abc", 3);
3730
+ r = uv_fs_write(NULL, &write_req, open_req1.result, &iov, 1, -1, NULL);
3731
+ ASSERT(r == 3);
3732
+ uv_fs_req_cleanup(&write_req);
3733
+
3734
+ /* Read with offset should not change the position */
3735
+ iov = uv_buf_init(buf, 1);
3736
+ r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, 1, NULL);
3737
+ ASSERT(r == 1);
3738
+ ASSERT(buf[0] == 'b');
3739
+ uv_fs_req_cleanup(&read_req);
3740
+
3741
+ iov = uv_buf_init(buf, sizeof(buf));
3742
+ r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, -1, NULL);
3743
+ ASSERT(r == 0);
3744
+ uv_fs_req_cleanup(&read_req);
3745
+
3746
+ /* Write without offset should change the position */
3747
+ iov = uv_buf_init("d", 1);
3748
+ r = uv_fs_write(NULL, &write_req, open_req1.result, &iov, 1, -1, NULL);
3749
+ ASSERT(r == 1);
3750
+ uv_fs_req_cleanup(&write_req);
3751
+
3752
+ iov = uv_buf_init(buf, sizeof(buf));
3753
+ r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, -1, NULL);
3754
+ ASSERT(r == 0);
3755
+ uv_fs_req_cleanup(&read_req);
3756
+ }
3757
+
3758
+ static void fs_file_pos_close_check(const char *contents, int size) {
3759
+ int r;
3760
+
3761
+ /* Close */
3762
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
3763
+ ASSERT(r == 0);
3764
+ uv_fs_req_cleanup(&close_req);
3765
+
3766
+ /* Confirm file contents */
3767
+ r = uv_fs_open(NULL, &open_req1, "test_file", O_RDONLY, 0, NULL);
3768
+ ASSERT(r >= 0);
3769
+ ASSERT(open_req1.result >= 0);
3770
+ uv_fs_req_cleanup(&open_req1);
3771
+
3772
+ iov = uv_buf_init(buf, sizeof(buf));
3773
+ r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, -1, NULL);
3774
+ ASSERT(r == size);
3775
+ ASSERT(strncmp(buf, contents, size) == 0);
3776
+ uv_fs_req_cleanup(&read_req);
3777
+
3778
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
3779
+ ASSERT(r == 0);
3780
+ uv_fs_req_cleanup(&close_req);
3781
+
3782
+ /* Cleanup */
3783
+ unlink("test_file");
3784
+ }
3785
+
3786
+ static void fs_file_pos_write(int add_flags) {
3787
+ int r;
3788
+
3789
+ /* Setup. */
3790
+ unlink("test_file");
3791
+
3792
+ r = uv_fs_open(NULL,
3793
+ &open_req1,
3794
+ "test_file",
3795
+ O_TRUNC | O_CREAT | O_RDWR | add_flags,
3796
+ S_IWUSR | S_IRUSR,
3797
+ NULL);
3798
+ ASSERT(r > 0);
3799
+ uv_fs_req_cleanup(&open_req1);
3800
+
3801
+ fs_file_pos_common();
3802
+
3803
+ /* Write with offset should not change the position */
3804
+ iov = uv_buf_init("e", 1);
3805
+ r = uv_fs_write(NULL, &write_req, open_req1.result, &iov, 1, 1, NULL);
3806
+ ASSERT(r == 1);
3807
+ uv_fs_req_cleanup(&write_req);
3808
+
3809
+ iov = uv_buf_init(buf, sizeof(buf));
3810
+ r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, -1, NULL);
3811
+ ASSERT(r == 0);
3812
+ uv_fs_req_cleanup(&read_req);
3813
+
3814
+ fs_file_pos_close_check("aecd", 4);
3815
+ }
3816
+ TEST_IMPL(fs_file_pos_write) {
3817
+ fs_file_pos_write(0);
3818
+ fs_file_pos_write(UV_FS_O_FILEMAP);
3819
+
3820
+ MAKE_VALGRIND_HAPPY();
3821
+ return 0;
3822
+ }
3823
+
3824
+ static void fs_file_pos_append(int add_flags) {
3825
+ int r;
3826
+
3827
+ /* Setup. */
3828
+ unlink("test_file");
3829
+
3830
+ r = uv_fs_open(NULL,
3831
+ &open_req1,
3832
+ "test_file",
3833
+ O_APPEND | O_CREAT | O_RDWR | add_flags,
3834
+ S_IWUSR | S_IRUSR,
3835
+ NULL);
3836
+ ASSERT(r > 0);
3837
+ uv_fs_req_cleanup(&open_req1);
3838
+
3839
+ fs_file_pos_common();
3840
+
3841
+ /* Write with offset appends (ignoring offset)
3842
+ * but does not change the position */
3843
+ iov = uv_buf_init("e", 1);
3844
+ r = uv_fs_write(NULL, &write_req, open_req1.result, &iov, 1, 1, NULL);
3845
+ ASSERT(r == 1);
3846
+ uv_fs_req_cleanup(&write_req);
3847
+
3848
+ iov = uv_buf_init(buf, sizeof(buf));
3849
+ r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, -1, NULL);
3850
+ ASSERT(r == 1);
3851
+ ASSERT(buf[0] == 'e');
3852
+ uv_fs_req_cleanup(&read_req);
3853
+
3854
+ fs_file_pos_close_check("abcde", 5);
3855
+ }
3856
+ TEST_IMPL(fs_file_pos_append) {
3857
+ fs_file_pos_append(0);
3858
+ fs_file_pos_append(UV_FS_O_FILEMAP);
3859
+
3860
+ MAKE_VALGRIND_HAPPY();
3861
+ return 0;
3862
+ }
3863
+ #endif
3864
+
3865
+ TEST_IMPL(fs_null_req) {
3866
+ /* Verify that all fs functions return UV_EINVAL when the request is NULL. */
3867
+ int r;
3868
+
3869
+ r = uv_fs_open(NULL, NULL, NULL, 0, 0, NULL);
3870
+ ASSERT(r == UV_EINVAL);
3871
+
3872
+ r = uv_fs_close(NULL, NULL, 0, NULL);
3873
+ ASSERT(r == UV_EINVAL);
3874
+
3875
+ r = uv_fs_read(NULL, NULL, 0, NULL, 0, -1, NULL);
3876
+ ASSERT(r == UV_EINVAL);
3877
+
3878
+ r = uv_fs_write(NULL, NULL, 0, NULL, 0, -1, NULL);
3879
+ ASSERT(r == UV_EINVAL);
3880
+
3881
+ r = uv_fs_unlink(NULL, NULL, NULL, NULL);
3882
+ ASSERT(r == UV_EINVAL);
3883
+
3884
+ r = uv_fs_mkdir(NULL, NULL, NULL, 0, NULL);
3885
+ ASSERT(r == UV_EINVAL);
3886
+
3887
+ r = uv_fs_mkdtemp(NULL, NULL, NULL, NULL);
3888
+ ASSERT(r == UV_EINVAL);
3889
+
3890
+ r = uv_fs_mkstemp(NULL, NULL, NULL, NULL);
3891
+ ASSERT(r == UV_EINVAL);
3892
+
3893
+ r = uv_fs_rmdir(NULL, NULL, NULL, NULL);
3894
+ ASSERT(r == UV_EINVAL);
3895
+
3896
+ r = uv_fs_scandir(NULL, NULL, NULL, 0, NULL);
3897
+ ASSERT(r == UV_EINVAL);
3898
+
3899
+ r = uv_fs_link(NULL, NULL, NULL, NULL, NULL);
3900
+ ASSERT(r == UV_EINVAL);
3901
+
3902
+ r = uv_fs_symlink(NULL, NULL, NULL, NULL, 0, NULL);
3903
+ ASSERT(r == UV_EINVAL);
3904
+
3905
+ r = uv_fs_readlink(NULL, NULL, NULL, NULL);
3906
+ ASSERT(r == UV_EINVAL);
3907
+
3908
+ r = uv_fs_realpath(NULL, NULL, NULL, NULL);
3909
+ ASSERT(r == UV_EINVAL);
3910
+
3911
+ r = uv_fs_chown(NULL, NULL, NULL, 0, 0, NULL);
3912
+ ASSERT(r == UV_EINVAL);
3913
+
3914
+ r = uv_fs_fchown(NULL, NULL, 0, 0, 0, NULL);
3915
+ ASSERT(r == UV_EINVAL);
3916
+
3917
+ r = uv_fs_stat(NULL, NULL, NULL, NULL);
3918
+ ASSERT(r == UV_EINVAL);
3919
+
3920
+ r = uv_fs_lstat(NULL, NULL, NULL, NULL);
3921
+ ASSERT(r == UV_EINVAL);
3922
+
3923
+ r = uv_fs_fstat(NULL, NULL, 0, NULL);
3924
+ ASSERT(r == UV_EINVAL);
3925
+
3926
+ r = uv_fs_rename(NULL, NULL, NULL, NULL, NULL);
3927
+ ASSERT(r == UV_EINVAL);
3928
+
3929
+ r = uv_fs_fsync(NULL, NULL, 0, NULL);
3930
+ ASSERT(r == UV_EINVAL);
3931
+
3932
+ r = uv_fs_fdatasync(NULL, NULL, 0, NULL);
3933
+ ASSERT(r == UV_EINVAL);
3934
+
3935
+ r = uv_fs_ftruncate(NULL, NULL, 0, 0, NULL);
3936
+ ASSERT(r == UV_EINVAL);
3937
+
3938
+ r = uv_fs_copyfile(NULL, NULL, NULL, NULL, 0, NULL);
3939
+ ASSERT(r == UV_EINVAL);
3940
+
3941
+ r = uv_fs_sendfile(NULL, NULL, 0, 0, 0, 0, NULL);
3942
+ ASSERT(r == UV_EINVAL);
3943
+
3944
+ r = uv_fs_access(NULL, NULL, NULL, 0, NULL);
3945
+ ASSERT(r == UV_EINVAL);
3946
+
3947
+ r = uv_fs_chmod(NULL, NULL, NULL, 0, NULL);
3948
+ ASSERT(r == UV_EINVAL);
3949
+
3950
+ r = uv_fs_fchmod(NULL, NULL, 0, 0, NULL);
3951
+ ASSERT(r == UV_EINVAL);
3952
+
3953
+ r = uv_fs_utime(NULL, NULL, NULL, 0.0, 0.0, NULL);
3954
+ ASSERT(r == UV_EINVAL);
3955
+
3956
+ r = uv_fs_futime(NULL, NULL, 0, 0.0, 0.0, NULL);
3957
+ ASSERT(r == UV_EINVAL);
3958
+
3959
+ r = uv_fs_statfs(NULL, NULL, NULL, NULL);
3960
+ ASSERT(r == UV_EINVAL);
3961
+
3962
+ /* This should be a no-op. */
3963
+ uv_fs_req_cleanup(NULL);
3964
+
3965
+ return 0;
3966
+ }
3967
+
3968
+ #ifdef _WIN32
3969
+ TEST_IMPL(fs_exclusive_sharing_mode) {
3970
+ int r;
3971
+
3972
+ /* Setup. */
3973
+ unlink("test_file");
3974
+
3975
+ ASSERT(UV_FS_O_EXLOCK > 0);
3976
+
3977
+ r = uv_fs_open(NULL,
3978
+ &open_req1,
3979
+ "test_file",
3980
+ O_RDWR | O_CREAT | UV_FS_O_EXLOCK,
3981
+ S_IWUSR | S_IRUSR,
3982
+ NULL);
3983
+ ASSERT(r >= 0);
3984
+ ASSERT(open_req1.result >= 0);
3985
+ uv_fs_req_cleanup(&open_req1);
3986
+
3987
+ r = uv_fs_open(NULL,
3988
+ &open_req2,
3989
+ "test_file",
3990
+ O_RDONLY | UV_FS_O_EXLOCK,
3991
+ S_IWUSR | S_IRUSR,
3992
+ NULL);
3993
+ ASSERT(r < 0);
3994
+ ASSERT(open_req2.result < 0);
3995
+ uv_fs_req_cleanup(&open_req2);
3996
+
3997
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
3998
+ ASSERT(r == 0);
3999
+ ASSERT(close_req.result == 0);
4000
+ uv_fs_req_cleanup(&close_req);
4001
+
4002
+ r = uv_fs_open(NULL,
4003
+ &open_req2,
4004
+ "test_file",
4005
+ O_RDONLY | UV_FS_O_EXLOCK,
4006
+ S_IWUSR | S_IRUSR,
4007
+ NULL);
4008
+ ASSERT(r >= 0);
4009
+ ASSERT(open_req2.result >= 0);
4010
+ uv_fs_req_cleanup(&open_req2);
4011
+
4012
+ r = uv_fs_close(NULL, &close_req, open_req2.result, NULL);
4013
+ ASSERT(r == 0);
4014
+ ASSERT(close_req.result == 0);
4015
+ uv_fs_req_cleanup(&close_req);
4016
+
4017
+ /* Cleanup */
4018
+ unlink("test_file");
4019
+
4020
+ MAKE_VALGRIND_HAPPY();
4021
+ return 0;
4022
+ }
4023
+ #endif
4024
+
4025
+ #ifdef _WIN32
4026
+ TEST_IMPL(fs_file_flag_no_buffering) {
4027
+ int r;
4028
+
4029
+ /* Setup. */
4030
+ unlink("test_file");
4031
+
4032
+ ASSERT(UV_FS_O_APPEND > 0);
4033
+ ASSERT(UV_FS_O_CREAT > 0);
4034
+ ASSERT(UV_FS_O_DIRECT > 0);
4035
+ ASSERT(UV_FS_O_RDWR > 0);
4036
+
4037
+ /* FILE_APPEND_DATA must be excluded from FILE_GENERIC_WRITE: */
4038
+ r = uv_fs_open(NULL,
4039
+ &open_req1,
4040
+ "test_file",
4041
+ UV_FS_O_RDWR | UV_FS_O_CREAT | UV_FS_O_DIRECT,
4042
+ S_IWUSR | S_IRUSR,
4043
+ NULL);
4044
+ ASSERT(r >= 0);
4045
+ ASSERT(open_req1.result >= 0);
4046
+ uv_fs_req_cleanup(&open_req1);
4047
+
4048
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
4049
+ ASSERT(r == 0);
4050
+ ASSERT(close_req.result == 0);
4051
+ uv_fs_req_cleanup(&close_req);
4052
+
4053
+ /* FILE_APPEND_DATA and FILE_FLAG_NO_BUFFERING are mutually exclusive: */
4054
+ r = uv_fs_open(NULL,
4055
+ &open_req2,
4056
+ "test_file",
4057
+ UV_FS_O_APPEND | UV_FS_O_DIRECT,
4058
+ S_IWUSR | S_IRUSR,
4059
+ NULL);
4060
+ ASSERT(r == UV_EINVAL);
4061
+ ASSERT(open_req2.result == UV_EINVAL);
4062
+ uv_fs_req_cleanup(&open_req2);
4063
+
4064
+ /* Cleanup */
4065
+ unlink("test_file");
4066
+
4067
+ MAKE_VALGRIND_HAPPY();
4068
+ return 0;
4069
+ }
4070
+ #endif
4071
+
4072
+ #ifdef _WIN32
4073
+ int call_icacls(const char* command, ...) {
4074
+ char icacls_command[1024];
4075
+ va_list args;
4076
+
4077
+ va_start(args, command);
4078
+ vsnprintf(icacls_command, ARRAYSIZE(icacls_command), command, args);
4079
+ va_end(args);
4080
+ return system(icacls_command);
4081
+ }
4082
+
4083
+ TEST_IMPL(fs_open_readonly_acl) {
4084
+ uv_passwd_t pwd;
4085
+ uv_fs_t req;
4086
+ int r;
4087
+
4088
+ /*
4089
+ Based on Node.js test from
4090
+ https://github.com/nodejs/node/commit/3ba81e34e86a5c32658e218cb6e65b13e8326bc5
4091
+
4092
+ If anything goes wrong, you can delte the test_fle_icacls with:
4093
+
4094
+ icacls test_file_icacls /remove "%USERNAME%" /inheritance:e
4095
+ attrib -r test_file_icacls
4096
+ del test_file_icacls
4097
+ */
4098
+
4099
+ /* Setup - clear the ACL and remove the file */
4100
+ loop = uv_default_loop();
4101
+ r = uv_os_get_passwd(&pwd);
4102
+ ASSERT(r == 0);
4103
+ call_icacls("icacls test_file_icacls /remove \"%s\" /inheritance:e",
4104
+ pwd.username);
4105
+ uv_fs_chmod(loop, &req, "test_file_icacls", S_IWUSR, NULL);
4106
+ unlink("test_file_icacls");
4107
+
4108
+ /* Create the file */
4109
+ r = uv_fs_open(loop,
4110
+ &open_req1,
4111
+ "test_file_icacls",
4112
+ O_RDONLY | O_CREAT,
4113
+ S_IRUSR,
4114
+ NULL);
4115
+ ASSERT(r >= 0);
4116
+ ASSERT(open_req1.result >= 0);
4117
+ uv_fs_req_cleanup(&open_req1);
4118
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
4119
+ ASSERT(r == 0);
4120
+ ASSERT(close_req.result == 0);
4121
+ uv_fs_req_cleanup(&close_req);
4122
+
4123
+ /* Set up ACL */
4124
+ r = call_icacls("icacls test_file_icacls /inheritance:r /remove \"%s\"",
4125
+ pwd.username);
4126
+ if (r != 0) {
4127
+ goto acl_cleanup;
4128
+ }
4129
+ r = call_icacls("icacls test_file_icacls /grant \"%s\":RX", pwd.username);
4130
+ if (r != 0) {
4131
+ goto acl_cleanup;
4132
+ }
4133
+
4134
+ /* Try opening the file */
4135
+ r = uv_fs_open(NULL, &open_req1, "test_file_icacls", O_RDONLY, 0, NULL);
4136
+ if (r < 0) {
4137
+ goto acl_cleanup;
4138
+ }
4139
+ uv_fs_req_cleanup(&open_req1);
4140
+ r = uv_fs_close(NULL, &close_req, open_req1.result, NULL);
4141
+ if (r != 0) {
4142
+ goto acl_cleanup;
4143
+ }
4144
+ uv_fs_req_cleanup(&close_req);
4145
+
4146
+ acl_cleanup:
4147
+ /* Cleanup */
4148
+ call_icacls("icacls test_file_icacls /remove \"%s\" /inheritance:e",
4149
+ pwd.username);
4150
+ unlink("test_file_icacls");
4151
+ uv_os_free_passwd(&pwd);
4152
+ ASSERT(r == 0);
4153
+ MAKE_VALGRIND_HAPPY();
4154
+ return 0;
4155
+ }
4156
+ #endif
4157
+
4158
+ #ifdef _WIN32
4159
+ TEST_IMPL(fs_fchmod_archive_readonly) {
4160
+ uv_fs_t req;
4161
+ uv_file file;
4162
+ int r;
4163
+ /* Test clearing read-only flag from files with Archive flag cleared */
4164
+
4165
+ /* Setup*/
4166
+ unlink("test_file");
4167
+ r = uv_fs_open(NULL,
4168
+ &req,
4169
+ "test_file",
4170
+ O_WRONLY | O_CREAT,
4171
+ S_IWUSR | S_IRUSR,
4172
+ NULL);
4173
+ ASSERT(r >= 0);
4174
+ ASSERT(req.result >= 0);
4175
+ file = req.result;
4176
+ uv_fs_req_cleanup(&req);
4177
+ r = uv_fs_close(NULL, &req, file, NULL);
4178
+ ASSERT(r == 0);
4179
+ uv_fs_req_cleanup(&req);
4180
+ /* Make the file read-only and clear archive flag */
4181
+ r = SetFileAttributes("test_file", FILE_ATTRIBUTE_READONLY);
4182
+ ASSERT(r != 0);
4183
+ check_permission("test_file", 0400);
4184
+ /* Try fchmod */
4185
+ r = uv_fs_open(NULL, &req, "test_file", O_RDONLY, 0, NULL);
4186
+ ASSERT(r >= 0);
4187
+ ASSERT(req.result >= 0);
4188
+ file = req.result;
4189
+ uv_fs_req_cleanup(&req);
4190
+ r = uv_fs_fchmod(NULL, &req, file, S_IWUSR, NULL);
4191
+ ASSERT(r == 0);
4192
+ ASSERT(req.result == 0);
4193
+ uv_fs_req_cleanup(&req);
4194
+ r = uv_fs_close(NULL, &req, file, NULL);
4195
+ ASSERT(r == 0);
4196
+ uv_fs_req_cleanup(&req);
4197
+ check_permission("test_file", S_IWUSR);
4198
+
4199
+ /* Restore Archive flag for rest of the tests */
4200
+ r = SetFileAttributes("test_file", FILE_ATTRIBUTE_ARCHIVE);
4201
+ ASSERT(r != 0);
4202
+
4203
+ return 0;
4204
+ }
4205
+
4206
+ TEST_IMPL(fs_invalid_mkdir_name) {
4207
+ uv_loop_t* loop;
4208
+ uv_fs_t req;
4209
+ int r;
4210
+
4211
+ loop = uv_default_loop();
4212
+ r = uv_fs_mkdir(loop, &req, "invalid>", 0, NULL);
4213
+ ASSERT(r == UV_EINVAL);
4214
+
4215
+ return 0;
4216
+ }
4217
+ #endif
4218
+
4219
+ TEST_IMPL(fs_statfs) {
4220
+ uv_fs_t req;
4221
+ int r;
4222
+
4223
+ loop = uv_default_loop();
4224
+
4225
+ /* Test the synchronous version. */
4226
+ r = uv_fs_statfs(NULL, &req, ".", NULL);
4227
+ ASSERT(r == 0);
4228
+ statfs_cb(&req);
4229
+ ASSERT(statfs_cb_count == 1);
4230
+
4231
+ /* Test the asynchronous version. */
4232
+ r = uv_fs_statfs(loop, &req, ".", statfs_cb);
4233
+ ASSERT(r == 0);
4234
+ uv_run(loop, UV_RUN_DEFAULT);
4235
+ ASSERT(statfs_cb_count == 2);
4236
+
4237
+ return 0;
4238
+ }