forked from caltechlibrary/irdmtools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_eprint2rdm.bash
executable file
·56 lines (50 loc) · 1.36 KB
/
test_eprint2rdm.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
#
# Run some command line tests to confirm working cli
#
RC_FILE="test_eprint2rdm.rc"
if ! test -d "testout"; then
mkdir -p testout
fi
if [[ ! -f "$RC_FILE" ]]; then
echo "Missing $RC_FILE for testing eprint2rdm with authors.caltechlibrary.dev"
exit 1
fi
#
# Basic get keys and harvest
#
. test_eprint2rdm.rc
if [[ "$C_NAME" = "" ]]; then
echo "C_NAME not set, aborting"
exit 1
fi
if [[ "$EPRINT_HOST" = "" ]]; then
echo "EPRINT_HOST not set, aborting"
exit 1
fi
if [[ "$EPRINT_USER" = "" ]]; then
echo "EPRINT_USER not set, aborting"
fi
if [[ "$EPRINT_PASSWORD" = "" ]]; then
echo "EPRINT_PASSWORD not set, aborting"
fi
echo "Testing basics using $RC_FILE, get all ids, harvesting to a dataset"
if [[ -d "$C_NAME" ]]; then
echo "Using existing collection, $C_NAME"
else
echo "Creating $C_NAME for test"
dataset init "$C_NAME" "sqlite://collection.sqlite"
fi
if test -f testout/eprintids.txt; then
echo "Using testout/eprintids.txt"
else
if ! time ./bin/eprint2rdm -all-ids "$EPRINT_HOST" >testout/eprintids.txt; then
echo "Failed to complete eprint2rdm -all-ids $EPRINT_HOST"
exit 1
fi
fi
if ! time ./bin/eprint2rdm -id-list testout/eprintids.txt -harvest "$C_NAME" "$EPRINT_HOST"; then
ceho "Failed to complete eprint2rdm -id-list testout/eprintids.txt -harvest $C_NAME $EPRINT_HOST"
exit 1
fi
echo "OK, Tests completed."