41.4 Interdependencies of the Aldor Source Files

  41.4.1 test/tcasfiles.list
  41.4.2 test/Makefile.dep
  41.4.3 Dependence on Signature Files

See Section 33.4 for a description. However, instead of generating src/asfiles.list and src/Makefile.dep we generate test/tcasfiles.list and test/Makefile.dep.

Note that test/tcasfiles.list is a superset of src/asfiles.list.

549generate interdependencies of files 470+   (462 542)  470
Makefile.dep: tcasfiles.list $(CODEFILES)
        $(PERL) $(TOOLS)/dependencies.pl \
                tcasfiles.list ${TCLIBRARYNAME} ${PROJECTROOT} > $@

tcasfiles.list: Makefile.asfiles
        $(CP) $(PROJECTROOT)/src/asfiles.list $@
        for f in ${ASFILES}; do \
          echo ${TCLIBRARYNAME} test/$$f ${TCLIBPREFIX} >> $@; \
        done

include Makefile.dep

Defines:
tcasfiles.list, used in chunks 544 and 555.

Uses ASFILES 466, asfiles.list 470, CODEFILES 436, CP 354a, PERL 431b, PROJECTROOT 350, TCLIBPREFIX 541, TCLIBRARYNAME 541, test 357, and TOOLS 428b.

41.4.1 test/tcasfiles.list

The file test/tcasfiles.list is generated via the target tcasfiles.list and given below.

myalps src/myalps/arith my  
myalps src/myalps/binpow my  
myalps src/myalps/copy my  
myalps src/myalps/prtype my  
myalps src/myalps/version my  
testcases test/myalps/binpow tc

41.4.2 test/Makefile.dep

The file test/Makefile.dep generated by tools/dependencies.pl.nw is given below. It is included into test/Makefile.nw. See also Section 33.4.2.

# Generated via  
# /home/hemmecke/SVK/HOME/trunk/projects/Software/allprose/tools/dependencies.pl \  
#   tcasfiles.list \  
#   testcases \  
#   /home/hemmecke/SVK/HOME/trunk/projects/Software/allprose  
libtestcases${LIBPOSTFIX}(tcbinpow.${FILEEXTENSION}):\  
    libmyalps${LIBPOSTFIX}(mybinpow.${FILEEXTENSION})

41.4.3 Dependence on Signature Files

See Section 29.7.2 for the concept of library variants.

A library member depends on the corresponding .as file and the explicitly in the generated file test/Makefile.dep. Furthermore it depends on a .signature.as file, see below.

Note that we must use a static pattern rule here, since only one implicit rule applies and that is given in Section 29.7.2.

551generate signature files 551  (542)  553
$(LIBALMEMBERS): ${LIB}.al(${SUBLIBPREFIX}%.ao): %.signatures.as

Uses LIB 445 and LIBALMEMBERS 447a.

We impose a certain structure on the test files so that it is possible to extract automatically the function signatures from the function implementations.

Convention 30 Test domains must start with the four letters Test in the first column. Test functions must start with test and followed by (): () == after the function name. Although not encouraged, underscores are allowed in names.

The code below checks for the pattern

testXYZ():() ==

where the pattern for XYZ allows any character that can be used in Aldor identifiers. More concretely, we test for the following Perl regular expression.

552testfunction pattern 552  (553)
^\s*test((\w|\d|\?|!|_.)+)\s*\(\s*\)\s*:\s*\(\s*\)\s*==

Uses test 357.

For example,

testAddition(): () == {  
...  
}

would be a correct definition.

Note that we include below \s* in front of #(if|else|elseif|endif) and also in front of #include because NOTANGLE might have produced the wrong indentation for the compiler directives, see Section 41.3. Furthermore, note that we copy lines that #include signature files if the filename is not identical to the .signatures.as file that is currently generated.

553generate signature files 551+   (542)  551
.PRECIOUS: %.signatures.as
%.signatures.as: %.as.nw
        $(MAKE) $(<:%.as.nw=%.as)
        $(PERL) \
            -e ’while (<>) {’\
            -e ’    if (/^\s*(#(if|else|elseif|endif).*)/) {’\
            -e ’        print "$$1\n";’\
            -e ’    } elsif (/^\s*(#include\s+"(.*\.signatures\.as)")\s*/){’\
            -e ’        if ("$$2" ne "$@") {print "$$1\n";}’\
            -e ’    } elsif (/testfunction pattern 552/) {’\
            -e ’        print "test$$1: ()->();\n";’\
            -e ’    } elsif (/^Test((\w|\d|_.)+):/) {’\
            -e ’        print "-- Test$$1\n";’\
            -e ’    }’\
            -e ’}’ $(<:%.as.nw=%.as) > $@

Uses PERL 431b and test 357.