Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8014834

shell tests don't begin with #!/bin/sh

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 8
    • None
    • core-libs
    • None
    • b94

    Description

      Some shell tests contain '#!/bin/sh' but it is not the first line in the script, which is very suspicious. Often, it appears after the copyright block.

      The following simple script detects anomalies. There are a couple of false positives, but most bear looking at:

      -----8<-----
      #!/bin/sh

      files=$(find test -name \*.sh | xargs -n 1 grep --files-with-matches '#!/bin/sh')

      #echo $files

      for f in $files ; do
          line1=$(head -n 1 $f)
          if [ "$line1" != '#!/bin/sh' ]; then
              echo "$f: $line1"
          fi
      done

      ----->8-----

      The results of running this script on jdk/test are as follows:

      $ sh play/badfirstline.sh
      test/java/util/ResourceBundle/Bug6299235Test.sh: #
      test/java/util/PluggableLocale/GenericTest.sh: #
      test/java/util/PluggableLocale/CurrencyNameProviderTest.sh: #
      test/java/util/PluggableLocale/BreakIteratorProviderTest.sh: #
      test/java/util/PluggableLocale/LocaleNameProviderTest.sh: #
      test/java/util/PluggableLocale/CollatorProviderTest.sh: #
      test/java/util/PluggableLocale/NumberFormatProviderTest.sh: #
      test/java/util/PluggableLocale/DecimalFormatSymbolsProviderTest.sh: #
      test/java/util/PluggableLocale/DateFormatSymbolsProviderTest.sh: #
      test/java/util/PluggableLocale/DateFormatProviderTest.sh: #
      test/java/util/PluggableLocale/ClasspathTest.sh: #
      test/java/util/PluggableLocale/CalendarDataProviderTest.sh: #
      test/java/util/PluggableLocale/TimeZoneNameProviderTest.sh: #
      test/java/util/PluggableLocale/ExecTest.sh: #
      test/java/util/Locale/LocaleCategory.sh: #
      test/java/util/Locale/LocaleProviders.sh: #
      test/java/util/Locale/data/deflocale.sh: #
      test/sun/rmi/rmic/newrmic/equivalence/batch.sh: #
      test/sun/rmi/rmic/manifestClassPath/run.sh: #
      test/sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.sh: #
      test/sun/management/jdp/JdpTest.sh: #!/bin/sh -x
      test/start-Xvfb.sh: #!/bin/sh -f
      test/tools/launcher/MultipleJRE.sh: # @test MultipleJRE.sh

      Attachments

        Activity

          People

            emc Eric Mccorkle
            jjg Jonathan Gibbons
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: