IP Library › Granted Patent US 10,997,060
Granted Patent B2
US 10,997,060 · App. 16/408,183 · Granted May 4, 2021

Device, system, and method for detecting a defect in a computer program by generating and testing semantically equivalent computer program variants

Inventors: Sunny J. Fugate (San Diego, CA); Jason A. Landsborough (San Diego, CA); Stephen T. Harding (San Diego, CA); Charles L. Carpenter (Chula Vista, CA)
Assignee: United States of America as represented by the Secretary of the Navy
G06F11/3688G06F11/3684
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 10,997,060
App. No.
16/408,183
Granted
May 4, 2021
Kind
B2
Abstract

Semantically equivalent variants of a computer program are generated by applying randomly selected transforms to the computer program. Unit tests are performed on the variants of the computer program to detect a defect in the computer program.

Claims (36)

1. A computing device, comprising:

a processor; and

a memory having a plurality of instructions stored thereon which, executed by the processor, cause the processor to generate semantically equivalent variants of a computer program by applying randomly selected transforms to the computer program, each of the variants including at least one respective instruction modified from the computer program, and further cause the processor to perform unit tests on the variants of the computer program to detect a defect in the computer program, including the processor executing the at least one respective instruction modified in each of the variants.

2. The computing device of claim 1 , wherein a randomly selected transform applied to the computer program includes for one or more of the variants inserting the respective instruction that specifies no operation into the computer program or inserting the at least one respective instruction, which is a plurality of instructions that has no functionality, into the computer program.

3. The computing device of claim 1 , wherein a randomly selected transform applied to the computer program includes for at least one of the variants shuffling blocks of code within the computer program, the blocks including the at least one respective instruction for the one of the variants.

4. The computing device of claim 1 , wherein a randomly selected transform applied to the computer program includes for at least one of the variants interleaving blocks of code within the computer program, the blocks including the at least one respective instruction for the one of the variants.

5. The computing device of claim 1 , wherein a randomly selected transform applied to the computer program includes for at least one of the variants shuffling and interleaving blocks of code within the computer program, the blocks including the at least one respective instruction for the one of the variants.

6. A computing device, comprising:

a processor; and

a memory having a plurality of instructions stored thereon which, executed by the processor, cause the processor to generate semantically equivalent variants of a computer program by applying randomly selected transforms to the computer program, each of the variants including at least one respective instruction modified from the computer program, and further cause the processor to perform unit tests on the variants of the computer program to detect a defect in the computer program, including the processor executing the at least one respective instruction modified in each of the variants,

wherein a randomly selected transform applied to the computer program includes for at least one of the variants interleaving blocks of code within the computer program, the blocks including the at least one respective instruction for the one of the variants, and

wherein the blocks of code that are interleaved include a function call to a function that performs a computation for increasing runtime sufficiently to expose a race condition.

7. A system, comprising:

a computer program variant generator configured to generate diverse but semantically equivalent variants of a computer program by applying randomly selected transforms to the computer program, each of the variants including at least one respective instruction modified from the computer program;

a unit test generator configured to generate unit tests for the variants of the computer program; and

a tester configured to perform the unit tests on the variants of the computer program to detect a defect in the computer program, including execution of the at least one respective instruction modified in each of the variants.

8. The system of claim 7 , wherein a randomly selected transform applied by the computer program variant generator includes, for one or more of the variants, at least one of inserting the respective instruction that specifies no operation into the computer program and inserting the at least one respective instruction, which is a plurality of instructions that has no functionality, into the computer program.

9. The system of claim 7 , wherein a randomly selected transform applied by the computer program variant generator includes for at least one of the variants shuffling blocks of code within the computer program, the blocks including the at least one respective instruction for the one of the variants.

10. The system of claim 7 , wherein a randomly selected transform applied by the computer program variant generator includes for at least one of the variants interleaving blocks of code within the computer program, the blocks including the at least one respective instruction for the one of the variants.

11. The system of claim 7 , wherein a randomly selected transform applied by the computer program variant generator includes for at least one of the variants shuffling and interleaving blocks of code within the computer program, the blocks including the at least one respective instruction for the one of the variants.

12. A method, comprising:

generating a variant of a computer program that is semantically equivalent to the computer program by applying a randomly selected transform to the computer program, the variant including at least one respective instruction modified from the computer program;

generating a unit test for testing the variant of the computer program;

performing the unit test on the variant of the computer program, wherein a failure of the unit test by the variant detects a defect in the computer program; and

repeating each of the above steps for a prescribed number of variants and a prescribed number of unit tests, wherein the performing of one or more of the prescribed number of unit tests executes the at least one respective instruction modified in each of the prescribed number of variants.

13. The method of claim 12 , further comprising generating a set of unit tests for each variant among the prescribed number of variants.

14. The method of claim 12 , further generating a set of variants for each unit test among the prescribed number of unit tests.

15. The method of claim 12 , further comprising logging a test result and the variant upon which the unit test is performed.

16. The method of claim 12 , further comprising:

performing the unit test on the computer program;

determining the variant fails the unit test in response to a difference between an expected output of the variant for the unit test and an actual output of the variant for the unit test, wherein the expected output is an actual output from the performing the unit test on the computer program; and

responsive to the variant failing the unit test, logging the failure, the difference, and the variant upon which the unit test is performed.

17. The method of claim 12 , wherein applying the randomly selected transform to the computer program includes inserting the respective instruction that specifies no operation into the computer program or inserting the at least one respective instruction, which is a plurality of instructions that has no functionality, into the computer program.

18. The method of claim 12 , wherein applying the randomly selected transform to the computer program includes performing at least one of shuffling and interleaving blocks of code within the computer program, the blocks including the at least one respective instruction.

19. The method of claim 12 , wherein the repeating of the step of the generating the unit test includes repeating the step of the generating the unit test for testing each one of the prescribed number of variants until measurement of test coverage determines that the at least one respective instruction has been executed during the repeating of the step of the performing the unit test on the one of the prescribed number of variants.

20. The method of claim 12 , wherein the step of the generating the unit test for testing the variant includes generating the unit test including test inputs selected at random and test inputs selected in response to at least one decorator within the computer program.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded May 9, 2019
From: FUGATE, SUNNY J.; LANDSBOROUGH, JASON A.; HARDING, STEPHEN T.; CARPENTER, CHARLES L.
To: UNITED STATES OF AMERICA AS REPRESENTED BY THE SECRETARY OF THE NAVY
Reel/Frame 049147/0913 →
Continuity (1)
Related Publication 20200356468A1 · Nov 12, 2020
Cited By (1)
US 12,210,442