Lines Matching +full:copy +full:- +full:item

1 #!/usr/bin/perl -w
2 # SPDX-License-Identifier: GPL-2.0-only
4 # Copyright 2015 - Steven Rostedt, Red Hat Inc.
5 # Copyright 2017 - Steven Rostedt, VMware, Inc.
9 # config-bisect.pl [options] good-config bad-config [good|bad]
24 # $ config-bisect.pl /path/to/good/config /path/to/bad/config
43 # $ config-bisect.pl /path/to/good/config /path/to/bad/config good
46 # $ config-bisect.pl /path/to/good/config /path/to/bad/config bad
48 # Do not change the good-config or bad-config, config-bisect.pl will
49 # copy the good-config to a temp file with the same name as good-config
50 # but with a ".tmp" after it. It will do the same with the bad-config.
52 # If "good" or "bad" is not stated at the end, it will copy the good and
54 # warn before writing over them (-r will not warn, and just write over them).
55 # If the last config is labeled "good", then it will copy it to the good .tmp
56 # version. If the last config is labeled "bad", it will copy it to the bad
74 usage: config-bisect.pl [-l linux-tree][-b build-dir] good-config bad-config [good|bad]
75 -l [optional] define location of linux-tree (default is current directory)
76 -b [optional] define location to build (O=build-dir) (default is linux-tree)
77 good-config the config that is considered good
78 bad-config the config that does not work
83 Note, each run will create copy of good and bad configs with ".tmp" appended.
88 exit(-1);
190 my $delta = $end_time - $start_time;
328 foreach my $item (keys %a) {
329 if (defined($b{$item}) && $b{$item} ne $a{$item}) {
330 $ret{$item} = $b{$item};
347 foreach my $item (keys %b) {
348 if (!defined($a{$item})) {
349 $ret{$item} = $b{$item};
358 # +1 if a and b have a different item.
359 # -1 if a has something b does not
369 foreach my $item (keys %b) {
370 if (!defined($a{$item})) {
373 if ($a{$item} ne $b{$item}) {
378 foreach my $item (keys %a) {
379 if (!defined($b{$item})) {
380 return -1;
460 doprint " $config $good_value -> $bad_value\n";
479 foreach my $item (@half) {
480 doprint "Updating $item to $source_configs{$item}\n";
481 $tmp_config{$item} = $source_configs{$item};
497 # diff_arr is what is in both good and bad but are different (y->n)
528 doprint " -----------\t\t\t----------\n";
529 foreach my $item (@diff_arr) {
530 doprint " $good_configs{$item}\t$bad_configs{$item}\n";
588 doprint "Difference between good (+) and bad (-)\n";
590 foreach my $item (keys %bad_configs) {
591 if (!defined($good_configs{$item})) {
592 print_config "-", $bad_configs{$item};
596 foreach my $item (keys %good_configs) {
597 next if (!defined($bad_configs{$item}));
598 if ($good_configs{$item} ne $bad_configs{$item}) {
599 print_config_compare $good_configs{$item}, $bad_configs{$item};
603 foreach my $item (keys %good_configs) {
604 if (!defined($bad_configs{$item})) {
605 print_config "+", $good_configs{$item};
608 return -1;
636 if ($ARGV[0] !~ m/^-/) {
641 if ($opt eq "-b") {
644 die "-b requires value\n";
649 elsif ($opt eq "-l") {
652 die "-l requires value\n";
657 elsif ($opt eq "-r") {
661 elsif ($opt eq "-h") {
675 if ( ! -d $tree ) {
679 if ( ! -d $build ) {
711 if ( ! -f $good_start ) {
714 if ( ! -f $bad_start ) {
717 if ( -f $good || -f $bad ) {
720 if ( -f $good ) {
724 if ( -f $bad ) {
730 exit (-1);
734 run_command "cp $good_start $good" or die "failed to copy to $good\n";
735 run_command "cp $bad_start $bad" or die "failed to copy to $bad\n";
737 if ( ! -f $good ) {
740 if ( ! -f $bad ) {
744 run_command "cp $output_config $good" or die "failed to copy $config to $good\n";
746 run_command "cp $output_config $bad" or die "failed to copy $config to $bad\n";