Lines Matching refs:resCmd

132 void ParseCmdLine(const char *content, TestCmdLine *resCmd)  in ParseCmdLine()  argument
134 if (content == nullptr || resCmd == nullptr) { in ParseCmdLine()
140 (void)memset_s(resCmd, sizeof(TestCmdLine), 0, sizeof(TestCmdLine)); in ParseCmdLine()
144 (void)memset_s(resCmd, sizeof(TestCmdLine), 0, sizeof(TestCmdLine)); in ParseCmdLine()
147 int ret1 = strcpy_s(resCmd->name, MAX_CMD_NAME_LEN, cmd->name); in ParseCmdLine()
148 int ret2 = strcpy_s(resCmd->cmdContent, MAX_CMD_CONTENT_LEN, content + strlen(cmd->name)); in ParseCmdLine()
150 (void)memset_s(resCmd, sizeof(TestCmdLine), 0, sizeof(TestCmdLine)); in ParseCmdLine()
155 void DoCmd(const TestCmdLine *resCmd) in DoCmd() argument
157 if (resCmd == nullptr) { in DoCmd()
161 (void)GetMatchCmd(resCmd->name, &cmdIndex); in DoCmd()
162 DoCmdByIndex(cmdIndex, resCmd->cmdContent, nullptr); in DoCmd()
669 static void CheckCmd(const TestCmdLine *resCmd) in CheckCmd() argument
671 EXPECT_TRUE(strlen(resCmd->name) > 0); in CheckCmd()
672 EXPECT_TRUE(strlen(resCmd->cmdContent) > 0); in CheckCmd()
674 if (strcmp("start ", resCmd->name) == 0) { in CheckCmd()
675 for (size_t i = 0; i < strlen(resCmd->cmdContent); ++i) { in CheckCmd()
676 EXPECT_NE(' ', resCmd->cmdContent[i]); // no spaces in service name in CheckCmd()
678 } else if (strcmp("mkdir ", resCmd->name) == 0) { in CheckCmd()
679 for (size_t i = 0; i < strlen(resCmd->cmdContent); ++i) { in CheckCmd()
680 EXPECT_NE('.', resCmd->cmdContent[i]); // no dots in path string in CheckCmd()
682 } else if (strcmp("chmod ", resCmd->name) == 0) { in CheckCmd()
683 EXPECT_TRUE(strlen(resCmd->cmdContent) >= 6); // 0xxx x at least 6 characters in CheckCmd()
684 EXPECT_EQ('0', resCmd->cmdContent[0]); in CheckCmd()
685 EXPECT_EQ(' ', resCmd->cmdContent[4]); // 4 bytes, after 0xxx must be space in CheckCmd()
687 EXPECT_TRUE(resCmd->cmdContent[i] >= '0' && resCmd->cmdContent[i] <= '7'); in CheckCmd()
689 for (size_t i = 5; i < strlen(resCmd->cmdContent); ++i) { // target starts from index 5 in CheckCmd()
690 EXPECT_NE(' ', resCmd->cmdContent[i]); // no spaces allowed in CheckCmd()
692 } else if (strcmp("chown ", resCmd->name) == 0) { in CheckCmd()
693 EXPECT_TRUE(strlen(resCmd->cmdContent) >= 5); // x y z at least 5 characters in CheckCmd()
694 EXPECT_NE(' ', resCmd->cmdContent[0]); // should not start with space in CheckCmd()
695 … EXPECT_NE(' ', resCmd->cmdContent[strlen(resCmd->cmdContent) - 1]); // should not end with space in CheckCmd()
698 for (size_t i = 1; i < strlen(resCmd->cmdContent); ++i) { in CheckCmd()
699 if (resCmd->cmdContent[i] != ' ') { in CheckCmd()
709 } else if (strcmp("mount ", resCmd->name) == 0) { in CheckCmd()
710 EXPECT_NE(' ', resCmd->cmdContent[0]); // should not start with space in CheckCmd()
711 } else if (strcmp("loadcfg ", resCmd->name) == 0) { in CheckCmd()
712 EXPECT_NE(' ', resCmd->cmdContent[0]); // should not start with space in CheckCmd()
713 } else if (strcmp("export ", resCmd->name) == 0) { in CheckCmd()
714 EXPECT_NE(' ', resCmd->cmdContent[0]); // should not start with space in CheckCmd()
715 } else if (strcmp("exec ", resCmd->name) == 0) { in CheckCmd()
716 EXPECT_NE(' ', resCmd->cmdContent[0]); // should not start with space in CheckCmd()
740 TestCmdLine resCmd; in CheckJob() local
741 (void)memset_s(&resCmd, sizeof(resCmd), 0, sizeof(resCmd)); in CheckJob()
742 ParseCmdLine(cmdLineStr, &resCmd); in CheckJob()
743 CheckCmd(&resCmd); in CheckJob()