Index: trunk/ippTools/scripts/magictest.sh
===================================================================
--- trunk/ippTools/scripts/magictest.sh	(revision 15340)
+++ trunk/ippTools/scripts/magictest.sh	(revision 15341)
@@ -10,9 +10,12 @@
 magictool -addinputskyfile -magic_id 1 -diff_id 2 -node b || exit 1
 magictool -inputtree -magic_id 1 -dep_file magic_dep.md 
+magictool -updaterun -state run -magic_id 1 || exit 1
+
 magictool -addresult -magic_id 1 -node a -uri file:///foo/a
 magictool -addresult -magic_id 1 -node b -uri file:///foo/b
 magictool -addresult -magic_id 1 -node root -uri file:///foo/root
+magictool -tomask
+magictool -addmask -magic_id 1 -uri file:///foo/mask
 
-magictool -updaterun -state run -magic_id 1 || exit 1
 
 
Index: trunk/ippTools/src/magictool.c
===================================================================
--- trunk/ippTools/src/magictool.c	(revision 15340)
+++ trunk/ippTools/src/magictool.c	(revision 15341)
@@ -655,4 +655,33 @@
 {
     PS_ASSERT_PTR_NON_NULL(config, false);
+
+    bool status = false;
+    psString magic_id = psMetadataLookupStr(&status, config->args, "-magic_id");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -magic_id");
+        return false;
+    }
+    if (!magic_id) {
+        psError(PS_ERR_UNKNOWN, true, "-magic_id is required");
+        return false;
+    }
+
+    psString uri = psMetadataLookupStr(&status, config->args, "-uri");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -uri");
+        return false;
+    }
+    if (!uri) {
+        psError(PS_ERR_UNKNOWN, true, "-uri is required");
+        return false;
+    }
+
+    if (!magicMaskInsert(config->dbh,
+                (psS64)atoll(magic_id),
+                uri
+        )) {
+        psError(PS_ERR_UNKNOWN, false, "database error");
+        return false;
+    }
     return true;
 }
