home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / dev / misc / hwgrcs / src / rcs.rcsfiles / rcstestamiga,v < prev    next >
Encoding:
Text File  |  1995-06-25  |  10.1 KB  |  537 lines

  1. head    1.1;
  2. access;
  3. symbols
  4.     HWGRCSP12F:1.1
  5.     HWGRCSP11F:1.1
  6.     HWGRCSP10F:1.1
  7.     HWGRCSP9:1.1
  8.     HWGRCSP8F:1.1
  9.     HWGRCSP7F:1.1
  10.     C_15:1.1
  11.     HWGRCSP6F:1.1
  12.     HWGRCSP5F:1.1
  13.     HWGRCSp4:1.1
  14.     HWGRCSp3:1.1
  15.     HWGRCS_Fish:1.1
  16.     HWGRCS:1.1;
  17. locks; strict;
  18. comment    @# @;
  19.  
  20.  
  21. 1.1
  22. date    93.01.18.13.55.01;    author heinz;    state Exp;
  23. branches;
  24. next    ;
  25.  
  26.  
  27. desc
  28. @Start of the AMIGA port of RCS 5.6. I call it HWGRCS now ;^)
  29. Partial port of the rcstest script for the Amiga.
  30. Anybody volunterring to port the rest?
  31. @
  32.  
  33.  
  34. 1.1
  35. log
  36. @Initial revision
  37. @
  38. text
  39. @.key option
  40.  
  41. .BRA {
  42. .KET }
  43.  
  44.  
  45. failat 30
  46.  
  47. Echo "Testing RCS-Installation. Please wait ...*N"
  48.  
  49. If NOT EXISTS ENV:RCS
  50. MakeDir ENV:RCS
  51. MakeDir ENVARC:RCS
  52. EndIf
  53.  
  54. ; Don't use any suffix
  55. Echo "Please reset ENV:RCS/INIT after use of this script or reboot!*N"
  56. SetEnv RCS/INIT -x
  57.  
  58. Set RCSfile RCS.RCSfiles/a.c
  59. Set RCSalt RCS.RCSfiles/a.d
  60. Set lockfile RCS.RCSfiles/a._
  61.  
  62. If {option} EQ -v
  63.     Set q ""
  64. Else
  65.     If {option} gt ""
  66.     Echo "usage: RCSTESTAMIGA [-v]"
  67.     Quit
  68.     Else
  69.     Set q -q
  70.     EndIf
  71. EndIf
  72.  
  73. If NOT EXISTS RCS_link
  74.     MakeDir RCS.RCSfiles
  75.     Echo >RCS_link RCS.RCSfiles
  76. EndIf
  77.  
  78. FailAt 6
  79. Delete >NIL: quiet force a.#? $RCSfile $RCSalt $lockfile
  80. Echo >a.11  1.1
  81. Echo >a.3x1 1.1.1.1
  82. Echo >a.12  1.2
  83.  
  84. FailAt 30
  85. diff >t:t -c a.11 a.3x1
  86. Search >NIL: search "! 1.1.1.1" t:t
  87. If warn
  88.     Echo "warning: diff -c does not work, so diagnostics may be cryptic"
  89.     Set diff "diff -c"
  90. Else
  91.     Set diff "diff"
  92. EndIf
  93.  
  94.  
  95. rcs -i -L -ta.11 $q a.c
  96. if not exists $RCSfile
  97.     echo "#rcs -i -L failed; perhaps RCS is not properly installed."
  98.     Quit 1
  99. EndIf
  100.  
  101. rlog a.c >NIL:
  102. if val $rc gt 0
  103.     echo "#rlog failed on empty RCS file"
  104.     Quit 1
  105. endif
  106.  
  107. FailAt 1
  108. delete quiet force $RCSfile
  109.  
  110. xcopy a.11 a.c
  111. ci -ta.11 -mm $q a.c
  112. if not exists $RCSfile
  113.     quit 1
  114. endif
  115.  
  116. FailAt 30
  117. rcs -L $q a.c
  118. if val $rc gt 0
  119.    echo "#ci+rcs -L failed"
  120.    quit 1
  121. endif
  122.  
  123. if exists a.c
  124.     echo "#ci did not remove working file"
  125.     quit 1
  126. endif
  127.  
  128. co $q a.c
  129. if not exists a.c
  130.     echo "#ci did not create working file"
  131.     quit 1
  132. endif
  133. $diff a.11 a.c
  134. if val $rc gt 0
  135.     echo "'#ci' followed by co $l is not a no-op"
  136.     quit 1
  137. endif
  138.  
  139. co -l $q a.c
  140. if not exists a.c
  141.     echo "#ci did not create working file"
  142.     quit 1
  143. endif
  144. $diff a.11 a.c
  145. if val $rc gt 0
  146.     echo "'#ci' followed by co $l is not a no-op"
  147.     quit 1
  148. endif
  149.  
  150. xcopy a.12 a.c
  151. ci -mm $q a.c
  152. co $q a.c
  153. $diff a.12 a.c
  154.  
  155. if val $rc gt 0
  156.     echo "#ci+co failed"
  157.     quit 1
  158. endif
  159.  
  160. co -r1.1 $q a.c
  161. $diff a.11 a.c
  162. if val $rc gt 0
  163.     echo "#can't retrieve first revision"
  164.     quit 1
  165. endif
  166.  
  167. delete quiet force a.c
  168. xcopy a.3x1 a.c
  169. ci -r1.1.1 -mm $q a.c
  170. co -r1.1.1.1 $q a.c
  171. $diff a.3x1 a.c
  172. if val $rc gt 0
  173.     echo "#branches failed"
  174.     quit 1
  175. endif
  176.  
  177. co -l $q a.c
  178. ci -f -mm $q a.c
  179. co -r1.3 $q a.c
  180. $diff a.12 a.c
  181. if val $rc gt 0
  182.     echo "#(co -l; ci -f) failed"
  183.     quit 1
  184. endif
  185.  
  186. co -l $q a.c
  187. echo 1.4 >a.c
  188. ci -l -mm $q a.c
  189. echo error >a.c
  190. ci -mm $q a.c
  191. if val $rc gt 0
  192.     echo "#ci -l failed"
  193.     quit 1
  194. endif
  195.  
  196. co -l $q a.c
  197. echo 1.5 >a.c
  198. ci -u -mm $q a.c
  199. if not exists a.c
  200.     "#ci -u didn't create a working file"
  201.     quit 1
  202. endif
  203.  
  204. delete quiet force a.c
  205. echo error >a.c
  206. ci -mm $q a.c >NIL:
  207. if val $rc eq 0
  208.     echo "#ci -u didn't unlock the file"
  209.     quit 1
  210. endif
  211.  
  212. delete quiet force a.c
  213. rcs -l $q a.c
  214. co -u $q a.c
  215. if val $rc gt 0
  216.     echo "#rcs -l + co -u failed"
  217.     quit 1
  218. endif
  219.  
  220. delete quiet force a.c
  221. echo error >a.c
  222.  
  223. ci >NIL: -mm $q a.c
  224. if val $rc eq 0
  225.     echo "#co -u didn't unlock the file"
  226.     quit 1
  227. endif
  228.  
  229. delete quiet force a.c
  230. xcopy a.11 a.c
  231. co -f $q a.c
  232. if val $rc gt 0
  233.     echo "#co -f failed"
  234.     quit 1
  235. endif
  236.  
  237. $diff a.11 a.c >NIL:
  238. if val $rc eq 0
  239.     echo "#co -f had no effect"
  240.     quit 1
  241. endif
  242.  
  243. co -p1.1 $q a.c >a.t
  244.  
  245. $diff a.11 a.t
  246. if val $rc gt 0
  247.     echo "#co -p failed"
  248.     quit 1
  249. endif
  250.  
  251. delete quiet force a.c
  252. co -l $q a.c
  253. echo n >a.n
  254. xcopy a.n a.c
  255. ci -nn -mm $q a.c
  256. co -rn $q a.c
  257. $diff a.n a.c
  258. if val $rc gt 0
  259.     echo "#ci -n failed"
  260.     quit 1
  261. endif
  262.  
  263. delete quiet force a.c
  264. co -l $q a.c
  265. echo N >a.n
  266. xcopy a.n a.c
  267. ci -Nn -mm $q a.c
  268. co -rn $q a.c
  269. $diff a.n a.c
  270. if val $rc gt 0
  271.     echo "#ci -N failed"
  272.     quit 1
  273. endif
  274.  
  275. if not $LOGNAME eq ""
  276.     set me $LOGNAME
  277. else
  278.     if not $USER eq ""
  279.     set me $USER
  280.     else
  281.     echo "Neither LOGNAME nor USER is set!"
  282.     quit 2
  283.     endif
  284. endif
  285.  
  286. delete quiet force a.#? $RCSfile $RCSalt
  287. unset q
  288. unset RCSfile
  289. unset RCSalt
  290. unset lockfile
  291. unset diff
  292. unset me
  293.  
  294. Echo "*NPartial test of RCS completed."
  295. Echo "You may ignore the two 'ci error: no lock set by <user>' messages."
  296. Echo "To do a complete test you need to adapt the remaining 240 lines"
  297. Echo "of the original unix rcstest script. Have fun."
  298.  
  299. quit
  300. ;-------------------------------------------------------------------
  301. ; End of Amiga translation, don't know too much about unix shells.
  302. ; and now it's getting to complicated.
  303. ; Please note: All '{' and '}' were replaced by '[' and ']' to
  304. ; make this script compatible to the Amiga EXECUTE command.
  305. ;-------------------------------------------------------------------
  306.  
  307. date=`date -u 2>/dev/null` ||
  308. date=`TZ=GMT0 date 2>/dev/null` ||
  309. date=`TZ= date` || exit 2
  310. set $date
  311. case $2 in
  312. Jan) m=01;; Feb) m=02;; Mar) m=03;; Apr) m=04;; May) m=05;; Jun) m=06;;
  313. Jul) m=07;; Aug) m=08;; Sep) m=09;; Oct) m=10;; Nov) m=11;; Dec) m=12;;
  314. *) echo >&2 "$0: $2: unknown month name"; exit 2
  315. esac
  316. case $3 in
  317. ?) d=0$3;;
  318. *) d=$3
  319. esac
  320. case $6 in
  321. [0-9][0-9][0-9][0-9]*) D=$6/$m/$d;;
  322. *)
  323.     case $5 in
  324.     [0-9][0-9][0-9][0-9]*) D=$5/$m/$d;;
  325.     *) echo >&2 "$0: bad date format: $date"; exit 2
  326.     esac
  327. esac
  328. T=$4
  329. case $PWD in
  330. '') PWD=`pwd`
  331. esac &&
  332. co -l $q a.c &&
  333. sed 's/@@/$/g' >a.kv <<EOF
  334. @@Author: w @@
  335. @@Date: $D $T @@
  336. @@Header: $PWD$SLASH$RCSfile 2.1 $D $T w s @@
  337. @@Id: a.c 2.1 $D $T w s @@
  338. @@Locker:  @@
  339. @@Log: a.c @@
  340.  * Revision 2.1  $D  $T  w
  341.  * m
  342.  *
  343. @@RCSfile: a.c @@
  344. @@Revision: 2.1 @@
  345. @@Source: $PWD$SLASH$RCSfile @@
  346. @@State: s @@
  347. EOF
  348. test $? = 0 &&
  349. sed 's/:.*\$/$/' a.kv >a.k &&
  350. sed -e 's/w s [$]/w s '"$me"' $/' -e 's/[$]Locker: /&'"$me/" a.kv >a.kvl &&
  351. sed -e '/^\$/!d' -e 's/\$$/: old $/' a.k >a.o &&
  352. sed -e 's/\$[^ ]*: //' -e 's/ \$//' a.kv >a.v &&
  353. cp a.o a.c &&
  354. ci -d"$date" -ss -ww -u2.1 -mm $q a.c &&
  355. $diff a.kv a.c || [ echo "#keyword expansion failed"; exit 1; ]
  356. co -p -ko $q a.c >a.oo &&
  357. $diff a.o a.oo || [ echo "#co -p -ko failed"; exit 1; ]
  358. cp a.kv a.o || exit 2
  359. rcs -o2.1 $q a.c &&
  360. rcs -l $q a.c &&
  361. ci -k -u $q a.c &&
  362. $diff a.kv a.c || [ echo "#ci -k failed"; exit 1; ]
  363. sed '/^[^$]/d' a.kv >a.i &&
  364. ident a.c >a.i1 &&
  365. sed -e 1d -e 's/^[       ]*//' a.i1 >a.i2 &&
  366. $diff a.i a.i2 || [ echo "#ident failed"; exit 1; ]
  367.  
  368. rcs -i $q a.c 2>/dev/null && [ echo "#rcs -i permitted existing file"; exit 1; ]
  369.  
  370. co -l $q a.c &&
  371. echo 2.2 >a.c &&
  372. ci -mm $q a.c &&
  373. echo 1.1.1.2 >a.c &&
  374. rcs -l1.1.1 $q a.c &&
  375. ci -r1.1.1.2 -mm $q a.c &&
  376. rcs -b1.1.1 $q a.c &&
  377. test " `co -p $q a.c`" = ' 1.1.1.2' || [ echo "#rcs -b1.1.1 failed"; exit 1; ]
  378. rcs -b $q a.c &&
  379. test " `co -p $q a.c`" = ' 2.2' || [ echo "#rcs -b failed"; exit 1; ]
  380.  
  381. echo 2.3 >a.c || exit 2
  382. rcs -U $q a.c || [ echo "#rcs -U failed"; exit 1; ]
  383. ci -mm $q a.c || [ echo "#rcs -U didn't unset strict locking"; exit 1; ]
  384. rcs -L $q a.c || [ echo "#rcs -L failed"; exit 1; ]
  385. echo error >a.c || exit 2
  386. ci -mm $q a.c 2>/dev/null && [ echo "#ci retest failed"; exit 1; ]
  387.  
  388. rm -f a.c &&
  389. log0=`rlog -h a.c` &&
  390. co -l $q a.c &&
  391. ci -mm $q a.c &&
  392. log1=`rlog -h a.c` &&
  393. test " $log0" = " $log1" || [ echo "#unchanged ci didn't revert"; exit 1; ]
  394.  
  395. rm -f a.c &&
  396. rcs -nN:1.1 $q a.c &&
  397. co -rN $q a.c &&
  398. $diff a.11 a.c || [ echo "#rcs -n failed"; exit 1; ]
  399.  
  400. rcs -NN:2.1 $q a.c &&
  401. co -rN $q a.c &&
  402. $diff a.kv a.c || [ echo "#rcs -N failed"; exit 1; ]
  403.  
  404. co -l $q a.c &&
  405. rcs -c':::' $q a.c &&
  406. echo '$''Log$' >a.c &&
  407. ci -u -mm $q a.c &&
  408. test " `sed '$!d' a.c`" = ' :::' || [ echo "#rcs -c failed"; exit 1; ]
  409.  
  410. rcs -o2.2: $q a.c &&
  411. co $q a.c &&
  412. $diff a.kv a.c || [ echo "#rcs -o failed"; exit 1; ]
  413.  
  414. rcsdiff -r1.1 -r2.1 $q a.c >a.0
  415. case $? in
  416. 1) ;;
  417. *) echo "#rcsdiff bad status"; exit 1
  418. esac
  419. diff a.11 a.kv >a.1
  420. $diff a.0 a.1 || [ echo "#rcsdiff failed"; exit 1; ]
  421.  
  422. rcs -l2.1 $q a.c || [ echo "#rcs -l2.1 failed"; exit 1; ]
  423. for i in k kv kvl o v
  424. do
  425.     rm -f a.c &&
  426.     cp a.$i a.c &&
  427.     rcsdiff -k$i $q a.c || [ echo "#rcsdiff -k$i failed"; exit 1; ]
  428. done
  429. co -p1.1 -ko $q a.c >a.t &&
  430. $diff a.11 a.t || [ echo "#co -p1.1 -ko failed"; exit 1; ]
  431. rcs -u2.1 $q a.c || [ echo "#rcs -u2.1 failed"; exit 1; ]
  432.  
  433. rm -f a.c &&
  434. co -l $q a.c &&
  435. cat >a.c <<'EOF'
  436. 2.2
  437. a
  438. b
  439. c
  440. d
  441. EOF
  442. test $? = 0 &&
  443. ci -l -mm $q a.c &&
  444. co -p2.2 $q a.c | sed -e s/2.2/2.3/ -e s/b/b1/ >a.c &&
  445. ci -l -mm $q a.c &&
  446. co -p2.2 $q a.c | sed -e s/2.2/new/ -e s/d/d1/ >a.c || exit 2
  447. cat >a.0 <<'EOF'
  448. 2.3
  449. a
  450. b1
  451. c
  452. d1
  453. EOF
  454. cat >a.1 <<'EOF'
  455. <<<<<<< a.c
  456. new
  457. =======
  458. 2.3
  459. >>>>>>> 2.3
  460. a
  461. b1
  462. c
  463. d1
  464. EOF
  465. rcsmerge -r2.2 -r2.3 $q a.c
  466. case $? in
  467. 0)
  468.     if $diff a.0 a.c >/dev/null
  469.     then echo "#warning: diff3 -E does not work, " \
  470.         "so merge and rcsmerge ignore overlaps and suppress overlap lines."
  471.     else
  472.         $diff a.1 a.c || [ echo "#rcsmerge failed (status 0)"; exit 1; ]
  473.         echo "#warning: The diff3 lib program exit status ignores overlaps," \
  474.             "so rcsmerge does not warn about overlap lines that it generates."
  475.     fi
  476.     ;;
  477. 1)
  478.     $diff a.1 a.c || [ echo "#rcsmerge failed (status 1)"; exit 1; ]
  479.     ;;
  480. *)
  481.     echo "#rcsmerge bad status"; exit 1
  482. esac
  483.  
  484. nl='
  485. '
  486. [
  487.     co -p $q a.c | tr "$nl" '\200' >a.24 &&
  488.     cp a.24 a.c &&
  489.     ciOut=`(ci -l -mm $q a.c 2>&1)` &&
  490.     case $ciOut in
  491.     ?*) echo >&2 "$ciOut"
  492.     esac &&
  493.     co -p $q a.c | tr '\200' "$nl" >a.c &&
  494.     rcsdiff -r2.3 $q a.c >/dev/null &&
  495.  
  496.     echo 2.5 >a.c &&
  497.     ci -l -mm $q a.c &&
  498.     cp a.24 a.c &&
  499.     rcsdiff -r2.4 $q a.c >/dev/null
  500. ] || echo "#warning: Traditional diff is used, so RCS is limited to text files."
  501.  
  502. rcs -u -o2.4: $q a.c || [ echo "#rcs -u -o failed"; exit 1; ]
  503.  
  504. rcs -i -Aa.c -t- $q a.d || [ echo "#rcs -i -A failed"; exit 1; ]
  505.  
  506. rlog -r2.1 a.c >a.t &&
  507. grep '^checked in with -k' a.t >/dev/null &&
  508. sed '/^checked in with -k/d' a.t >a.u &&
  509. $diff - a.u <<EOF
  510.  
  511. RCS file: $RCSfile
  512. Working file: a.c
  513. head: 2.3
  514. branch:
  515. locks: strict
  516. access list:
  517. symbolic names:
  518.     N: 2.1
  519.     n: 1.8
  520. comment leader: ":::"
  521. keyword substitution: kv
  522. total revisions: 13;    selected revisions: 1
  523. description:
  524. 1.1
  525. ----------------------------
  526. revision 2.1
  527. date: $D $T;  author: w;  state: s;  lines: +13 -1
  528. =============================================================================
  529. EOF
  530. test $? = 0 || [ echo "#rlog failed"; exit 1; ]
  531.  
  532.  
  533. test ! -f $lockfile || [ echo "#lock file not removed"; exit 1; ]
  534.  
  535. exec rm -f a.* $RCSfile $RCS_alt
  536. @
  537.