Program: 53189
Project: 53189
Buggy source:
@Test public void createBuildRuleNativeLinkableDep(){
  BuildTarget target=BuildTargetFactory.newInstance("String_Node_Str");
  BuildRuleResolver resolver=new BuildRuleResolver();
  SourcePathResolver pathResolver=new SourcePathResolver(resolver);
  CxxPlatform cxxPlatform=CxxPythonExtensionBuilder.createDefaultPlatform();
  final BuildRule sharedLibraryDep=createFakeBuildRule("String_Node_Str",pathResolver);
  final Path sharedLibraryOutput=Paths.get("String_Node_Str");
  final String sharedLibrarySoname="String_Node_Str";
  BuildTarget depTarget=BuildTargetFactory.newInstance("String_Node_Str");
  BuildRuleParams depParams=BuildRuleParamsFactory.createTrivialBuildRuleParams(depTarget);
  AbstractCxxLibrary dep=new AbstractCxxLibrary(depParams,pathResolver){
    @Override public CxxPreprocessorInput getCxxPreprocessorInput(    CxxPlatform cxxPlatform,    HeaderVisibility headerVisibility){
      return CxxPreprocessorInput.EMPTY;
    }
    @Override public ImmutableMap<BuildTarget,CxxPreprocessorInput> getTransitiveCxxPreprocessorInput(    CxxPlatform cxxPlatform,    HeaderVisibility headerVisibility){
      return ImmutableMap.of(getBuildTarget(),getCxxPreprocessorInput(cxxPlatform,headerVisibility));
    }
    @Override public NativeLinkableInput getNativeLinkableInput(    CxxPlatform cxxPlatform,    Linker.LinkableDepType type){
      return type == Linker.LinkableDepType.STATIC ? NativeLinkableInput.of(ImmutableList.<SourcePath>of(),ImmutableList.<String>of(),ImmutableSet.<Path>of()) : NativeLinkableInput.of(ImmutableList.<SourcePath>of(new BuildTargetSourcePath(sharedLibraryDep.getBuildTarget(),sharedLibraryOutput)),ImmutableList.of(sharedLibraryOutput.toString()),ImmutableSet.<Path>of());
    }
    @Override public Optional<Linker.LinkableDepType> getPreferredLinkage(    CxxPlatform cxxPlatform){
      return Optional.absent();
    }
    @Override public PythonPackageComponents getPythonPackageComponents(    CxxPlatform cxxPlatform){
      return PythonPackageComponents.of(ImmutableMap.<Path,SourcePath>of(),ImmutableMap.<Path,SourcePath>of(),ImmutableMap.<Path,SourcePath>of(Paths.get(sharedLibrarySoname),new PathSourcePath(getProjectFilesystem(),sharedLibraryOutput)),ImmutableSet.<SourcePath>of(),Optional.<Boolean>absent());
    }
    @Override public Iterable<AndroidPackageable> getRequiredPackageables(){
      return ImmutableList.of();
    }
    @Override public void addToCollector(    AndroidPackageableCollector collector){
    }
    @Override public ImmutableMap<String,SourcePath> getSharedLibraries(    CxxPlatform cxxPlatform){
      return ImmutableMap.of();
    }
    @Override public boolean isTestedBy(    BuildTarget buildTarget){
      return false;
    }
  }
;
  resolver.addAllToIndex(ImmutableList.of(sharedLibraryDep,dep));
  GenruleBuilder pyDepBuilder=GenruleBuilder.newGenruleBuilder(PYTHON_DEP_TARGET).setOut("String_Node_Str");
  pyDepBuilder.build(resolver);
  CxxPythonExtensionBuilder extensionBuilder=(CxxPythonExtensionBuilder)getBuilder(target).setDeps(ImmutableSortedSet.of(depTarget));
  CxxPythonExtensionDescription desc=(CxxPythonExtensionDescription)extensionBuilder.build().getDescription();
  CxxPythonExtension extension=(CxxPythonExtension)extensionBuilder.build(resolver,new FakeProjectFilesystem(),TargetGraphFactory.newInstance(extensionBuilder.build(),pyDepBuilder.build(),GenruleBuilder.newGenruleBuilder(depTarget).build()));
  extension.getPythonPackageComponents(cxxPlatform);
  BuildRule rule=resolver.getRule(desc.getExtensionTarget(target,cxxPlatform.getFlavor()));
  assertEquals(ImmutableSortedSet.of(sharedLibraryDep),rule.getDeps());
}

