Changeset f5f857d for LFS/lfs.xsl


Ignore:
Timestamp:
09/25/2007 09:34:03 PM (17 years ago)
Author:
Manuel Canales Esparcia <manuel@…>
Branches:
experimental
Children:
c5ae20a
Parents:
5a4f6a7
Message:

Set $TEST_LOG from inside the build scripts.
There is no need now to use the envars file.
Optimize support must be moved to an XSL-based code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LFS/lfs.xsl

    r5a4f6a7 rf5f857d  
    4848
    4949<!-- ########### NAMED USER TEMPLATES TO ALLOW CUSTOMIZATIONS ############## -->
     50<!-- ############ Maybe should be placed on a separate file ################ -->
    5051
    5152    <!-- Hock for user header additions -->
     
    145146
    146147    <!-- Hock for creating a custom tools directory containing scripts
    147          to be run after the system has been built -->
     148         to be run after the system has been built
     149         (to be moved to a separate file) -->
    148150  <xsl:template name="custom-tools">
    149151      <!-- Fixed directory and ch_order values -->
     
    246248         and reset the seconds counter -->
    247249  <xsl:template name="unpack">
    248     <xsl:choose>
    249       <xsl:when test="ancestor::chapter[@id='chapter-temporary-tools']">
    250         <xsl:text>cd $SRCDIR</xsl:text>
    251       </xsl:when>
    252       <xsl:otherwise>
    253         <xsl:text>cd /sources</xsl:text>
    254       </xsl:otherwise>
    255     </xsl:choose>
    256     <xsl:text>
     250    <xsl:text>cd </xsl:text>
     251    <xsl:if test="ancestor::chapter[@id='chapter-temporary-tools']">
     252      <xsl:text>$LFS</xsl:text>
     253    </xsl:if>
     254    <xsl:text>/sources
    257255PKGDIR=`tar -tf $TARBALL | head -n1 | sed -e 's@^./@@;s@/.*@@'`
    258256if [ -d $PKGDIR ]; then
     
    292290    <!-- Remove sources and build dirs, skipping it from seconds meassurament -->
    293291  <xsl:template name="clean_sources">
    294     <xsl:choose>
    295       <xsl:when test="ancestor::chapter[@id='chapter-temporary-tools']">
    296         <xsl:text>cd $SRCDIR</xsl:text>
    297       </xsl:when>
    298       <xsl:otherwise>
    299         <xsl:text>cd /sources</xsl:text>
    300       </xsl:otherwise>
    301     </xsl:choose>
    302     <xsl:text>
     292    <xsl:text>cd </xsl:text>
     293    <xsl:if test="ancestor::chapter[@id='chapter-temporary-tools']">
     294      <xsl:text>$LFS</xsl:text>
     295    </xsl:if>
     296    <xsl:text>/sources
    303297SECS=$SECONDS
    304298rm -rf $PKGDIR
     
    368362
    369363
    370     <!-- Adds blfs-tool support scripts -->
     364    <!-- Check if a package testsuite must be run -->
     365  <xsl:template name="run_this_test">
     366    <xsl:choose>
     367      <xsl:when test=".//userinput[@remap='test']">
     368        <xsl:choose>
     369            <!-- No testsuites run on level 0 -->
     370          <xsl:when test="$testsuite = '0'">0</xsl:when>
     371            <!-- On level 1, only final system toolchain testsuites are run -->
     372          <xsl:when test="$testsuite = '1' and
     373                          not(@id='ch-system-gcc') and
     374                          not(@id='ch-system-glibc') and
     375                          not(@id='ch-system-binutils')">0</xsl:when>
     376            <!-- On level 2, temp tools testsuites are not run -->
     377          <xsl:when test="$testsuite = '2' and
     378                          ../@id='chapter-temporary-tools'">0</xsl:when>
     379          <xsl:otherwise>1</xsl:otherwise>
     380        </xsl:choose>
     381      </xsl:when>
     382      <xsl:otherwise>0</xsl:otherwise>
     383    </xsl:choose>
     384  </xsl:template>
     385
     386
     387    <!-- Adds blfs-tool support scripts (to be moved to a separate file) -->
    371388  <xsl:template name="blfs-tool">
    372389      <!-- Fixed directory and ch_order values -->
     
    476493        <!-- Script build order -->
    477494      <xsl:variable name="order" select="concat($dirname,'/',$ch_order,'_',$sect1_order)"/>
     495        <!-- Must the package test suite, if any, be run? -->
     496      <xsl:variable name="run_this_test">
     497        <xsl:call-template name="run_this_test"/>
     498      </xsl:variable>
    478499        <!-- Hock to insert scripts before the current one -->
    479500      <xsl:call-template name="insert_script_before">
     
    487508        <xsl:apply-templates select="sect1info[@condition='script']">
    488509          <xsl:with-param name="phase" select="$filename"/>
     510          <xsl:with-param name="run_this_test" select="$run_this_test"/>
     511          <xsl:with-param name="testlogfile" select="concat($ch_order,'_',$sect1_order,'-',$filename)"/>
    489512        </xsl:apply-templates>
    490513        <xsl:call-template name="disk_usage"/>
     
    494517        <xsl:call-template name="user_pre_commands"/>
    495518        <xsl:call-template name="pre_commands"/>
    496         <xsl:apply-templates select=".//screen"/>
     519        <xsl:apply-templates select=".//screen">
     520          <xsl:with-param name="run_this_test" select="$run_this_test"/>
     521        </xsl:apply-templates>
    497522        <xsl:call-template name="post_commands"/>
    498523        <xsl:call-template name="user_footer"/>
     
    514539    <!-- sect1info -->
    515540  <xsl:template match="sect1info">
     541      <!-- Used to set and initialize the testuite log file -->
     542    <xsl:param name="testlogfile" select="foo"/>
     543    <xsl:param name="run_this_test" select="foo"/>
    516544      <!-- Build phase (base file name) to be used for PM -->
    517545    <xsl:param name="phase" select="foo"/>
     
    524552      <!-- Tarball name -->
    525553    <xsl:apply-templates select="address"/>
     554    <xsl:if test="$run_this_test = '1'">
     555      <xsl:text>&#xA;TEST_LOG=</xsl:text>
     556      <xsl:if test="ancestor::chapter[@id='chapter-temporary-tools']">
     557        <xsl:text>$LFS</xsl:text>
     558      </xsl:if>
     559      <xsl:text>/jhalfs/test-logs/</xsl:text>
     560      <xsl:value-of select="$testlogfile"/>
     561      <xsl:text>&#xA;echo -e "\n`date`\n" > $TEST_LOG</xsl:text>
     562    </xsl:if>
    526563    <xsl:text>&#xA;&#xA;</xsl:text>
    527564  </xsl:template>
     
    568605    <!-- screen -->
    569606  <xsl:template match="screen">
     607    <xsl:param name="run_this_test" select="foo"/>
    570608    <xsl:if test="child::* = userinput and not(@role = 'nodump')">
    571609      <xsl:call-template name="top_screen_build_fixes"/>
    572       <xsl:apply-templates/>
     610      <xsl:apply-templates>
     611        <xsl:with-param name="run_this_test" select="$run_this_test"/>
     612      </xsl:apply-templates>
    573613      <xsl:call-template name="bottom_screen_build_fixes"/>
    574614      <xsl:text>&#xA;</xsl:text>
    575615    </xsl:if>
     616  </xsl:template>
     617
     618
     619    <!-- userinput @remap='test' -->
     620  <xsl:template match="userinput[@remap='test']">
     621    <xsl:param name="run_this_test" select="foo"/>
     622    <xsl:apply-templates select="." mode="test">
     623      <xsl:with-param name="run_this_test" select="$run_this_test"/>
     624    </xsl:apply-templates>
    576625  </xsl:template>
    577626
     
    592641  <xsl:template match="userinput[@remap='make']">
    593642    <xsl:apply-templates select="." mode="make"/>
    594   </xsl:template>
    595 
    596 
    597     <!-- userinput @remap='test' -->
    598   <xsl:template match="userinput[@remap='test']">
    599     <xsl:apply-templates select="." mode="test"/>
    600643  </xsl:template>
    601644
     
    670713    <!-- mode test  -->
    671714  <xsl:template match="userinput" mode="test">
    672     <xsl:choose>
    673         <!-- No testsuites run on level 0 -->
    674       <xsl:when test="$testsuite = '0'"/>
    675         <!-- On level 1, only final system toolchain testsuites are run -->
    676       <xsl:when test="$testsuite = '1' and
    677                       not(ancestor::sect1[@id='ch-system-gcc']) and
    678                       not(ancestor::sect1[@id='ch-system-glibc']) and
    679                       not(ancestor::sect1[@id='ch-system-binutils'])"/>
    680         <!-- On level 2, temp tools testsuites are not run -->
    681       <xsl:when test="$testsuite = '2' and
    682                       ancestor::chapter[@id='chapter-temporary-tools']"/>
    683         <!-- Start testsuites command fixes -->
    684       <xsl:otherwise>
    685         <xsl:choose>
    686             <!-- Final system Glibc -->
    687           <xsl:when test="contains(string(),'glibc-check-log')">
    688             <xsl:value-of select="substring-before(string(),'2&gt;&amp;1')"/>
    689             <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true</xsl:text>
    690           </xsl:when>
    691             <!-- Module-Init-Tools -->
    692           <xsl:when test="ancestor::sect1[@id='ch-system-module-init-tools']
    693                           and contains(string(),'make check')">
    694             <xsl:value-of select="substring-before(string(),' check')"/>
    695             <xsl:if test="$bomb-testsuite = 'n'">
    696               <xsl:text> -k</xsl:text>
    697             </xsl:if>
    698             <xsl:text> check &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
    699             <xsl:if test="$bomb-testsuite = 'n'">
    700               <xsl:text> || true</xsl:text>
    701             </xsl:if>
    702             <xsl:value-of select="substring-after(string(),' check')"/>
    703           </xsl:when>
    704             <!-- If the book uses -k, the testsuite should never bomb -->
    705           <xsl:when test="contains(string(),'make -k ')">
    706             <xsl:apply-templates select="." mode="default"/>
    707             <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true</xsl:text>
    708           </xsl:when>
    709             <!-- Extra commands in Binutils and GCC -->
    710           <xsl:when test="contains(string(),'test_summary') or
    711                           contains(string(),'expect -c')">
    712             <xsl:apply-templates select="." mode="default"/>
    713             <xsl:text> &gt;&gt; $TEST_LOG</xsl:text>
    714           </xsl:when>
    715             <!-- Remaining extra testsuite commads that don't need be hacked -->
    716           <xsl:when test="not(contains(string(),'make '))">
    717             <xsl:apply-templates select="." mode="default"/>
    718           </xsl:when>
    719             <!-- Normal testsites run -->
    720           <xsl:otherwise>
    721             <xsl:choose>
    722                 <!-- No bomb on failures -->
    723               <xsl:when test="$bomb-testsuite = 'n'">
    724                 <xsl:value-of select="substring-before(string(),'make ')"/>
    725                 <xsl:text>make -k </xsl:text>
    726                 <xsl:value-of select="substring-after(string(),'make ')"/>
    727                 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true</xsl:text>
    728               </xsl:when>
    729                 <!-- Bomb at the first failure -->
    730               <xsl:otherwise>
    731                 <xsl:apply-templates select="." mode="default"/>
    732                 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
    733               </xsl:otherwise>
    734             </xsl:choose>
    735           </xsl:otherwise>
    736         </xsl:choose>
    737       </xsl:otherwise>
    738     </xsl:choose>
     715    <xsl:param name="run_this_test" select="foo"/>
     716    <xsl:if test="$run_this_test = '1'">
     717      <xsl:choose>
     718          <!-- Final system Glibc -->
     719        <xsl:when test="contains(string(),'glibc-check-log')">
     720          <xsl:value-of select="substring-before(string(),'2&gt;&amp;1')"/>
     721          <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true</xsl:text>
     722        </xsl:when>
     723          <!-- Module-Init-Tools -->
     724        <xsl:when test="ancestor::sect1[@id='ch-system-module-init-tools']
     725                        and contains(string(),'make check')">
     726          <xsl:value-of select="substring-before(string(),' check')"/>
     727          <xsl:if test="$bomb-testsuite = 'n'">
     728            <xsl:text> -k</xsl:text>
     729          </xsl:if>
     730          <xsl:text> check &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
     731          <xsl:if test="$bomb-testsuite = 'n'">
     732            <xsl:text> || true</xsl:text>
     733          </xsl:if>
     734          <xsl:value-of select="substring-after(string(),' check')"/>
     735        </xsl:when>
     736          <!-- If the book uses -k, the testsuite should never bomb -->
     737        <xsl:when test="contains(string(),'make -k ')">
     738          <xsl:apply-templates select="." mode="default"/>
     739          <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true</xsl:text>
     740        </xsl:when>
     741          <!-- Extra commands in Binutils and GCC -->
     742        <xsl:when test="contains(string(),'test_summary') or
     743                        contains(string(),'expect -c')">
     744          <xsl:apply-templates select="." mode="default"/>
     745          <xsl:text> &gt;&gt; $TEST_LOG</xsl:text>
     746        </xsl:when>
     747          <!-- Remaining extra testsuite commads that don't need be hacked -->
     748        <xsl:when test="not(contains(string(),'make '))">
     749          <xsl:apply-templates select="." mode="default"/>
     750        </xsl:when>
     751          <!-- Normal testsites run -->
     752        <xsl:otherwise>
     753          <xsl:choose>
     754              <!-- No bomb on failures -->
     755            <xsl:when test="$bomb-testsuite = 'n'">
     756              <xsl:value-of select="substring-before(string(),'make ')"/>
     757              <xsl:text>make -k </xsl:text>
     758              <xsl:value-of select="substring-after(string(),'make ')"/>
     759              <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true</xsl:text>
     760            </xsl:when>
     761              <!-- Bomb at the first failure -->
     762            <xsl:otherwise>
     763              <xsl:apply-templates select="." mode="default"/>
     764              <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
     765            </xsl:otherwise>
     766          </xsl:choose>
     767        </xsl:otherwise>
     768      </xsl:choose>
     769    </xsl:if>
    739770  </xsl:template>
    740771
Note: See TracChangeset for help on using the changeset viewer.