浏览代码

tools/dev/check_register.sh: new tool to check which data handles are not unregistered

Nathalie Furmento 13 年之前
父节点
当前提交
d6a2a33cc5
共有 1 个文件被更改,包括 21 次插入0 次删除
  1. 21 0
      tools/dev/check_register.sh

+ 21 - 0
tools/dev/check_register.sh

@@ -0,0 +1,21 @@
+#!/bin/bash
+
+stcolor=$(tput sgr0)
+datacolor=$(tput setaf 2)
+filecolor=$(tput setaf 1)
+
+process_file()
+{
+    datas=$(grep "data_register(" $f| awk -F',' '{print $1}' | awk -F'(' '{print $2}' | tr -d '&' | sed 's/\[/\\\[/g' | sed 's/\]/\\\]/g' | sed 's/\*/\\\*/g')
+    for data in $datas ; do
+	x=$(grep "data_unregister($data" $1)
+	if test "$x" == "" ; then
+	    x=$(grep "data_unregister_no_coherency($data" $1)
+	    if test "$x" == "" ; then
+		echo "Error. File <${filecolor}$1${stcolor}>. Handle <${datacolor}$data${stcolor}> is not unregistered"
+	    fi
+	fi
+    done
+}
+
+for f in $* ; do process_file $f ; done