Fixed version (ground truth):
@Test public void createBuildRuleNativeLinkableDep(){
  BuildTarget target=BuildTargetFactory.newInstance("String_Node_Str");
  BuildRuleResolver resolver=new BuildRuleResolver();
  SourcePathResolver pathResolver=new SourcePathResolver(resolver);
  CxxPlatform cxxPlatform=CxxPythonExtensionBuilder.createDefaultPlatform();
  final BuildRule sharedLibraryDep=createFakeBuildRule("String_Node_Str",pathResolver);
  final Path sharedLibraryOutput=Paths.get("String_Node_Str");
  final String sharedLibrarySoname="String_Node_Str";
  BuildTarget depTarget=BuildTargetFactory.newInstance("String_Node_Str");
  BuildRuleParams depParams=BuildRuleParamsFactory.createTrivialBuildRuleParams(depTarget);
  AbstractCxxLibrary dep=new AbstractCxxLibrary(depParams,pathResolver){
    @Override public CxxPreprocessorInput getCxxPreprocessorInput(    CxxPlatform cxxPlatform,    HeaderVisibility headerVisibility){
      return CxxPreprocessorInput.EMPTY;
    }
    @Override public ImmutableMap<BuildTarget,CxxPreprocessorInput> getTransitiveCxxPreprocessorInput(    CxxPlatform cxxPlatform,    HeaderVisibility headerVisibility){
      return ImmutableMap.of(getBuildTarget(),getCxxPreprocessorInput(cxxPlatform,headerVisibility));
    }
    @Override public NativeLinkableInput getNativeLinkableInput(    CxxPlatform cxxPlatform,    Linker.LinkableDepType type){
      return type == Linker.LinkableDepType.STATIC ? NativeLinkableInput.of(ImmutableList.<SourcePath>of(),ImmutableList.<String>of(),ImmutableSet.<Path>of()) : NativeLinkableInput.of(ImmutableList.<SourcePath>of(new BuildTargetSourcePath(sharedLibraryDep.getBuildTarget(),sharedLibraryOutput)),ImmutableList.of(sharedLibraryOutput.toString()),ImmutableSet.<Path>of());
    }
    @Override public NativeLinkable.Linkage getPreferredLinkage(    CxxPlatform cxxPlatform){
      return Linkage.ANY;
    }
    @Override public PythonPackageComponents getPythonPackageComponents(    CxxPlatform cxxPlatform){
      return PythonPackageComponents.of(ImmutableMap.<Path,SourcePath>of(),ImmutableMap.<Path,SourcePath>of(),ImmutableMap.<Path,SourcePath>of(Paths.get(sharedLibrarySoname),new PathSourcePath(getProjectFilesystem(),sharedLibraryOutput)),ImmutableSet.<SourcePath>of(),Optional.<Boolean>absent());
    }
    @Override public Iterable<AndroidPackageable> getRequiredPackageables(){
      return ImmutableList.of();
    }
    @Override public void addToCollector(    AndroidPackageableCollector collector){
    }
    @Override public ImmutableMap<String,SourcePath> getSharedLibraries(    CxxPlatform cxxPlatform){
      return ImmutableMap.of();
    }
    @Override public boolean isTestedBy(    BuildTarget buildTarget){
      return false;
    }
  }
;
  resolver.addAllToIndex(ImmutableList.of(sharedLibraryDep,dep));
  GenruleBuilder pyDepBuilder=GenruleBuilder.newGenruleBuilder(PYTHON_DEP_TARGET).setOut("String_Node_Str");
  pyDepBuilder.build(resolver);
  CxxPythonExtensionBuilder extensionBuilder=(CxxPythonExtensionBuilder)getBuilder(target).setDeps(ImmutableSortedSet.of(depTarget));
  CxxPythonExtensionDescription desc=(CxxPythonExtensionDescription)extensionBuilder.build().getDescription();
  CxxPythonExtension extension=(CxxPythonExtension)extensionBuilder.build(resolver,new FakeProjectFilesystem(),TargetGraphFactory.newInstance(extensionBuilder.build(),pyDepBuilder.build(),GenruleBuilder.newGenruleBuilder(depTarget).build()));
  extension.getPythonPackageComponents(cxxPlatform);
  BuildRule rule=resolver.getRule(desc.getExtensionTarget(target,cxxPlatform.getFlavor()));
  assertEquals(ImmutableSortedSet.of(sharedLibraryDep),rule.getDeps());
}