diff options
author | Khem Raj <raj.khem@gmail.com> | 2012-07-31 18:56:15 +0000 |
---|---|---|
committer | Koen Kooi <koen@dominion.thruhere.net> | 2012-08-07 12:25:25 +0200 |
commit | bc58a1e1c0f6e1c651568c68c47ab63e4cfc0e7b (patch) | |
tree | 1f71917374b45822c49a34b03d04c7c5119e1911 | |
parent | 697b369635031d77787cf553c323f96eda44b6d1 (diff) | |
download | meta-openembedded-bc58a1e1c0f6e1c651568c68c47ab63e4cfc0e7b.tar.gz |
testlab.bbclass: Delete
This functionality is now provided by buildhistory as well.
so lets remove it in favor of that
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
-rw-r--r-- | meta-oe/classes/testlab.bbclass | 114 |
1 files changed, 0 insertions, 114 deletions
diff --git a/meta-oe/classes/testlab.bbclass b/meta-oe/classes/testlab.bbclass deleted file mode 100644 index c097e9e65..000000000 --- a/meta-oe/classes/testlab.bbclass +++ /dev/null | |||
@@ -1,114 +0,0 @@ | |||
1 | # | ||
2 | # Performs various tests and analysises on images | ||
3 | # | ||
4 | # Copyright (C) 2007, 2008 Koen Kooi <koen@openembedded.org> | ||
5 | |||
6 | # The current features are: | ||
7 | # 1) dump a list of installed packages | ||
8 | # 2) dump a list of sizes of installed packages | ||
9 | # 3) dependency graphs of installed packages | ||
10 | |||
11 | # See | ||
12 | # * http://dominion.thruhere.net/koen/cms/the-testlab-strikes-again | ||
13 | # * http://dominion.thruhere.net/koen/cms/package-relations-inside-images | ||
14 | # for use cases | ||
15 | |||
16 | # TODO: | ||
17 | # * log information to a server for safekeeping | ||
18 | # * use git notes to record this info into the scm | ||
19 | # * add test suite to run on the target device | ||
20 | |||
21 | |||
22 | # Needs 'dot', 'opkg-cl' | ||
23 | |||
24 | do_testlab() { | ||
25 | if [ -e ${IMAGE_ROOTFS}/etc/opkg ] && [ "${ONLINE_PACKAGE_MANAGEMENT}" = "full" ] ; then | ||
26 | |||
27 | IPKG_TMP_DIR="${IMAGE_ROOTFS}-tmp" | ||
28 | IPKG_ARGS="-f ${STAGING_ETCDIR_NATIVE}/opkg.conf -o ${IMAGE_ROOTFS} -t ${IPKG_TMP_DIR}" | ||
29 | |||
30 | TESTLAB_DIR="${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}-testlab" | ||
31 | mkdir -p ${TESTLAB_DIR}/ | ||
32 | mkdir -p ${IPKG_TMP_DIR}/ | ||
33 | ls -laR ${IMAGE_ROOTFS} > ${TESTLAB_DIR}/files-in-image.txt | ||
34 | |||
35 | echo > ${TESTLAB_DIR}/installed-packages.txt | ||
36 | echo -e "digraph depends {\n node [shape=plaintext]" > ${TESTLAB_DIR}/depends.dot | ||
37 | |||
38 | for pkg in $(opkg-cl ${IPKG_ARGS} list_installed | awk '{print $1}') ; do | ||
39 | name=`opkg-cl ${IPKG_ARGS} info $pkg | grep -B 7 -A 7 "^Status.* \(\(installed\)\|\(unpacked\)\)" | awk '/^Package/ {printf $2"_"}'` | ||
40 | name=$name`opkg-cl ${IPKG_ARGS} info $pkg | grep -B 7 -A 7 "^Status.* \(\(installed\)\|\(unpacked\)\)" | awk -F: '/^Version/ {printf $NF"_"}' | sed 's/^\s*//g'` | ||
41 | name=$name`opkg-cl ${IPKG_ARGS} info $pkg | grep -B 7 -A 7 "^Status.* \(\(installed\)\|\(unpacked\)\)" | awk '/^Archi/ {print $2".ipk"}'` | ||
42 | echo $name >>${TESTLAB_DIR}/installed-packages.txt | ||
43 | |||
44 | for depends in $(opkg-cl ${IPKG_ARGS} info $pkg | grep ^Depends) ; do | ||
45 | echo "$pkg OPP $depends;" | grep -v "(" | grep -v ")" | grep -v "$pkg OPP Depends" | sed -e 's:,::g' -e 's:-:_:g' -e 's:\.:_:g' -e 's:+::g' |sed 's:OPP:->:g' >> ${TESTLAB_DIR}/depends.dot | ||
46 | done | ||
47 | |||
48 | for recommends in $(opkg-cl ${IPKG_ARGS} info $pkg | grep ^Recom) ; do | ||
49 | echo "$pkg OPP $recommends [style=dotted];" | grep -v "(" | grep -v ")" | grep -v "$pkg OPP Recom" | sed -e 's:,::g' -e 's:-:_:g' -e 's:\.:_:g' -e 's:+::g' |sed 's:OPP:->:g' >> ${TESTLAB_DIR}/depends.dot | ||
50 | done | ||
51 | done | ||
52 | |||
53 | echo "}" >> ${TESTLAB_DIR}/depends.dot | ||
54 | rm -rf ${IPKG_TMP_DIR} | ||
55 | |||
56 | grep -v kernel_2 ${TESTLAB_DIR}/depends.dot | grep -v kernel_image > ${TESTLAB_DIR}/depends-nokernel.dot | ||
57 | grep -v libc6 ${TESTLAB_DIR}/depends-nokernel.dot | grep -v libgcc > ${TESTLAB_DIR}/depends-nokernel-nolibc.dot | ||
58 | grep -v update_ ${TESTLAB_DIR}/depends-nokernel-nolibc.dot > ${TESTLAB_DIR}/depends-nokernel-nolibc-noupdate.dot | ||
59 | grep -v kernel_module ${TESTLAB_DIR}/depends-nokernel-nolibc-noupdate.dot > ${TESTLAB_DIR}/depends-nokernel-nolibc-noupdate-nomodules.dot | ||
60 | |||
61 | #dot has some library troubles when run under fakeroot, uncomment at your own risk | ||
62 | #dot -Tpng -o ${TESTLAB_DIR}/image-dependencies.png ${TESTLAB_DIR}/depends.dot | ||
63 | #dot -Tpng -o ${TESTLAB_DIR}/image-dependencies-nokernel-nolibc.png ${TESTLAB_DIR}/depends-nokernel-nolibc.dot | ||
64 | #dot -Tpng -o ${TESTLAB_DIR}/image-dependencies-nokernel-nolibc-noupdate.png ${TESTLAB_DIR}/depends-nokernel-nolibc-noupdate.dot | ||
65 | #dot -Tpng -o ${TESTLAB_DIR}/image-dependencies-nokernel-nolibc-noupdate-nomodules.png ${TESTLAB_DIR}/depends-nokernel-nolibc-noupdate-nomodules.dot | ||
66 | |||
67 | for file in $(cat ${TESTLAB_DIR}/installed-packages.txt) ; do | ||
68 | du -k $(find ${DEPLOY_DIR_IPK} -name "$file") | head -n1 | ||
69 | done | grep "\.ipk" | sed -e s:${DEPLOY_DIR_IPK}::g | sort -n -r | awk '{print $1 "\tKiB " $2}' > ${TESTLAB_DIR}/installed-package-sizes.txt | ||
70 | |||
71 | for file in $(cat ${TESTLAB_DIR}/installed-packages.txt) ; do | ||
72 | echo "`find ${DEPLOY_DIR_IPK} -name "$file" | xargs opkg-list-fields | grep ^License | sed -e 's/^.*:[ \t]*//g'`" '=' $(echo $file | awk -F_ '{print $1}') | ||
73 | done | awk -F= '{printf("%50s:%s\n", $1, $2)}' > ${TESTLAB_DIR}/installed-package-licenses.txt | ||
74 | # Log results to a git controlled directory structure than can be pushed to a remote location | ||
75 | if [ "${TESTLABLOG}" = "remote" ] && [ -n "${TESTLABREMOTEDIR}" ] ; then | ||
76 | TESTLABLOGDIR="${MACHINE_ARCH}/${TCLIBC}/${IMAGE_BASENAME}" | ||
77 | mkdir -p ${TESTLABREMOTEDIR}/${TESTLABLOGDIR} | ||
78 | cp ${TESTLAB_DIR}/*package* ${TESTLAB_DIR}/depends.dot ${TESTLABREMOTEDIR}/${TESTLABLOGDIR} | ||
79 | # force change to record builds where the testlab contents didn't change, but other things (e.g. git rev) did | ||
80 | echo "${MACHINE}: ${IMAGE_BASENAME} configured for ${DISTRO} ${DISTRO_VERSION}" > ${TESTLABREMOTEDIR}/${TESTLABLOGDIR}/build-id | ||
81 | echo "${@testlab_get_layers(bb, d)}" >> ${TESTLABREMOTEDIR}/${TESTLABLOGDIR}/build-id | ||
82 | # This runs inside fakeroot, so the git author is listed as root (or whatever root configured it to be) :( | ||
83 | ( cd ${TESTLABREMOTEDIR}/ | ||
84 | git add ${TESTLABLOGDIR}/* | ||
85 | git commit ${TESTLABLOGDIR}/ -m "${MACHINE}: ${IMAGE_BASENAME} configured for ${DISTRO} ${DISTRO_VERSION} using branch ${METADATA_BRANCH} and revision ${METADATA_REVISION}" --author "testlab <testlab@${DISTRO}>" || true) | ||
86 | fi | ||
87 | fi | ||
88 | } | ||
89 | |||
90 | IMAGE_POSTPROCESS_COMMAND += " do_testlab ;" | ||
91 | |||
92 | def testlab_get_layers(bb, d): | ||
93 | layers = (bb.data.getVar("BBLAYERS", d, 1) or "").split() | ||
94 | layers_branch_rev = ["%-17s = \"%s:%s\"" % (os.path.basename(i), \ | ||
95 | base_get_metadata_git_branch(i, None).strip().strip('()'), \ | ||
96 | base_get_metadata_git_revision(i, None)) \ | ||
97 | for i in layers] | ||
98 | i = len(layers_branch_rev)-1 | ||
99 | p1 = layers_branch_rev[i].find("=") | ||
100 | s1= layers_branch_rev[i][p1:] | ||
101 | while i > 0: | ||
102 | p2 = layers_branch_rev[i-1].find("=") | ||
103 | s2= layers_branch_rev[i-1][p2:] | ||
104 | if s1 == s2: | ||
105 | layers_branch_rev[i-1] = layers_branch_rev[i-1][0:p2] | ||
106 | i -= 1 | ||
107 | else: | ||
108 | i -= 1 | ||
109 | p1 = layers_branch_rev[i].find("=") | ||
110 | s1= layers_branch_rev[i][p1:] | ||
111 | |||
112 | layertext = "Configured Openembedded layers:\n%s\n" % '\n'.join(layers_branch_rev) | ||
113 | return layertext | ||
114 | |||