Guest User

Untitled

a guest
Jun 18th, 2018
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.29 KB | None | 0 0
  1. commit e0ff40d66f59cb2c8c73aa396898ec89246baa40
  2. Author: Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
  3. Date: Wed Oct 13 18:28:36 2010 +0200
  4.  
  5. Add manual test for mkspecs
  6.  
  7. diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp
  8. index aa55f51..c659adb 100644
  9. --- a/qmake/generators/mac/pbuilder_pbx.cpp
  10. +++ b/qmake/generators/mac/pbuilder_pbx.cpp
  11. @@ -167,6 +167,7 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t)
  12. }
  13. if(tmp_proj.read(fn)) {
  14. if(Option::debug_level) {
  15. + debug_msg(1, "Dumping all variables:");
  16. QMap<QString, QStringList> &vars = tmp_proj.variables();
  17. for(QMap<QString, QStringList>::Iterator it = vars.begin();
  18. it != vars.end(); ++it) {
  19. diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp
  20. index e98831d..df05550 100644
  21. --- a/qmake/generators/metamakefile.cpp
  22. +++ b/qmake/generators/metamakefile.cpp
  23. @@ -217,6 +217,7 @@ BuildsMetaMakefileGenerator::write(const QString &oldpwd)
  24.  
  25. // debugging
  26. if(Option::debug_level) {
  27. + debug_msg(1, "Dumping all variables:");
  28. QMap<QString, QStringList> &vars = project->variables();
  29. for(QMap<QString, QStringList>::Iterator it = vars.begin(); it != vars.end(); ++it) {
  30. if(!it.key().startsWith(".") && !it.value().isEmpty())
  31. diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
  32. index 8582ce1..c98251b 100644
  33. --- a/qmake/generators/win32/msvc_vcproj.cpp
  34. +++ b/qmake/generators/win32/msvc_vcproj.cpp
  35. @@ -459,6 +459,7 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
  36. tmp_vcproj.setProjectFile(&tmp_proj);
  37. Option::qmake_mode = old_mode;
  38. if(Option::debug_level) {
  39. + debug_msg(1, "Dumping all variables:");
  40. QMap<QString, QStringList> &vars = tmp_proj.variables();
  41. for(QMap<QString, QStringList>::Iterator it = vars.begin();
  42. it != vars.end(); ++it) {
  43. diff --git a/tests/manual/mkspecs/.gitignore b/tests/manual/mkspecs/.gitignore
  44. new file mode 100644
  45. index 0000000..403e028
  46. --- /dev/null
  47. +++ b/tests/manual/mkspecs/.gitignore
  48. @@ -0,0 +1,2 @@
  49. +tmp
  50. +specs
  51. diff --git a/tests/manual/mkspecs/test.sh b/tests/manual/mkspecs/test.sh
  52. new file mode 100755
  53. index 0000000..4b723c0
  54. --- /dev/null
  55. +++ b/tests/manual/mkspecs/test.sh
  56. @@ -0,0 +1,64 @@
  57. +#!/bin/bash
  58. +
  59. +if [ "$1" == "--help" ]; then
  60. + echo "Init a clean git repository somewhere and run this test script from that directory. The first run will"
  61. + echo "produce a bunch of specs. This is your baseline. Run 'git add specs' and commit the baseline. Then run"
  62. + echo "this script again, after making changes to the mkspecs. You should see any diffs you produced."
  63. + exit 0
  64. +fi
  65. +
  66. +
  67. +QMAKE_ARGS="-nocache -d"
  68. +SPECS_DIR=$(qmake -query QMAKE_MKSPECS)
  69. +SPECS=$(find -L $SPECS_DIR | grep "qmake.conf" | grep -Ev "common|default" | grep "$1")
  70. +
  71. +SEDI="sed -i"
  72. +if [ $(uname) == "Darwin" ]; then
  73. + # Mac OS X requires an extension, Linux will barf on it being present
  74. + SEDI='sed -i .backup'
  75. +fi
  76. +
  77. +if [ ! -d tmp ]; then
  78. + mkdir tmp
  79. + touch tmp/empty.pro
  80. +fi
  81. +
  82. +if [ ! -d specs ]; then
  83. + mkdir specs
  84. +fi
  85. +
  86. +git checkout -- specs > /dev/null 2>&1
  87. +
  88. +cd tmp
  89. +for spec in $SPECS; do
  90. + spec=$(echo $spec | sed "s|$SPECS_DIR/||" | sed "s|/qmake.conf||")
  91. + output_file=$(echo "$spec.txt" | sed "s|/|-|g")
  92. + echo "Dumping qmake variables for spec '$spec' to 'specs/$output_file'..."
  93. + qmake $QMAKE_ARGS -spec $spec empty.pro 2>&1 |
  94. + sed -n '/Dumping all variables/,$p' |
  95. + grep -Ev "(QMAKE_INTERNAL_INCLUDED_FILES|DISTFILES) ===" > ../specs/$output_file
  96. +
  97. + if [ -n $QTDIR ]; then
  98. + $SEDI "s|$QTDIR|\$QTDIR|g" ../specs/$output_file
  99. + fi
  100. +
  101. + if [ -n $QTSRCDIR ]; then
  102. + $SEDI "s|$QTSRCDIR|\$QTDIR|g" ../specs/$output_file
  103. + fi
  104. +done
  105. +cd ..
  106. +
  107. +rm -f specs/*.backup
  108. +
  109. +git diff --exit-code -- specs > /dev/null
  110. +exit_code=$?
  111. +
  112. +if [ $exit_code -eq 0 ]; then
  113. + echo -e "\nNo diff produced (you did good)"
  114. +else
  115. + # Show the resulting diff
  116. + git diff -- specs
  117. +fi
  118. +
  119. +exit $exit_code
  120. +
Add Comment
Please, Sign In to add comment