chyyuu / ucore_os_plus

232 stars 132 forks source link

Wrong error code in faultreadkernel #4

Closed eternalNight closed 11 years ago

eternalNight commented 12 years ago

Description

In the unit test faultreadkernel, the error code in the trapframe doesn't meet the constraint in the test spec file.

Commit

7e99100 unittest: Adapt tests on sfs to the current sfsimg.

Reproduce Steps

cd ucore make ARCH=i386 menuconfig UCORE_TEST=/testbin/faultreadkernel make kernel UCORE_TEST=/testbin/faultreadkernel make sfsimg make swapimg ./uCore_test -sf src/user-ucore/testspecs/faultreadkernel.testspec

Current Result

The unit test fail with

!! error: missing ' err 0x00000005'

According to serial.log, the error code in the trap frame is " err 0x00000004"

Expected Result

The unit test doesn't fail with the line mentioned above. Either provide a fix for the kernel or update the test spec with reasonable analysis.

eternalNight commented 11 years ago

The test is previously specific to 64-bit implementations as it read 0xffff9f8000000000. The address is truncated to 0 on 32-bit architectures, leading to a null pointer access instead of a read fault.

This has been fixed by reading a different address according to the size of pointer.