Add test script and patch for 1.8.7-p374