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