作業系統的核心是一個很複雜的系統,其中包含了許多軟硬體的交互關係和運作上面的協調。而如果要測試核心中的一個檔案或是元件,更會因為核心中對於使用者空間中向核心空間調用參數的限制使得過程更加的困難。 我們的實驗主體將會以multiple device driver-md.c做為本次核心程式測試的主體,以行覆蓋率(line coverage rate)做為測試的標準,並且利用gcov表示出來。為了使測試過程更加的簡易方便以節省測試的成本,我們提出了利用使用者程式和外在硬體操作的方式,去準備取得參數並創造正常和不正常的軟硬體狀態,錯誤中包括錯誤的指令和衝突的系統狀態、錯誤的指令執行順序、和實際上的硬體錯誤,使得核心程式盡可能的被調用。並提出一個高階的層狀架構且在其中進行測試。 測試結果呈現在各個gcov紀錄檔中。整合各檔案之後經過計算,可以達到超過50% 的行覆蓋率。
Linux Kernel is a complicated software. It combines various kinds of hardware and software behaviors, and working with tens of thousands of processes and threads at the same time. Moreover, it is more difficult to test a specific piece of component in the kernel space due to the kernel protection. We perform the testing mainly on the multiple device driver md.c using line coverage rate as criteria and profiled by gcov. To maximize the line coverage count, we try to create as many system status related to md.c as possible. The method taken includes straightforward scenario, device error scenario and sequential error scenario. Furthermore, we proposed a hierarchical sequential random testing structure based on locality on sequential testing. The test result is shown at each test coverage files. We merge all the test results and get the final count up to 53.85%.