File: test-pristines.sh

package info (click to toggle)
tla 1.3.5%2Bdfsg1-2
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, stretch
  • size: 22,292 kB
  • ctags: 11,952
  • sloc: ansic: 149,771; sh: 16,009; xml: 2,689; lisp: 1,927; makefile: 1,064; cpp: 363; tcl: 230; awk: 48; sed: 25
file content (70 lines) | stat: -rw-r--r-- 2,308 bytes parent folder | download | duplicates (6)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh
# -*- mode: sh; coding: utf-8 -*-
# Simple commit tests (2)
# Copyright © 2003 Colin Walters <walters@verbum.org>
# Copyright (C) 2004 Robert Collins <robertc@robertcollins.net>
#
# See the file "COPYING" for further information about
# the copyright and warranty status of this work.

set -e

arg0="$0"
srcdir=`dirname "$arg0"`

. ${srcdir}/test-framework

setup_with_trivial_archives

test_class "test pristine trees"

setup () {
  tla get jane@example.com--2003/hello-world--mainline--1.0 hello-world
  cd hello-world
}  

setup_pristine () {
  # purge and rebuild a pristine tree
  rm -rf \{arch\}/++pristine-trees
  tla add-pristine $(tla logs -f -r | head -n 1)
}

check_pristine_is_corrupt () {
  # trigger a pristine inode check
  # fail on ok pristines.
  # note on failed pristines.
  # usage: check_pristine_is_corrupt "failure description"
  (tla changes 2>&1 | grep "corrupt pristine") || test_fail "Did not detect $@ in pristine copy"
  echo "Detected $@" >&2
}


begin_test "modify date of file in pristine"
setup
touch  -t 200001010101.01 \{arch\}/++pristine-trees/unlocked/hello-world/hello-world--mainline/hello-world--mainline--1.0/jane\@example.com--2003/hello-world--mainline--1.0--base-0/README
check_pristine_is_corrupt "modified file date"
end_test 

begin_test "Add file to pristine"
setup
echo 'We follow the GNU coding standards' >  \{arch\}/++pristine-trees/unlocked/hello-world/hello-world--mainline/hello-world--mainline--1.0/jane\@example.com--2003/hello-world--mainline--1.0--base-0/HACKING
tla add-id  \{arch\}/++pristine-trees/unlocked/hello-world/hello-world--mainline/hello-world--mainline--1.0/jane\@example.com--2003/hello-world--mainline--1.0--base-0/HACKING
check_pristine_is_corrupt "new file added"
end_test 

begin_test "Removing file from pristine"
setup
rm \{arch\}/++pristine-trees/unlocked/hello-world/hello-world--mainline/hello-world--mainline--1.0/jane\@example.com--2003/hello-world--mainline--1.0--base-0/hello-world.c
check_pristine_is_corrupt "removed file"
end_test 

#tests to do:
# move a file in a pristine
# perform a limited commit (single file mod)
# perform a limited commit (multiple file modification)
# perform a limited commit (one file commited, other files modified)

clean_workdir

# tag: 2cf97d96-e663-4bab-a46a-1c912ae0ce82
#