LFS 学习日记(第五章构建临时系统之Tcl, Expect, DejaGNU)

2010年06月30日 星期三
http://www.linuxfromscratch.org/lfs/view/6.6/chapter05/tcl.html
此节的Tcl和后面的两节的Expect 和 DejaGNU共计3个软件包是专门用来测试工具链中的 Binutils 和 Gcc 的,以确保这些重要的工具链包工作正常。尽管第五章的测试不是必须的,但是第六章的测试却是必须的。

TCL 语言简介: http://hi.baidu.com/imhuanxi/blog/item/631ed1161b841559f3de32e9.html
TCL 语言是一种跨平台解释性通用脚语言,包括一个可以交互的shell语言和一个可以嵌入应用程序的库,经常被用于快速原型开发、脚本编程、GUI和测试等方面。

man tclsh

1, If there exists a file .tclshrc (or
       tclshrc.tcl  on  the  Windows  platforms)  in the home directory of the
       user, tclsh evaluates the file as a Tcl script just before reading  the
       first command from standard input.
There is no automatic
       evaluation of .tclshrc when the name of a script file is  presented  on
       the  tclsh  command  line,  but the script file can always source it if
       desired.

2,     An even better approach is to start your script files with the  follow‐
       ing three lines:

              #!/bin/sh
              # the next line restarts using tclsh \
              exec tclsh "$0" "$@"

TZ=UTC make test #相当于把TZ的值传入 make test 的脚本中 ( LFS 的一位维护人员说不需要这个 TZ=UTC http://linuxfromscratch.org/pipermail/lfs-support/2010-June/039088.html ,猜测可能是老版本遗留的方法 )
如: TZ=UTC ./test.sh 相当于 test.sh的第一行有 TZ=UTC question: 但是不知道这种用法的依据在何处。

lfs:/mnt/lfs/sources/tcl8.5.8/unix$ time { ./configure --prefix=/tools && make && make install; }

real    0m38.090s
user    0m32.370s
sys    0m28.142s

http://www.linuxfromscratch.org/lfs/view/6.6/chapter05/expect.html
5.12. Expect-5.43.0
expect 可以串联其它交互程序组成自动化的交互程序。
expect 示例:http://blog.chinaunix.net/u1/39385/showart_2251557.html

lfs:/mnt/lfs/sources/expect-5.43$ time { ./configure --prefix=/tools --with-tcl=/tools/lib   --with-tclinclude=/tools/include --with-x=no && make && make SCRIPTS="" install; }

real    0m7.534s
user    0m2.304s
sys    0m6.604s

http://www.linuxfromscratch.org/lfs/view/6.6/chapter05/dejagnu.html
5.13. DejaGNU-1.4.4

dejaGNU 是一个测试框架程序。

lfs:/mnt/lfs/sources/dejagnu-1.4.4$ time { ./configure --prefix=/tools && make install; }

real    0m9.089s
user    0m0.828s
sys    0m5.160s

todo: 在需要的时候,学习 Tcl, expect, dejagnu 的用法和测试程序的编写