Howto Test A Patch And Make A Difference!

Preview:

Citation preview

HowTo:

Test a Patch and make a difference!

By: Joel 'Senpai' Farris

Who Am I?I'm a Drupal Consultant, a themer, a web developer, and an open-source fanatic who's been active in the Drupal community since v4.7.I love to ride Harleys, play beach volleyball, and game on my PS3.

ThePatch

TestingProcess

The Process is:

1. Developer sees a need for an enhancement or a deficiency that needs to be fixed.

2.Code is produced that works, more or less.

3. The new code is 'diffed' with the original code to create a .patch file.

4. The resulting file is uploaded to that module's issue queue to await testing.

5.Someone reviews the patch visually, or tests it manually, plus automatically with the AutoBot.

Why Do We Test?

Patch testing is the only way to ensure a quality codebase.

The Patch Testing Cycle provides for more than one person's brain to validate the patch's logic, featureset, or bugfix.

Who Should Help?

People that want a new feature added.

Those desire to see improvements.

Web developers who write code.

Web developers who don't write code.

Anyone who believes in the future of Drupal.

Can I Do It?Yes, you can, regardless of your skill level.

Is It Hard To Do?Yes, because it's a complex process.

A Patch file is simply a 'diffed' comparison of one or more files

with their original, unchanged version

Patch?

The Issue Queue

Enabling your

sidebar links

Find a Patch to

test

Node/88264

Pay attentionto Status, Assigned,& Priority

"Patch applies cleanly to HEAD, but I'm not sure what to test..."

5

"Question:In which cases would I not specify default value for this argument?

8

This iscalled apatch re-roll.

10

No Go!This is back to CNW.

12

Cool,Another re-roll...

15

Oh look, a patch to test! W00t!

15

When saving the patch locally, give it a name that's meaningful to you.Usually, the format of nodenumber_modulename_functionality works well.

example:88264_core_variableget_defaults.patch

ApplyingThe Patch

cd /www/dheadcp /www/patches/7/core/example.patch .patch -p0 < example.patch

patching file includes/bootstrap.incpatching file includes/file.incHunk #1 succeeded at 1458 (offset 51 lines).patching file modules/user/user.testpatching file modules/color/color.modulepatching file modules/locale/locale.installpatching file modules/simpletest/tests/bootstrap.testpatching file modules/system/system.api.phppatching file modules/system/system.installHunk #2 succeeded at 2489 (offset -2 lines).Hunk #3 succeeded at 2851 (offset -2 lines).Hunk #4 succeeded at 3088 (offset -2 lines).

~ joel$dhead joel$dhead joel$

dhead joel$ patch -p0 -R < example.patch

dhead joel$ cvs -q diff | patch -p0 -Rwget -O - $1 | patch -p0dhead joel$

ReportingThe Results

RTBC, baby!16

Study Materials

The Handbook pages: drupal.org/patch

Cool shortcuts: drupal.org/node/128436

Screencast: drupal.org/node/132745

AnyQuestions?

Next Up:

Saving Webchick Time - The SagaCommonplaces room @5:15 (that's this room, silly)

TheEnd

twitter @joelfarris