diff --git a/xCAT-test/autotest/testcase/xcat-inventory/cases.include b/xCAT-test/autotest/testcase/xcat-inventory/cases.include new file mode 100644 index 000000000..2f168d599 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/cases.include @@ -0,0 +1,42 @@ +start:export_import_osimage_with_INCLUDE_in_file +description:This case is used to test xcat-inventory export and import one linux osimage definition which has INCLUDE in the attribute's specified files. The attributes are pkglist, otherpkglist,exlist,synclists,template,postinstall and partitionfile. +label:xcat-inventory +cmd:dir="/tmp/imagedata/";if [ -e "${dir}" ];then mv ${dir} ${dir}".bak"; fi; mkdir -p $dir +check:rc==0 +cmd:dir="/tmp/imagedata/export";if [ -e "${dir}" ];then mv ${dir} ${dir}".bak"; fi; mkdir -p $dir +check:rc==0 +cmd:cp -rf /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage /tmp/imagedata +check:rc==0 +cmd:lsdef -t osimage -o test_osimage >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o test_osimage -z >/tmp/imagedata/test_osimage.org.stanza ;rmdef -t osimage -o test_osimage;fi +check:rc==0 +cmd:cat /tmp/imagedata/test_osimage/test_osimage.stanza |mkdef -z +check:rc==0 +cmd:rm -rf /tmp/imagedata/test_osimage/test_osimage.stanza +cmd:lsdef -t osimage -o test_osimage +check:rc==0 +cmd:xcat-inventory export -t osimage -o test_osimage -d /tmp/imagedata/export +check:output=~The osimage objects has been exported to directory /tmp/imagedata/export +cmd:ls -lFR /tmp/imagedata/export +cmd:diff -r /tmp/imagedata/test_osimage /tmp/imagedata/export/test_osimage/tmp/imagedata/test_osimage/ +check:output=~Only in /tmp/imagedata/test_osimage: file7 +cmd:diff -y /etc/hosts /tmp/imagedata/export/test_osimage/etc/hosts +check:rc==0 +cmd:ls -l /tmp/imagedata/export/test_osimage/tmp/imagedata/test_osimage/file7 +check:rc!=0 +cmd: rmdef -t osimage -o test_osimage +check:rc==0 +cmd:rm -rf /tmp/imagedata/test_osimage +cmd:xcat-inventory import -t osimage -d /tmp/imagedata/export +check:rc==0 +check:output=~Importing object: test_osimage +check:output=~Inventory import successfully! +check:output=~The object test_osimage has been imported +cmd:lsdef -t osimage -o test_osimage +check:rc==0 +cmd:diff -r /tmp/imagedata/export/test_osimage/tmp/imagedata/test_osimage/ /tmp/imagedata/test_osimage +check:rc==0 +cmd: rmdef -t osimage -o test_osimage +check:rc==0 +cmd:dir="/tmp/imagedata"; rm -rf $dir; if [ -d ${dir}".bak" ];then mv ${dir}".bak" $dir; fi +cmd: if [ -e /tmp/imagedata/test_osimage.org.stanza ]; then cat /tmp/imagedata/test_osimage.org.stanza |mkdef -z;fi +end diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/exlist b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/exlist new file mode 100644 index 000000000..0aca75548 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/exlist @@ -0,0 +1,2 @@ +#Test file for exlist +#INCLUDE: /tmp/imagedata/test_osimage/file1.1# diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file1.1 b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file1.1 new file mode 100644 index 000000000..198b31359 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file1.1 @@ -0,0 +1,2 @@ +###Test file without INCLUDE +AAA diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file2.1 b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file2.1 new file mode 100644 index 000000000..ed12e0334 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file2.1 @@ -0,0 +1,2 @@ +###Test file with one INCLUDE in the file +AAA diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file2.2 b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file2.2 new file mode 100644 index 000000000..2949f7bbc --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file2.2 @@ -0,0 +1,2 @@ +###Test file with one INCLUDE in the file +BBB diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file2.3 b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file2.3 new file mode 100644 index 000000000..a76a6b1d3 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file2.3 @@ -0,0 +1,2 @@ +###Test file with one INCLUDE in the file +CCC diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file3.1 b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file3.1 new file mode 100644 index 000000000..182513e3c --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file3.1 @@ -0,0 +1,2 @@ +###Test file with serverl INCLUDE in the file +#INCLUDE:/tmp/imagedata/test_osimage/file3.2# diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file3.2 b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file3.2 new file mode 100644 index 000000000..1bfa29cff --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file3.2 @@ -0,0 +1,2 @@ +###Test file with serverl INCLUDE in the file +#INCLUDE:/tmp/imagedata/test_osimage/file3.3# diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file3.3 b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file3.3 new file mode 100644 index 000000000..19896eaa9 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file3.3 @@ -0,0 +1,2 @@ +###Test file with serverl INCLUDE in the file +AAA diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file4.1 b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file4.1 new file mode 100644 index 000000000..d3d2ee784 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file4.1 @@ -0,0 +1,2 @@ +#Test file for INCLUDE nesting file +#INCLUDE:/tmp/imagedata/test_osimage/file4.2# diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file4.2 b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file4.2 new file mode 100644 index 000000000..71b777ed2 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file4.2 @@ -0,0 +1,2 @@ +#Test file for INCLUDE nesting file +#INCLUDE:/tmp/imagedata/test_osimage/file4.3# diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file4.3 b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file4.3 new file mode 100644 index 000000000..6685ac51a --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file4.3 @@ -0,0 +1,2 @@ +#Test file for INCLUDE nesting file +#INCLUDE:/tmp/imagedata/test_osimage/file4.1# diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file5 b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file5 new file mode 100644 index 000000000..e1d35691b --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file5 @@ -0,0 +1,2 @@ +#Test file for INCLUDE nesting file +#INCLUDE:/etc/hosts# diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file6 b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file6 new file mode 100644 index 000000000..c08a94e4f --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file6 @@ -0,0 +1,2 @@ +#Test file for INCLUDE nesting file +AAA diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file7 b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file7 new file mode 100644 index 000000000..c08a94e4f --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file7 @@ -0,0 +1,2 @@ +#Test file for INCLUDE nesting file +AAA diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/otherpkglist b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/otherpkglist new file mode 100644 index 000000000..918a6c0e8 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/otherpkglist @@ -0,0 +1,4 @@ +#Test file for otherpkglist +#INCLUDE: /tmp/imagedata/test_osimage/file2.1# +#INCLUDE: /tmp/imagedata/test_osimage/file2.2# +#INCLUDE: /tmp/imagedata/test_osimage/file2.3# diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/partitionfile b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/partitionfile new file mode 100644 index 000000000..03f9f6229 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/partitionfile @@ -0,0 +1,2 @@ +#Test file for otherpkglist +#INCLUDE: /tmp/imagedata/test_osimage/file3.1# diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/pkglist b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/pkglist new file mode 100644 index 000000000..f94989176 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/pkglist @@ -0,0 +1,2 @@ +#Test file for otherpkglist +#INCLUDE: /tmp/imagedata/test_osimage/file4.1# diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/postinstall b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/postinstall new file mode 100644 index 000000000..e3c718393 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/postinstall @@ -0,0 +1,2 @@ +#Test file for otherpkglist +#INCLUDE: /tmp/imagedata/test_osimage/file5# diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/synclists b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/synclists new file mode 100644 index 000000000..10e4cb8f8 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/synclists @@ -0,0 +1,2 @@ +#Test file for synclists +#INCLUDE: ./file6# diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/template.tmpl b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/template.tmpl new file mode 100644 index 000000000..75bca79e0 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/template.tmpl @@ -0,0 +1,2 @@ +#Test file for template +#INCLUDE: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/file7# diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/test_osimage.stanza b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/test_osimage.stanza new file mode 100644 index 000000000..04ea48c78 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/imagedata/test_osimage/test_osimage.stanza @@ -0,0 +1,13 @@ +# + +test_osimage: + objtype=osimage + exlist=/tmp/imagedata/test_osimage/exlist + imagetype=linux + otherpkglist=/tmp/imagedata/test_osimage/otherpkglist + partitionfile=/tmp/imagedata/test_osimage/partitionfile + pkglist=/tmp/imagedata/test_osimage/pkglist + postinstall=/tmp/imagedata/test_osimage/postinstall + provmethod=install + synclists=/tmp/imagedata/test_osimage/synclists + template=/tmp/imagedata/test_osimage/template.tmpl