Skip to content

Commit

Permalink
Merge pull request #2 from hjoliver/Develop_1_tests2
Browse files Browse the repository at this point in the history
Finish cat-log tests.
  • Loading branch information
challurip committed May 5, 2017
2 parents 2b1d412 + a78ff6b commit 5a81abc
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions tests/cylc-cat-log/07-editor.t
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


. $(dirname $0)/test_header
set_test_number 12
set_test_number 14

install_suite "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"

Expand All @@ -31,7 +31,8 @@ run_ok "${TEST_NAME}" cylc validate "${SUITE_NAME}"
# Configure a fake editor that just copies a job file to ${DESTFILE}.
create_test_globalrc '' '
[editors]
terminal = my-edit'
terminal = my-edit
gui = my-edit'

# Path to the fake editor.
export PATH="${TEST_SOURCE_DIR}/${TEST_NAME_BASE}"/bin:"${PATH}"
Expand All @@ -43,24 +44,31 @@ run_ok "${TEST_NAME}" cylc run --no-detach "${SUITE_NAME}"
LOG_DIR="$(cylc get-global-config --print-run-dir)/${SUITE_NAME}"
JOB_LOG_DIR="${LOG_DIR}/log/job/1/foo/01"

for OPT_JOBFILE in o_job.out e_job.err u_job.status a_job-activity.log; do
OPT="-${OPT_JOBFILE%_*}"
for OPT_JOBFILE in -o_job.out -e_job.err -u_job.status -a_job-activity.log; do
OPT="${OPT_JOBFILE%_*}"
JOBFILE="${OPT_JOBFILE#*_}"
TEST_NAME="${TEST_NAME_BASE}-${JOBFILE}"
export DESTFILE="${JOBFILE}.edit"
# Check we can view the job log file in the "editor".
run_ok "${TEST_NAME}" cylc cat-log "${OPT}" --teditor "${SUITE_NAME}" foo.1
# Compare viewed (i.e. copied by the fake editor) file with the original.
cmp_ok "${JOBFILE}.edit" "${JOB_LOG_DIR}/${JOBFILE}"
cmp_ok "${DESTFILE}" "${JOB_LOG_DIR}/${JOBFILE}"
done

# Finally, custom file in the job log directory.
# And 'edit' a custom job log file.
cp "${JOB_LOG_DIR}/job.out" "${JOB_LOG_DIR}/job.my-stats"

TEST_NAME="${TEST_NAME_BASE}-custom"
JOBFILE="job.my-stats"
export DESTFILE="${JOBFILE}.edit"
run_ok "${TEST_NAME}" cylc cat-log -f "${JOBFILE}" --teditor "${SUITE_NAME}" foo.1
cmp_ok "${JOBFILE}.edit" "${JOB_LOG_DIR}/${JOBFILE}"
cmp_ok "${DESTFILE}" "${JOB_LOG_DIR}/${JOBFILE}"

# Finally, test --geditor on the 'job' file.
TEST_NAME="${TEST_NAME_BASE}-job"
JOBFILE="job"
export DESTFILE="${JOBFILE}.edit"
run_ok "${TEST_NAME}" cylc cat-log --geditor "${SUITE_NAME}" foo.1
cmp_ok "${DESTFILE}" "${JOB_LOG_DIR}/${JOBFILE}"

purge_suite "${SUITE_NAME}"

0 comments on commit 5a81abc

Please sign in to comment.