diff --git a/ChangeLog b/ChangeLog
index a814b6fed9586dc01a8c47d9ab20e37bbc89e8ac..91eaa3f7ebc133f61be7f480906920d9be397b3f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-08-04  Per Cederqvist  <ceder@lysator.liu.se>
+
+	Add more test cases for Local_to_global. (Bug 217).
+	* src/server/testsuite/l2g.0/09.exp: Added test cases for copying
+	a Local_to_global where the last entry (or entries) has been
+	deleted.
+
 2006-08-01  Per Cederqvist  <ceder@lysator.liu.se>
 
 	More aux-item-related test cases.
diff --git a/src/server/testsuite/l2g.0/09.exp b/src/server/testsuite/l2g.0/09.exp
index d988cd2659d6a38a0c6bf37d159338834fa816fe..cc62bd6f1d0208b610b25f8ec99f2033735ec244 100644
--- a/src/server/testsuite/l2g.0/09.exp
+++ b/src/server/testsuite/l2g.0/09.exp
@@ -67,8 +67,6 @@ simple_expect "1: 2 8 25 \\(sparse\\) \\\[25:1025 43:1043 \\\]" "test 16"
 
 l2g_send "w0"
 simple_expect "\\\[99 10:1010,1011,1012,1013,1014,1015,1016,1017,1018,1019 25:1025 43:1043\\\]" "test 17"
-# FIXME (bug 217): Build something where the last entry has been deleted,
-
 l2g_send "w1"
 simple_expect "\\\[99 10:1010,1011,1012,1013,1014,1015,1016,1017,1018,1019 25:1025 43:1043\\\]" "test 18"
 
@@ -104,4 +102,108 @@ simple_expect "1: 2 8 25 \\(sparse\\) \\\[25:1025 43:1043 \\\]" "test 30"
 l2g_send "D0"
 l2g_send "D1"
 l2g_send "D2"
+
+#
+# Test copying an Local_to_global structure where the last item(s) are
+# deleted.
+#
+
+# Build a mapping that almost fills a block.
+
+l2g_send "I0"
+l2g_send "a0 1 10"
+l2g_send "a0 2 11"
+l2g_send "a0 3 12"
+l2g_send "a0 4 13"
+l2g_send "a0 5 14"
+l2g_send "a0 6 15"
+l2g_send "a0 7 17"
+l2g_send "a0 8 18"
+
+# Check it.
+
+l2g_send "u0"
+simple_expect "Number of blocks: 1" "test 31"
+simple_expect "First unused: 9" "test 32"
+simple_expect "0: 8 2 1 \\(dense\\) \\\[10 11 12 13 14 15 17 18 \\\]" "test 33"
+l2g_send "w0"
+simple_expect "\\\[9 1:10,11,12,13,14,15,17,18\\\]" "test 34"
+
+# Remove the last item and check it.
+
+l2g_send "d0 8"
+l2g_send "u0"
+simple_expect "Number of blocks: 1" "test 35"
+simple_expect "First unused: 9" "test 36"
+simple_expect "0: 8 3 1 \\(dense\\) \\\[10 11 12 13 14 15 17 0 \\\]" "test 37"
+l2g_send "w0"
+simple_expect "\\\[9 1:10,11,12,13,14,15,17\\\]" "test 38"
+
+# Copy the mapping, and check the copy.
+
+l2g_send "I1"
+l2g_send "C1 0"
+l2g_send "u1"
+simple_expect "Number of blocks: 1" "test 39"
+simple_expect "First unused: 9" "test 40"
+simple_expect "0: 7 3 1 \\(dense\\) \\\[10 11 12 13 14 15 17 \\\]" "test 41"
+l2g_send "w1"
+simple_expect "\\\[9 1:10,11,12,13,14,15,17\\\]" "test 42"
+
+# Add more items to the original, so that it spans more than one
+# block.
+
+l2g_send "a0 9 20"
+l2g_send "a0 10 21"
+l2g_send "a0 11 22"
+l2g_send "a0 12 23"
+
+# Check it.
+l2g_send "u0"
+simple_expect "Number of blocks: 2" "test 43"
+simple_expect "First unused: 13" "test 44"
+simple_expect "0: 10 1 1 \\(dense\\) \\\[10 11 12 13 14 15 17 0 20 21 \\\]" "test 45"
+simple_expect "1: 2 8 11 \\(dense\\) \\\[22 23 \\\]" "test 46"
+l2g_send "w0"
+simple_expect "\\\[13 1:10,11,12,13,14,15,17,0,20,21,22,23\\\]" "test 47"
+
+# Copy the mapping, and check the copy.
+
+l2g_send "C1 0"
+l2g_send "u1"
+simple_expect "Number of blocks: 2" "test 48"
+simple_expect "First unused: 13" "test 49"
+simple_expect "0: 10 1 1 \\(dense\\) \\\[10 11 12 13 14 15 17 0 20 21 \\\]" "test 50"
+simple_expect "1: 2 8 11 \\(dense\\) \\\[22 23 \\\]" "test 51"
+l2g_send "w1"
+simple_expect "\\\[13 1:10,11,12,13,14,15,17,0,20,21,22,23\\\]" "test 52"
+
+# Remove the last few items, so that the mapping fits in a single
+# block.
+
+l2g_send "d0 10"
+l2g_send "d0 11"
+l2g_send "d0 12"
+
+# Check it.
+l2g_send "u0"
+simple_expect "Number of blocks: 1" "test 53"
+simple_expect "First unused: 13" "test 54"
+simple_expect "0: 10 2 1 \\(dense\\) \\\[10 11 12 13 14 15 17 0 20 0 \\\]" "test 55"
+l2g_send "w0"
+simple_expect "\\\[13 1:10,11,12,13,14,15,17,0,20\\\]" "test 56"
+
+# Copy the mapping, and check the copy.
+
+l2g_send "C1 0"
+l2g_send "u1"
+simple_expect "Number of blocks: 1" "test 57"
+simple_expect "First unused: 13" "test 58"
+simple_expect "0: 9 2 1 \\(dense\\) \\\[10 11 12 13 14 15 17 0 20 \\\]" "test 59"
+l2g_send "w1"
+simple_expect "\\\[13 1:10,11,12,13,14,15,17,0,20\\\]" "test 60"
+
+l2g_send "D1"
+l2g_send "D0"
+
 l2g_stop