diff --git a/docs/system_base/ant/tc_ant_test_001.yaml b/docs/system_base/ant/tc_ant_test_001.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b0ab7199eecb437859b95ec044da4eb5565b9050 --- /dev/null +++ b/docs/system_base/ant/tc_ant_test_001.yaml @@ -0,0 +1,23 @@ +作者: wangyang +优先级: P1 +支持架构: noarch +执行方式: 自动 +测试类型: 功能测试 +通用标签: local,ant +用例描述: 验证Ant构建工具是否能够正常执行基本的命令和功能,通过获取帮助信息、禁用配置文件加载、使用特定编译器进行编译、生成调试输出信息、显示项目中定义的目标和描述可用目标等。 +修改人: wangyang + +前置条件: +- + +测试步骤: +- 获取Ant构建工具的帮助信息 +- Ant构建不加载配置文件 +- 运行 Ant 构建,并使用 Jikes 编译器进行编译 +- 使用Ant来执行构建,并生成额外的调试输出信息 +- 显示Ant项目中定义的目标的简要描述 +- 显示当前项目中定义的可用目标以及它们的描述 +- 获取ant版本 + +期望结果: +- 输出符合预期 \ No newline at end of file diff --git a/docs/system_base/ant/tc_ant_test_002.yaml b/docs/system_base/ant/tc_ant_test_002.yaml new file mode 100644 index 0000000000000000000000000000000000000000..044bbd143f38cc262b8b00c5278800623aab33cd --- /dev/null +++ b/docs/system_base/ant/tc_ant_test_002.yaml @@ -0,0 +1,22 @@ +作者: wangyang +优先级: P1 +支持架构: noarch +执行方式: 自动 +测试类型: 功能测试 +通用标签: local,ant +用例描述: 验证在使用Ant构建工具时,通过不同参数设置对构建过程中的输出进行控制的正确性。具体步骤包括显示诊断信息、以最小限度输出执行Ant构建、只打印任务输出和构建失败日志、显示更详细的构建输出、显示调试输出、以及显示有关脚本错误的详细信息 +修改人: wangyang + +前置条件: +- 创建build.xml + +测试步骤: +- 显示Ant的诊断信息 +- 以最小限度输出执行Ant构建 +- 执行Ant构建时只打印任务输出和构建失败日志 +- 执行Ant构建时显示更详细的输出 +- 执行Ant构建时显示调试输出 +- 执行Ant构建时显示有关脚本错误的详细信息 + +期望结果: +- 输出符合预期 \ No newline at end of file diff --git a/docs/system_base/ant/tc_ant_test_003.yaml b/docs/system_base/ant/tc_ant_test_003.yaml new file mode 100644 index 0000000000000000000000000000000000000000..8e03470f65d683b4563f8f61b3076e2253f3db45 --- /dev/null +++ b/docs/system_base/ant/tc_ant_test_003.yaml @@ -0,0 +1,23 @@ +作者: wangyang +优先级: P1 +支持架构: noarch +执行方式: 自动 +测试类型: 功能测试 +通用标签: local,ant +用例描述: 验证Ant构建工具在高级使用场景下的稳定性和可靠性,以及各种参数和选项是否能够正确地控制构建。具体测试步骤包括了设置库路径、将构建过程日志输出到指定文件、指定使用的日志记录器、指定监听器记录构建过程的事件和信息、向构建脚本传递输入,以及禁止从控制台读取输入等操作。 +修改人: wangyang + +前置条件: +- 创建build.xml +- 创建build_for_input.xml + +测试步骤: +- 为ant构建添加库路径/test_added_lib_path,并检查是否添加成功 +- 为ant构建过程日志输出到ant.1.log中,并查看日志是否保存到ant.1.log中 +- 指定了Ant构建时使用的日志记录器,例如使用无横幅日志记录器 +- Ant构建过程中指定一个特定的监听器,将构建过程中的事件和信息记录为XML格式 +- 向Ant构建脚本build_for_input.xml传递了一个包含"hello"和换行符的输入,并执行该构建脚本 +- ant构建过程不在控制台中读取输入 + +期望结果: +- 输出符合预期 \ No newline at end of file diff --git a/docs/system_base/attr/tc_attr_ea_fun007.yaml b/docs/system_base/attr/tc_attr_ea_fun007.yaml new file mode 100644 index 0000000000000000000000000000000000000000..972a614f1f07a3724cfae20e6ff53943aaeb6fd4 --- /dev/null +++ b/docs/system_base/attr/tc_attr_ea_fun007.yaml @@ -0,0 +1,26 @@ +作者: wangyang +优先级: P1 +支持架构: noarch +执行方式: 自动 +测试类型: 功能测试 +通用标签: local,attr +用例描述: 测试attr参数功能 +修改人: wangyang + +前置条件: +- 创建test,创建符号链接test.link + +测试步骤: +- test文件添加扩展属性oe,设置oe=top,检查是否添加成功 +- 获取test扩展属性oe值 +- 获取test扩展属性所有信息 +- 将test的扩展属性oe设置为只读模式 +- test.link添加扩展属性oe,设置oe=top +- 将文件 "test" 的名为 "oe" 的扩展属性设置为 "betop",并且设置了安全标记属性 +- 将文件或目录 "test" 的名为 "oe" 的扩展属性设置为 "beentop",同时设置了安全标记属性 +- 为文件 "test" 设置一个名为 "user.oe" 的用户自定义属性,值为 "extra" +- 以可读的格式递归地获取文件或目录 "test" 的名为 "user.oe" 的用户自定义属性的值,同时显示文件或目录的内容 +- 移除文件 "test" 的名为 "user.oe" 的用户自定义属性 + +期望结果: +- 输出符合预期 diff --git a/plugins/anolis_test_plugin.py b/plugins/anolis_test_plugin.py index 2cc9984fccc84d2bf2337189400ce77ac140450d..677fcc6508468a7e564e3a9a76e61a2a9167c19f 100644 --- a/plugins/anolis_test_plugin.py +++ b/plugins/anolis_test_plugin.py @@ -51,7 +51,7 @@ class AnolisPrePost(JobPre, JobPost): self.cmd('yum install docker -y --enablerepo=os') else: self.cmd('yum install docker -y --enablerepo=Plus') - elif image.ostype == OSType.CENTOS or image.ostype == OSType.ALINUX: + elif image.ostype == OSType.CENTOS or image.ostype == OSType.ALINUX or image.ostype == OSType.NINGOS: self.cmd('yum install -y yum-utils') self.cmd('yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo') self.cmd('yum install docker-ce -y') @@ -168,7 +168,7 @@ class AnolisPrePost(JobPre, JobPost): self.cmd(container_engine+' container prune -f') if image.ostype == OSType.ANOLIS: self.cmd('yum remove -y '+container_engine) - elif image.ostype == OSType.CENTOS or image.ostype == OSType.ALINUX: + elif image.ostype == OSType.CENTOS or image.ostype == OSType.ALINUX or image.ostype == OSType.NINGOS: if 'docker' == container_engine: self.cmd('yum remove -y docker-ce') elif 'podman' == container_engine: diff --git a/plugins/os_env.py b/plugins/os_env.py index 830ef9b5d8d2265a48662d8fd120a2f3d0783365..997424da9de4f1c87b3f13a77a9cbc92f9a0574a 100644 --- a/plugins/os_env.py +++ b/plugins/os_env.py @@ -12,6 +12,7 @@ class OSType(Enum): KOS = 'kos' UOS = 'uos' CQOS = 'cqos' + NINGOS = 'ningos' class Env(Enum): ECS = 'ecs' diff --git a/tests/common/os_env.py b/tests/common/os_env.py index 885deff664a1fb7984bad53fba1fef9b9950d91b..68450ce9b50c3d67d6a74af82ddefdcc6efe52c8 100644 --- a/tests/common/os_env.py +++ b/tests/common/os_env.py @@ -10,6 +10,7 @@ class OSType(Enum): DEBIAN = 'debian' BCLINUX = 'bclinux' KOS = 'kos' + NINGOS = 'ningos' class Env(Enum): ECS = 'ecs' @@ -24,4 +25,4 @@ class Image(object): self.arch = None self.kernel = None self.ostype = None - self.version = None \ No newline at end of file + self.version = None diff --git a/tests/system_base/ant/tc_ant_test_001.py b/tests/system_base/ant/tc_ant_test_001.py new file mode 100644 index 0000000000000000000000000000000000000000..dd4f8c05ab5c292a00925940fcd9ceb477fdd542 --- /dev/null +++ b/tests/system_base/ant/tc_ant_test_001.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python3 +# -*- coding: gbk -*- + +""" +@File: tc_ant_test_001.py +@Time: 2024/07/16 15:42 +@Author: wangyang +@Version: 1.0 +""" + +from common.basetest import LocalTest +from avocado.utils import process + +class Test(LocalTest): + """ + See tc_ant_test_001.yaml for details + + :avocado: tags=P1,noarch,local + """ + PARAM_DIC = {"pkg_name": "ant"} + def setUp(self): + super().setUp(self.PARAM_DIC) + content1 = ''' + + + + + +''' + with open('./build.xml', 'w') as file: + file.write(content1) + content2 = '''export test_value="ant using config antrc"''' + with open('/root/.antrc', 'w') as file: + file.write(content2) + + def test(self): + code,result=self.cmd('ant --h | grep -F "[options] [target [target2 [target3] ...]]"') + self.assertEquals(0, code, f"test failed with option --h with return code {code}") + code,result=self.cmd('ant --help | grep -F "[options] [target [target2 [target3] ...]]"') + self.assertEquals(0, code, f"test failed with option --help with return code {code}") + code,result=self.cmd('ANT_HOME=/usr/share/ant ant --noconfig | grep "env.test_value"') + self.assertEquals(0, code, f"test failed with option --noconfig with return code {code}") + code,result=self.cmd('ant --usejikes |grep -Pz "BUILD SUCCESSFUL"') + self.assertEquals(0, code, f"test failed with option --usejikes with return code {code}") + code,result=self.cmd('ant --execdebug | grep -Pz "BUILD SUCCESSFUL"') + self.assertEquals(0, code, f"test failed with option --execdebug with return code {code}") + code,result=self.cmd('ant -projecthelp | grep -Pz "Default target: test"') + self.assertEquals(0, code, f"test failed with option -projecthelp with return code {code}") + code,result=self.cmd('ant -p | grep -Pz "Default target: test"') + self.assertEquals(0, code, f"test failed with option -p with return code {code}") + code,result=self.cmd('ant -version | grep -Pz "Apache Ant\(TM\) version[\S\s]*compiled on[\S\s]*"') + self.assertEquals(0, code, f"test failed with option -version with return code {code}") + + + def tearDown(self): + super().tearDown(self.PARAM_DIC) + self.cmd('rm -rf build.xml ~/.antrc') + diff --git a/tests/system_base/ant/tc_ant_test_002.py b/tests/system_base/ant/tc_ant_test_002.py new file mode 100644 index 0000000000000000000000000000000000000000..2bc26f58001e4eff048768734c8c3ce11c6bf696 --- /dev/null +++ b/tests/system_base/ant/tc_ant_test_002.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python3 +# -*- coding: gbk -*- + +""" +@File: tc_ant_test_002.py +@Time: 2024/07/16 15:42 +@Author: wangyang +@Version: 1.0 +""" + +from common.basetest import LocalTest +from avocado.utils import process + +class Test(LocalTest): + """ + See tc_ant_test_002.yaml for details + + :avocado: tags=P1,noarch,local + """ + PARAM_DIC = {"pkg_name": "ant"} + def setUp(self): + super().setUp(self.PARAM_DIC) + content1 = ''' + + + + +''' + with open('./build.xml', 'w') as file: + file.write(content1) + + def test(self): + code,result=self.cmd('ant -diagnostics | grep "Ant diagnostics report"') + self.assertEquals(0, code, f"test failed with option -diagnostics with return code {code}") + code,result=self.cmd('ant -quiet | grep -Pz "BUILD SUCCESSFUL"') + self.assertEquals(0, code, f"test failed with option -quiet with return code {code}") + code,result=self.cmd('ant -q | grep -Pz "BUILD SUCCESSFUL"') + self.assertEquals(0, code, f"test failed with option -q with return code {code}") + code,result=self.cmd('ant -silent | grep -Pz "Buildfile[\S\s]*ant test"') + self.assertEquals(0, code, f"test failed with option -silent with return code {code}") + code,result=self.cmd('ant -S | grep -Pz "Buildfile[\S\s]*ant test"') + self.assertEquals(0, code, f"test failed with option -S with return code {code}") + code,result=self.cmd('ant -verbose | grep -Pz "BUILD SUCCESSFUL"') + self.assertEquals(0, code, f"test failed with option -verbose with return code {code}") + code,result=self.cmd('ant -v | grep -Pz "BUILD SUCCESSFUL"') + self.assertEquals(0, code, f"test failed with option -v with return code {code}") + code,result=self.cmd('ant -debug | grep -Pz "BUILD SUCCESSFUL"') + self.assertEquals(0, code, f"test failed with option -debug with return code {code}") + code,result=self.cmd('ant -d | grep -Pz "BUILD SUCCESSFUL"') + self.assertEquals(0, code, f"test failed with option -d with return code {code}") + code,result=self.cmd('ant -e | grep -Pz "BUILD SUCCESSFUL"') + self.assertEquals(0, code, f"test failed with option -e with return code {code}") + code,result=self.cmd('ant -emacs | grep -Pz "BUILD SUCCESSFUL"') + self.assertEquals(0, code, f"test failed with option -emacs with return code {code}") + + def tearDown(self): + super().tearDown(self.PARAM_DIC) + self.cmd('rm -rf build.xml') + diff --git a/tests/system_base/ant/tc_ant_test_003.py b/tests/system_base/ant/tc_ant_test_003.py new file mode 100644 index 0000000000000000000000000000000000000000..85072e6c2db76bada5b4c8f0ddb7a88dc6f02db2 --- /dev/null +++ b/tests/system_base/ant/tc_ant_test_003.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python3 +# -*- coding: gbk -*- + +""" +@File: tc_ant_test_003.py +@Time: 2024/07/16 15:42 +@Author: wangyang +@Version: 1.0 +""" + +from common.basetest import LocalTest +from avocado.utils import process + +class Test(LocalTest): + """ + See tc_ant_test_003.yaml for details + + :avocado: tags=P1,noarch,local + """ + PARAM_DIC = {"pkg_name": "ant"} + def setUp(self): + super().setUp(self.PARAM_DIC) + content1 = ''' + + + + +''' + with open('./build.xml', 'w') as file: + file.write(content1) + content2 = ''' + + + + + +''' + with open('./build_for_input.xml', 'w') as file: + file.write(content2) + + def test(self): + code,result=self.cmd('ant -lib /test_added_lib_path | grep /test_added_lib_path') + self.assertEquals(0, code, f"test failed with option -lib with return code {code}") + code,result=self.cmd('ant -logfile ant.1.log && grep "yourclasspath" ant.1.log') + self.assertEquals(0, code, f"test failed with option -logfile with return code {code}") + code,result=self.cmd('ant -l ant.2.log && grep "yourclasspath" ant.2.log') + self.assertEquals(0, code, f"test failed with option -l with return code {code}") + code,result=self.cmd('ant -logger org.apache.tools.ant.NoBannerLogger | grep "yourclasspath"') + self.assertEquals(0, code, f"test failed with option -logger with return code {code}") + code,result=self.cmd('ant -listener org.apache.tools.ant.XmlLogger | grep "yourclasspath"') + self.assertEquals(0, code, f"test failed with option -listener with return code {code}") + code,result=self.cmd('echo -e "hello" | ant -f build_for_input.xml | grep -F "hello"') + self.assertEquals(0, code, f"test failed with option -f with return code {code}") + code,result=self.cmd('echo -e "hello\n" | ant -file build_for_input.xml | grep -F "hello"') + self.assertEquals(0, code, f"test failed with option -file with return code {code}") + code,result=self.cmd('echo -e "hello\n" | ant -buildfile build_for_input.xml | grep -F "hello"') + self.assertEquals(0, code, f"test failed with option -buildfile with return code {code}") + code,result=self.cmd('ant -noinput -f build_for_input.xml 2>&1 | grep -Pz "BUILD FAILED"') + self.assertEquals(0, code, f"test failed with option -noinput with return code {code}") + + def tearDown(self): + super().tearDown(self.PARAM_DIC) + self.cmd('rm -rf *.xml *.log') + diff --git a/tests/system_base/attr/tc_attr_ea_fun007.py b/tests/system_base/attr/tc_attr_ea_fun007.py new file mode 100644 index 0000000000000000000000000000000000000000..26c73e77fa3319d88275dfac7f28d93d5fa5fc20 --- /dev/null +++ b/tests/system_base/attr/tc_attr_ea_fun007.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8 -*- + +""" +@File: tc_attr_ea_fun007.py +@Time: 2024/07/12 11:37 +@Author: wangyang +@Version: 1.0 +""" + +from common.basetest import LocalTest + +class Test(LocalTest): + """ + See tc_attr_ea_fun007.yaml for details + + :avocado: tags=P1,noarch,local + """ + PARAM_DIC = {"pkg_name": "attr"} + def setUp(self): + super().setUp(self.PARAM_DIC) + self.cmd("touch test && ln -s test test.lnk") + + def test(self): + code,result=self.cmd('attr -s "oe" -V "top" test | grep top') + self.assertEquals(0, code, f"common attr -s failed with return code {code}") + code,result=self.cmd('attr -g "oe" test | grep "top"') + self.assertEquals(0, code, f"common attr -g failed with return code {code}") + code,result=self.cmd('attr -l test | grep oe') + self.assertEquals(0, code, f"common attr -l failed with return code {code}") + code,result=self.cmd('attr -r oe test') + self.assertEquals(0, code, f"common attr -r failed with return code {code}") + code,result=self.cmd('attr -Lq -s "oe" -V "top" test.lnk') + self.assertEquals(0, code, f"common attr -Lq -s failed with return code {code}") + code,result=self.cmd('attr -Rq -s "oe" -V "betop" test') + self.assertEquals(0, code, f"common attr -Rq -s failed with return code {code}") + code,result=self.cmd('attr -Sq -s "oe" -V "beentop" test') + self.assertEquals(0, code, f"common attr -Sq -s failed with return code {code}") + code,result=self.cmd('setfattr -n user.oe -v extra -h test') + self.assertEquals(0, code, f"common attr -n failed with return code {code}") + code,result=self.cmd('getfattr -hRLP -n user.oe -d test') + self.assertEquals(0, code, f"common attr -hRLP failed with return code {code}") + code,result=self.cmd('setfattr -x user.oe -h test') + self.assertEquals(0, code, f"common attr -x failed with return code {code}") + + def tearDown(self): + super().tearDown(self.PARAM_DIC) + self.cmd("rm -f test.lnk test")