Newer
Older
dub_jkp / test / 4-describe-data-1-list.sh
@Martin Nowak Martin Nowak on 29 Sep 2015 5 KB fix OSX test
  1. #!/bin/bash
  2.  
  3. set -e -o pipefail
  4.  
  5. cd "$CURR_DIR"/describe-project
  6.  
  7. temp_file=$(mktemp $(basename $0).XXXXXX)
  8.  
  9. function cleanup {
  10. rm $temp_file
  11. }
  12.  
  13. trap cleanup EXIT
  14.  
  15. if ! $DUB describe --compiler=$DC --data-list \
  16. '--data= target-type , target-path , target-name ' \
  17. '--data= working-directory ' \
  18. --data=main-source-file \
  19. '--data=dflags,lflags' \
  20. '--data=libs, linker-files' \
  21. '--data=source-files, copy-files' \
  22. '--data=versions, debug-versions' \
  23. --data=import-paths \
  24. --data=string-import-paths \
  25. --data=import-files \
  26. --data=string-import-files \
  27. --data=pre-generate-commands \
  28. --data=post-generate-commands \
  29. --data=pre-build-commands \
  30. --data=post-build-commands \
  31. '--data=requirements, options' \
  32. > "$temp_file"; then
  33. die 'Printing project data failed!'
  34. fi
  35.  
  36. # Create the expected output path file to compare against.
  37. expected_file="$CURR_DIR/expected-describe-data-1-list-output"
  38. # --data=target-type
  39. echo "executable" > "$expected_file"
  40. echo >> "$expected_file"
  41. # --data=target-path
  42. echo "$CURR_DIR/describe-project/" >> "$expected_file"
  43. echo >> "$expected_file"
  44. # --data=target-name
  45. echo "describe-project" >> "$expected_file"
  46. echo >> "$expected_file"
  47. # --data=working-directory
  48. echo "$CURR_DIR/describe-project/" >> "$expected_file"
  49. echo >> "$expected_file"
  50. # --data=main-source-file
  51. echo "$CURR_DIR/describe-project/src/dummy.d" >> "$expected_file"
  52. echo >> "$expected_file"
  53. # --data=dflags
  54. echo "--some-dflag" >> "$expected_file"
  55. echo "--another-dflag" >> "$expected_file"
  56. echo >> "$expected_file"
  57. # --data=lflags
  58. echo "--some-lflag" >> "$expected_file"
  59. echo "--another-lflag" >> "$expected_file"
  60. echo >> "$expected_file"
  61. # --data=libs
  62. echo "somelib" >> "$expected_file"
  63. echo "anotherlib" >> "$expected_file"
  64. echo >> "$expected_file"
  65. # --data=linker-files
  66. echo "$CURR_DIR/describe-dependency-3/libdescribe-dependency-3.a" >> "$expected_file"
  67. echo "$CURR_DIR/describe-project/some.a" >> "$expected_file"
  68. echo "$CURR_DIR/describe-dependency-1/dep.a" >> "$expected_file"
  69. echo >> "$expected_file"
  70. # --data=source-files
  71. echo "$CURR_DIR/describe-project/src/dummy.d" >> "$expected_file"
  72. echo "$CURR_DIR/describe-dependency-1/source/dummy.d" >> "$expected_file"
  73. echo >> "$expected_file"
  74. # --data=copy-files
  75. echo "$CURR_DIR/describe-project/data/dummy.dat" >> "$expected_file"
  76. echo "$CURR_DIR/describe-dependency-1/data/*" >> "$expected_file"
  77. echo >> "$expected_file"
  78. # --data=versions
  79. echo "someVerIdent" >> "$expected_file"
  80. echo "anotherVerIdent" >> "$expected_file"
  81. echo "Have_describe_project" >> "$expected_file"
  82. echo "Have_describe_dependency_1" >> "$expected_file"
  83. echo "Have_describe_dependency_2" >> "$expected_file"
  84. echo "Have_describe_dependency_3" >> "$expected_file"
  85. echo >> "$expected_file"
  86. # --data=debug-versions
  87. echo "someDebugVerIdent" >> "$expected_file"
  88. echo "anotherDebugVerIdent" >> "$expected_file"
  89. echo >> "$expected_file"
  90. # --data=import-paths
  91. echo "$CURR_DIR/describe-project/src/" >> "$expected_file"
  92. echo "$CURR_DIR/describe-dependency-1/source/" >> "$expected_file"
  93. echo "$CURR_DIR/describe-dependency-2/some-path/" >> "$expected_file"
  94. echo "$CURR_DIR/describe-dependency-3/dep3-source/" >> "$expected_file"
  95. echo >> "$expected_file"
  96. # --data=string-import-paths
  97. echo "$CURR_DIR/describe-project/views/" >> "$expected_file"
  98. echo "$CURR_DIR/describe-dependency-2/some-extra-string-import-path/" >> "$expected_file"
  99. echo "$CURR_DIR/describe-dependency-3/dep3-string-import-path/" >> "$expected_file"
  100. echo >> "$expected_file"
  101. # --data=import-files
  102. echo "$CURR_DIR/describe-dependency-2/some-path/dummy.d" >> "$expected_file"
  103. echo >> "$expected_file"
  104. # --data=string-import-files
  105. echo "$CURR_DIR/describe-project/views/dummy.d" >> "$expected_file"
  106. #echo "$CURR_DIR/describe-dependency-2/some-extra-string-import-path/dummy.d" >> "$expected_file" # This is missing from result, is that a bug?
  107. echo >> "$expected_file"
  108. # --data=pre-generate-commands
  109. echo "./do-preGenerateCommands.sh" >> "$expected_file"
  110. echo "../describe-dependency-1/dependency-preGenerateCommands.sh" >> "$expected_file"
  111. echo >> "$expected_file"
  112. # --data=post-generate-commands
  113. echo "./do-postGenerateCommands.sh" >> "$expected_file"
  114. echo "../describe-dependency-1/dependency-postGenerateCommands.sh" >> "$expected_file"
  115. echo >> "$expected_file"
  116. # --data=pre-build-commands
  117. echo "./do-preBuildCommands.sh" >> "$expected_file"
  118. echo "../describe-dependency-1/dependency-preBuildCommands.sh" >> "$expected_file"
  119. echo >> "$expected_file"
  120. # --data=post-build-commands
  121. echo "./do-postBuildCommands.sh" >> "$expected_file"
  122. echo "../describe-dependency-1/dependency-postBuildCommands.sh" >> "$expected_file"
  123. echo >> "$expected_file"
  124. # --data=requirements
  125. echo "allowWarnings" >> "$expected_file"
  126. echo "disallowInlining" >> "$expected_file"
  127. #echo "requireContracts" >> "$expected_file" # Not sure if this (from a sourceLib dependency) should be missing from the result
  128. echo >> "$expected_file"
  129. # --data=options
  130. echo "debugMode" >> "$expected_file"
  131. echo "releaseMode" >> "$expected_file"
  132. echo "debugInfo" >> "$expected_file"
  133. echo "warnings" >> "$expected_file"
  134. #echo "stackStomping" >> "$expected_file" # Not sure if this (from a sourceLib dependency) should be missing from the result
  135.  
  136. if ! diff "$expected_file" "$temp_file"; then
  137. die 'The project data did not match the expected output!'
  138. fi
  139.