node.js와 mocha 플러그인을 사용합니다. Jenkins에서 테스트를 실행해야합니다.리눅스에서 명령을 실행하고 변수에 출력을 저장하는 방법
테스트 디렉토리는 '/ home/user/tests' 퍼티를 통해 'make all'명령을 실행하여 테스트를 실행하고 결과를 얻을 수 있습니다. 어떻게 bash 스크립트에서 실행할 수 있습니까?
내가 파일 "start.sh"에서 스크립트 작성이 경우 결과에#!/bin/bash
DIR=$(cd /home/user/tests; make all)
echo "-----------------------START----$stDate--------------------"
echo $DIR
echo "------------------------END-----$enDate--------------------"
을
08:10:58 SSH: EXEC: STDOUT/STDERR from command [start.sh] ...
08:10:59 /bin/sh: mocha: command not found
08:10:59 /bin/sh: mocha: command not found
08:10:59 /bin/sh: mocha: command not found
08:10:59 /bin/sh: line 0: cd: ./messagel: No such file or directory
08:10:59 -----------------------START----Mon Sep 3 08:11:00 EDT 2012--------------------
08:10:59 cd ./tenant; mocha; cd ../; cd ./user; mocha --reporter list; cd ../; cd ./asset; mocha; cd ../; cd ./messagel mocha -t 5000; cd ../;
08:10:59 ------------------------END-----Mon Sep 3 08:11:00 EDT 2012--------------------
08:10:59 SSH: EXEC: completed after 401 ms
하지만이 "메이크"파일에 포함되어 CD를 실행하지 않습니다. /거주자; 모카; cd ../; cd ./user; 모카 - 리포터 목록; cd ../; cd ./asset; 모카; cd ../; cd ./messagel mocha -t 5000; cd ../;