37
HowTo: Test a Patch and make a difference! By: Joel 'Senpai' Farris

Howto Test A Patch And Make A Difference!

Embed Size (px)

Citation preview

Page 1: Howto Test A Patch And Make A Difference!

HowTo:

Test a Patch and make a difference!

By: Joel 'Senpai' Farris

Page 2: Howto Test A Patch And Make A Difference!

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.

Page 3: Howto Test A Patch And Make A Difference!

ThePatch

TestingProcess

Page 4: Howto Test A Patch And Make A Difference!

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.

Page 5: Howto Test A Patch And Make A Difference!

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.

Page 6: Howto Test A Patch And Make A Difference!

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.

Page 7: Howto Test A Patch And Make A Difference!

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

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

Page 8: Howto Test A Patch And Make A Difference!

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

with their original, unchanged version

Patch?

Page 9: Howto Test A Patch And Make A Difference!
Page 10: Howto Test A Patch And Make A Difference!

The Issue Queue

Page 11: Howto Test A Patch And Make A Difference!

Enabling your

sidebar links

Page 12: Howto Test A Patch And Make A Difference!

Find a Patch to

test

Page 13: Howto Test A Patch And Make A Difference!

Node/88264

Page 14: Howto Test A Patch And Make A Difference!
Page 15: Howto Test A Patch And Make A Difference!

Pay attentionto Status, Assigned,& Priority

Page 16: Howto Test A Patch And Make A Difference!
Page 17: Howto Test A Patch And Make A Difference!
Page 18: Howto Test A Patch And Make A Difference!
Page 19: Howto Test A Patch And Make A Difference!

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

5

Page 20: Howto Test A Patch And Make A Difference!
Page 21: Howto Test A Patch And Make A Difference!

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

8

Page 22: Howto Test A Patch And Make A Difference!

This iscalled apatch re-roll.

10

Page 23: Howto Test A Patch And Make A Difference!

No Go!This is back to CNW.

12

Page 24: Howto Test A Patch And Make A Difference!

Cool,Another re-roll...

15

Page 25: Howto Test A Patch And Make A Difference!

Oh look, a patch to test! W00t!

15

Page 26: Howto Test A Patch And Make A Difference!
Page 27: Howto Test A Patch And Make A Difference!

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

Page 28: Howto Test A Patch And Make A Difference!

ApplyingThe Patch

Page 29: Howto Test A Patch And Make A Difference!

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

Page 30: Howto Test A Patch And Make A Difference!

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

Page 31: Howto Test A Patch And Make A Difference!

ReportingThe Results

Page 32: Howto Test A Patch And Make A Difference!
Page 33: Howto Test A Patch And Make A Difference!

RTBC, baby!16

Page 34: Howto Test A Patch And Make A Difference!

Study Materials

The Handbook pages: drupal.org/patch

Cool shortcuts: drupal.org/node/128436

Screencast: drupal.org/node/132745

Page 35: Howto Test A Patch And Make A Difference!

AnyQuestions?

Page 36: Howto Test A Patch And Make A Difference!

Next Up:

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

Page 37: Howto Test A Patch And Make A Difference!

TheEnd

twitter @joelfarris