Add test cases of '--use-build-count' option. sandbox/xuwc/riscv_test
authorwanchao-xu <wanchao.xu@samsung.com>
Fri, 21 Jun 2024 07:43:14 +0000 (15:43 +0800)
committerwanchao-xu <wanchao.xu@samsung.com>
Mon, 24 Jun 2024 03:07:58 +0000 (11:07 +0800)
Change-Id: I2300688e346aab11544fcb937bf0fea8ac08f380
Signed-off-by: wanchao-xu <wanchao.xu@samsung.com>
cases/build/test_build_use_build_count.case [new file with mode: 0755]
cases/build/test_build_use_build_count_reinstall.case [new file with mode: 0755]

diff --git a/cases/build/test_build_use_build_count.case b/cases/build/test_build_use_build_count.case
new file mode 100755 (executable)
index 0000000..949f21c
--- /dev/null
@@ -0,0 +1,33 @@
+<testcase>
+  <summary>test use-build-count feature</summary>
+  <fixtures>
+    <copy src="tools/create_proj" />
+    <copy src="specs/sw-tools.spec" />
+    <copy src="conf/base.cfg" />
+    <copy src="conf/tizen.conf" />
+  </fixtures>
+  <steps><![CDATA[
+sudo /bin/rm -rf ~/GBS-ROOT/local/repos
+
+sudo /bin/rm -rf ~/GBS-ROOT/local/sources
+
+./create_proj sw-tools.spec
+
+gbs -c base.cfg build sw-tools -A armv7l -D tizen.conf --use-build-count 2>&1 | tee log
+
+test -n "`grep "I have the following modifications for sw-tools.spec:" log`"
+
+test -n "`find ~/GBS-ROOT/local/repos -name "*sw-tools*.1.armv7l.rpm"`"
+
+test -n "`find ~/GBS-ROOT/local/sources -name "*sw-tools*.bcnt"`"
+
+gbs -c base.cfg build sw-tools -A armv7l -D tizen.conf --use-build-count 2>&1 | tee log
+
+test -n "`grep "I have the following modifications for sw-tools.spec:" log`"
+
+test -n "`find ~/GBS-ROOT/local/repos -name "*sw-tools*.2.armv7l.rpm"`"
+
+test -n "`find ~/GBS-ROOT/local/sources -name "*sw-tools*.bcnt"`"
+
+]]></steps>
+</testcase>
diff --git a/cases/build/test_build_use_build_count_reinstall.case b/cases/build/test_build_use_build_count_reinstall.case
new file mode 100755 (executable)
index 0000000..6367583
--- /dev/null
@@ -0,0 +1,56 @@
+<testcase>
+  <summary>test the depended package whether be re-installed</summary>
+  <fixtures>
+    <copy src="tools/create_proj" />
+    <copy src="specs/fake.spec" />
+    <copy src="specs/fake-dev.spec" />
+    <copy src="conf/base.cfg" />
+    <copy src="conf/tizen.conf" />
+  </fixtures>
+  <steps><![CDATA[
+sudo /bin/rm -rf ~/GBS-ROOT/local/repos
+
+sudo /bin/rm -rf ~/GBS-ROOT/local/sources
+
+./create_proj fake.spec
+
+./create_proj fake-dev.spec
+
+sed -i "/^Source/a BuildRequires: fake" fake-dev/packaging/fake-dev.spec
+
+cd fake-dev && git commit -am 'depend on fake' && cd ..
+
+gbs -c base.cfg build fake -A i586 -D tizen.conf --use-build-count 2>&1 | tee log
+
+test -n "`grep "I have the following modifications for fake.spec:" log`"
+
+bcnt_file="`find ~/GBS-ROOT/local/sources -name "*fake*.bcnt"`"
+
+test -n "$bcnt_file"
+
+test "`cat $bcnt_file | tr -d "\n"`" == "1"
+
+gbs -c base.cfg build fake-dev -A i586 -D tizen.conf 2>&1 | tee log
+
+test -n "`find ~/GBS-ROOT/local/repos -name "*fake-dev*.rpm"`"
+
+test -n "`grep "cumulate fake-1.0-1.1" log`"
+
+gbs -c base.cfg build fake -A i586 -D tizen.conf --use-build-count 2>&1 | tee log
+
+test -n "`grep "I have the following modifications for fake.spec:" log`"
+
+bcnt_file2="`find ~/GBS-ROOT/local/sources -name "*fake*.bcnt"`"
+
+test -n "$bcnt_file2"
+
+test "`cat $bcnt_file2 | tr -d "\n"`" == "2"
+
+gbs -c base.cfg build fake-dev -A i586 -D tizen.conf --overwrite 2>&1 | tee log
+
+test -n "`find ~/GBS-ROOT/local/repos -name "*fake-dev*.rpm"`"
+
+test -n "`grep "cumulate fake-1.0-1.2" log`"
+
+]]></steps>
+</testcase>