• No results found

Kconfig Semantics

In document Feature Model Synthesis (Page 89-93)

We also reverse engineered formal semantics in denotational style [Sch86] for the

Kconfig language. We based these semantics first on the Kconfig specification [Zc],

then when in doubt, on how the graphical xconfig configurator performed, and also examined the source code when needed. The semantics are available in AppendixA.

Feature Graph Extraction

In this chapter, we introduce the first of our feature model synthesis algorithms called FEATURE-GRAPH-EXTRACTION(FGE). Given a set of features and a propositional formula,

FGE is an automated algorithm that recovers a feature graph describing all feature

diagrams that is entailed by the input. This algorithm recovers all components of a fea- ture model: its possible hierarchies, feature cardinalities (i.e., optional and mandatory features), and possible feature groups. We describe two variants of FGEthat operate on

propositional formulas in conjunctive normal form (CNF) and disjunctive normal form (DNF) called FGE-CNF and FGE-DNF respectively.

The recovered feature graph can be used as an intermediate format for other synthesis algorithms that derive feature models. For example, the feature graph can be used as part of an interactive model builder[JKW08], or as part of a feature model merge

operation [Ach11]. We discussed several scenarios involving FGE in Chapter 3. In

Chapter 6, we present our own approach for selecting a distinct feature model by applying a textual similarity heuristic on feature names and descriptions.

We performed two experiments to evaluate the scalability of FGE-CNF and FGE-DNF

against existing feature model synthesis algorithms with input representative of that used in practical synthesis scenarios. For FGE-CNF, we compare it to the BDD-based

algorithm introduced by Czarnecki and W ˛asowski[CW07] that we call FGE-BDD. FGE-

CNF and FGE-BDD both take the same input and output the same feature graph. For

FGE-DNF, we compare it with the formal concept analysis-based algorithm by Ryssel

et al.[RPK11] that we present as FGE-FCA in this chapter. FGE-FCA takes input in a

similar form as FGE-DNF and outputs the same feature graph. We show that FGE-CNF is

significantly faster than FGE-BDD, while FGE-DNF performs comparably with FGE-FCA,

Chapter Organization We begin this chapter by summarizing three feature model synthesis scenarios that FEATURE-GRAPH-EXTRACTION addresses in Section 5.1. Sec-

tion5.2defines the feature model synthesis and the feature graph synthesis problem. We describe the generic FGE algorithm in Section5.3. Sections5.4 and5.5describes

FGE-CNF and FGE-DNF respectively. Next, we describe the two algorithms that we use

in our experimental evaluation according to the FGE algorithm. In Section 5.6, we

describe the BDD-based algorithm by Czarnecki and W ˛asowski and in Section5.7, we describe the formal concept analysis-based algorithm by Ryssel et al. [RPK11]. We

describe our experimental evaluation of FGE-CNF against baseline implementations

of the BDD-based algorithm and a formal concept analysis (FCA)-based algorithm in Section5.9.

Publications The FGE and the SAT-based variants that operate on CNF and DNF

input was published in[ACSW12]. We submitted an extended journal version of the

paper[SRA+13] with a more extensive evaluation comparing our algorithm with the

FCA-based algorithm by Ryssel et al.[RPK11].

External Contributions FGE-BDD is based on the BDD synthesis algorithm by pub-

lished by Czarnecki and W ˛asowski[CW07]. FGE-CNF and FGE-DNF were developed

and implemented with Andersen and the algorithms and the initial evaluation appear in[ACSW12] and her Master’s thesis [And09]. We expand on the evaluation to include

a larger dataset with the Linux variability model and 267 SPLOT feature models. We also conducted an evaluation comparing FGE-DNF with FGE-FCA, an adaptation of the

synthesis algorithm by Ryssel et al.[RPK11] to the FGE framework. This section was

written by Ryssel for[SRA+13] and adapted for this thesis.

5.1 Motivation and Scenarios

We use three synthesis scenarios from Chapter3to motivate our work on the FEATURE-

GRAPH-EXTRACTIONalgorithm. We summarize the scenarios below.

Scenario 1: Tool-assisted feature model reverse engineering This scenario de- scribed reverse engineering a feature model from code. Variability rich software, such as the FreeBSD kernel, can benefit from feature model. The FreeBSD operating system

kernel is configured prior to compilation to derive variations of the kernel functional- ity. Unlike the Linux kernel[BSL+10b], the FreeBSD kernel does not have a feature

model that makes configuration easier for users, and variability management easier for developers.

In this scenario, the source code contains variability. This variability could be as modules, or annotative with C preprocessor#ifdefstatement in FreeBSD. A variabil- ity analysis, such as a static code analysis, can uncover variation points (VPs) and dependencies between these. The resulting VPs and dependencies are used as input to the feature model synthesis algorithm. Dependencies extracted from source code can be translated to a CNF formula, and FGE-CNF can be used to identify all possible

feature diagrams for the input. FEATURE-GRAPH-EXTRACTIONalong with FEATURE-TREE-

SYNTHESIS(Chapter6) provide a scalable feature model synthesis infrastructure capable

of synthesizing large feature models with several thousand features.

Scenario 2: Feature model synthesis from product configurations The next sce- nario involves synthesizing a feature model from a set of variants that describe a product line. These variants could include code developed with a clone-and-own approach[JDB07] or as individual model variants. Examples of variant analysis for

this scenario include Rubin and Chechik’s technique for identifying similarities between model instances by comparing and matching model instances[RC12]. Ryssel et al. also

described an algorithm that used model matching and difference to identify VPs and abstract the model variants into a set of VP configurations[RPK12]. In this scenario,

features and feature configurations are used as input to FEATURE-GRAPH-EXTRACTION.

Feature configurations are naturally represented as a DNF formula making FGE-DNF

suitable for this scenario.

Scenario3: Feature model merge operations Our third scenario involves feature model merge operations as described by Acher[Ach11]. A merge creates a new feature

model that describes the intersection or union of configurations of two or more feature models. The input models are translated to their propositional formulas[Bat05], then

a propositional merge is performed. The exact configuration semantics depends on the selected kind of merge. For the hierarchy, Acher applies heuristics for selecting the hierarchy based on the structures of the input models. These heuristics enable the automatic selection of a feature tree without further user input. Acher’s feature model management infrastructure [Ach11] implements the operations using our previous

with few dozens of features. The FEATURE-GRAPH-EXTRACTION algorithm presented here

can be used to improve the scalability of that infrastructure. The FGE-CNF algorithm in

particular, is a perfect fit for this scenario since the configuration semantics of feature models translate naturally to a propositional formula in CNF.

5.2 Defining the Feature Model and Feature Graph

In document Feature Model Synthesis (Page 89-93)