@@ -12,6 +12,7 @@ gzip01_sh gzip_tests.sh
cp01_sh cp_tests.sh
ln01_sh ln_tests.sh
mkdir01_sh mkdir_tests.sh
+echo_tests_sh echo_tests.sh
mv01_sh mv_tests.sh
du01_sh du01.sh
df01_sh df01.sh
new file mode 100644
@@ -0,0 +1,11 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2024 UnionTech Ltd.
+# Author: Taotao Ma <mataotao@uniontech.com>
+
+top_srcdir ?= ../../..
+
+include $(top_srcdir)/include/mk/testcases.mk
+
+INSTALL_TARGETS := echo_tests.sh
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
new file mode 100644
@@ -0,0 +1,62 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) Linux Test Project, 2024
+# Copyright (c) 2024 UnionTech Ltd.
+# Author: Taotao Ma <mataotao@uniontech.com>
+#
+# Test basic functionality of lsmod command.
+
+TST_CNT=4
+TST_TESTFUNC=do_test
+TST_NEEDS_TMPDIR=1
+TST_NEEDS_CMDS="echo"
+. tst_test.sh
+
+echo_test()
+{
+ local echo_opt=$1
+ local echo_content=$2
+
+ local echo_cmd="echo $echo_opt $echo_content"
+
+ $echo_cmd > temp 2>&1
+ if [ $? -ne 0 ]; then
+ grep -q -E "unknown option|invalid option" temp
+ if [ $? -eq 0 ]; then
+ tst_res TCONF "$echo_cmd not supported."
+ else
+ tst_res TFAIL "$echo_cmd failed."
+ fi
+ return
+ fi
+
+ line=$(wc -l temp | awk '{print $1}')
+
+ if [ -z "$echo_opt" ];then
+ if [ "$line" -ne 1 ];then
+ tst_res TFAIL "$echo_cmd failed."
+ return
+ fi
+ else
+ if [ "$echo_opt" = "-e" ];then
+ if [ "$line" -ne 2 ];then
+ tst_res TFAIL "$echo_cmd failed."
+ return
+ fi
+ fi
+ fi
+
+ tst_res TPASS "echo passed with $echo_opt option."
+}
+
+do_test()
+{
+ case $1 in
+ 1) echo_test "" "hello\nworld";;
+ 2) echo_test "-e" "hello\nworld";;
+ 3) echo_test "--help";;
+ 4) echo_test "--version";;
+ esac
+}
+
+tst_run
\ No newline at end of file